Design And Development of an Autonomous Mobile Robot

Design And Development of an Autonomous Mobile Robot

Copyright @ IF AC Advances in Control Education, Gold Coast, Queensland, Australia, 2000 DESIGN AND DEVELOPMENT OF AN AUTONOMOUS MOBILE ROBOT S.S. G...

1MB Sizes 1 Downloads 144 Views

Copyright @ IF AC Advances in Control Education, Gold Coast, Queensland, Australia, 2000

DESIGN AND DEVELOPMENT OF AN AUTONOMOUS MOBILE ROBOT

S.S. Ge, T.H. Lee, Z.L. Roan and V.H. Ren

Department 0/ Electrical and Computer Engineering National University o/Singapore 4 Engineering Drive 3 Singapore 117576 Tel: (+65) 8 74 6821, Fax: (+65) 7791103, E-mail: [email protected]

Abstract---Control engineering itself is multi-disciplinary and encompasses many domain knowledge such as mechanical engineering, computer engineering, and control theory. For the training of control engineering students, a mini project has been identified for them to integrate all the knowledge they have learnt and deliver a working system --- an autonomous mobile robot balancing an inverted pendulum. The project is small enough for delivery yet needs for students to integrate knowledge systematically. Copyright@ 2000IFAC Keywords: Mobile robots, Digital signal processor, Fuzzy control, Educational aids.

1. INTRODUCTION

system design for optimal performance. To train the students the concepts of system design and subsystem design, a brand new DSP board (Texas Instruments TMS320C3X User's Guide, 1997) is designed in the laboratory which acts as the chassis of the vehicle for weight reduction and fast acceleration and deceleration, and also as the brain for the necessary computational and signal processing requirements.

Control Engineering and robotics are multidisciplinary in nature. To build an autonomous robot from scratch, the students are first required to investigate the mechanical design and its construction for the whole system design. For better handling of the system, a rear fixed wheel drive and front wheel steering design was confmned. The students are also required to construct other mechanical hardware like motor cage, pendulum pivot, wheels, etc. The mechanical system requirement is high since it affects the performance tremendously. After the completion of the mechanical design, the students appreciate the fact that as a system, every aspect of the system is important.

Because the robot is fully autonomous, everything has to be on board, including the on-board DSP, static RAM, EEPROM, Analog to Digital Converter, amplifier, motor driver, etc. The students are first required to prototype their circuits, after that, they are required to design mixed signal multi-layered Printed Circuit Board with the aids of commercial EDA software. Note that the design of the DSP board is not isolated. The students have to consider from the system's point of view and accommodate the requirement of other modules.

For the on-board DSP circuit design, if using commercially available digital signal processor (DSP) board, the students can only learn the programming and actual application of the board, they would have neither the experience and knowledge of DSP circuitry design, nor the concept and experience of

As a training tool, different control algorithms can be

213

used and tested. Before the students are allowed to test their controller on the robot, simple simulation studies have to be carried out. Because of their simplicity in tuning, PD, PID and fuzzy logic (Yager and Filev, 1994), and a combination of them are used. The students are required to design and implement such a controller and tune it to work. They are also required to use various signal processing techniques to condition the signals.

~I .

(

In order to implement various algorithms, the students are required to program the on board processor with assembly and C language to directly control the hardware. Moreover, in order to interface with the robot, the students are required to write interface program in a PC envirorunent using C++ language. This enhances their skills in knowledge on microprocessor architecture and OUI programming.

11 (

_A

~

)(

X

11

)(

'"

X

_0

11

X'

)

I.

Y

X V'

_c

11 )

Fig. 1. Pole balancing robot and the multi-sloped platform

With the completion of the system, students are extensively trained in the areas described in the following sections as well as hands on experience.

2.

MECHANICAL DESIGN

A pole balancing robot is a vehicle with an inverted pendulum mounted on the top. The inverted pendulum is free to swing in one dimension. The task of the robot is to move back and forth on a sloped platform as many round as possible within a fixed duration. The robot's returning to the start point after reaching the other end of the platform is considered one complete round. The platform consists of three portions of 1 meter each and the sloped portion is of 5.7 degrees as shown in Fig. 1.

Fig. 2. Side View of the Robot

Fig. 2 shows the fmal design of the autonomous pole balancing robot. In order for the robot to be able to travel at high speed, the weight of the robot is reduced by all means. The actual chassis of the robot is a printed circuit board (PCB) (Jawitz, 1997), on which all the components used were, if possible, changed from the dual-in-line package (DIP) to surface mount package (SMD). This caused a huge reduction in the overall size and weight of the chassis. As shown in Fig. 2, the free swing pole is directly attached to the precision potentiometer with a side screw, and positioned at the center of the robotic vehicle. The supporting beam which encloses the potentiometer is then mounted onto the PCB, the pole has only one support beam instead of one on each side of it.

~Q

! I

I.L

01

!

;I-~I-In LJ '- -' I

11 ' OSP !

[5~LJ i

I

R.... Encoder

( ,_ ---,

Fig. 3. Plan view of the vehicle chassis the distance encoder, potentiometer and infrared sensors. Optical encoder units are mounted on both the rear and front wheels of the robot to detect the distance traveled. This is done to ensure that the encoded distance between the two wheels conformed to the same distance measured. The encoder units comprise of a HEDS-Sl 00 code-wheel, a HEDS-9000 encoder module, a HCTL 2016 decoder chip and a IMHz oscillator. A set of 8 infra-red (IR) sensors are also mounted at the front and rear of the vehicle. These sensors inform the DSP about the distance offset between the encoded distance and the actual

3. HARDWAREDESION The plan view of the basic hardware design is shown in Fig. 3 and the chassis PCB is shown in Fig. 4. The information of distance, angle, and directional signal from the robot are read using sensors such as

214

converters are used to reduce the 110 accessing time, and digital pulse-width-modulation (PWM) generator is used instead of analog version. The generator consists of two channels and each is able to output pulse train of 1024 different duty cycles, and each motor is controlled by one channel. Nickel metal hydride rechargeable batteries are use to supply power for both digital and analog circuits.

4. SOFTWARE IMPLEMENTATION With the increasing number of tasks that the DSP board needs to perform, the single process architecture is no longer suitable. Moreover, the robot is a real time system, which means the tasks have to be performed within the specified time range. Therefore, a multitasking real time operating system (RTOS) is essential to solve the above problems. The RTOS is responsible for the system initialization, providing 10 interface to the task, interpreting user commands sent from PC in run time. The RTOS schedules the system resources to the tasks and ensures every individual task fmishes running within the required period. When the robot is running, several controllers are expected running simultaneously including the angle controller, the distance controller, the steering controller and the synchronizing controller. The RTOS is responsible to schedule and synchronize among these controllers. Moreover, the RTOS provides the services to interface with 110 devices like communication device and analog-to-digital converter.

Fig. 4. Chassis PCB of the Robot

Fig. 5. Architecture Overview of the Pole Balancing Robot distance from the reflective tapes on the multi-sloped platform. Together with the optimal encoder, the IR sensors guides the robot within the platform as it transverses back and forth. The role of the potentiometer circuitry is to sense the angular position of the pole. Under gravitational forces and movements of the robot, the free swing pole of one degree of freedom can either tilt forward or backward. This angular difference from the vertical axis of the pole is then translated into electrical signals by a high precision 20K ohm servo mount potentiometer.

The software and fuzzy logic control algorithms were written in ANSI C programming language and a development compiler provided by Texas Instruments was used to translate it into TMS320C31 assembly language source. Upon startup of the DSP, the boot loader is downloaded from the computer through its serial port. The serial port thus had to be configured properly as with all other DSP peripherals. Moreover, for software debugging, a communication interface is implemented to transmit data between the robot and the PC. With the communication software the robot can display any information required on th~ PC monitor. This makes the debugging of a program a lot easier.

In this design, one DC motor and one stepper motor are deployed to serve both purposes--driving and steering. The obvious advantage is that the vehicle is more powerful and likely to travel faster, and a more flexible steering is available. The stepper motor circuitry encompass the stepper motor and its driver. The motor driver controls the current input to the stepper motor that subsequently turns in steps to the left or right in order to keep the vehicle to the center of the platform.

5. CONTROLLER DESIGN In real time, under the influence of gravity and other disturbances, the pole balancing robot requires fairly complex mathematics and physics in dynamic modeling. Even if equations are derived, the analytical results on the criteria for stability, the dynamic response, the accuracy of position, and so on may not be necessarily reliable, resulting in a deadlock in this stage. Apart from the PD, PID controllers, in order to eliminate the need for a

The brain of this fully autonomous controlled pole balancing robot is a digital signal processor (DSP) TMS320C31, which is the essence of this design, see Fig. 5 for the robot's architecture overview. In addition, EPROM is added to the robot so that no downloading of program during the competition is needed. High-speed parallel Analog-to-Digital

215

mathematical model, fuzzy control is implemented since it is based on the relation between causes and effects, or actions and reactions in the form of IfThen rules including fuzzy linguistic terms (Lui, et aI., 1994; Dubois, et aI., 1994; Ge, et aI., 1996). Unlike the optimal or conventional control techniques, the fuzzy logic controller requires no explicit system parameters like torque or mass (Ge, et al., 1996; Yamakawa, 1993; Driankov, et al., 1996) and it is characterized by its simplicity.

x ()..-------.

Three of such systems studied by Ge, et al. (1996 and 1999) are proven by simulation and implementation that they are more robust than linear controllers in terms of parameter variations. These three systems, simply named FLCs 1, 2 and 3 are compared to a full state feedback linear controller (LC) in balancing a simulated inverted pendulum system. The fuzzy rules for the three FLCs are derived based on the I/O relations of the LC. The control output from FLC 1 consists of a linear combination of the outputs from two fuzzy subcontrollers, which are the fuzzy pendulum and fuzzy displacement sub-controllers as shown in Fig. 6.

,..L

~

Ft Fuzzy 1displacement subcontroller

()

B

I--

Plant

Fuzzy pendulum subcontroller

~

Fuzzy Logic Controller

F2 I-

F ~

Plant

---~

~

Fuzzy displacement subcontroller

Fig. 8: Block diagram for FLC 3

Plant

() ()

F

Fig. 7: Block diagram for FLC 2

I--

X

Fuzzy Logic Controller

Fuzzy pendulum subcontroller

studying FLC 3 is to enable heuristics and expert knowledge of an operator to be included in a particular controller design. The pole balancing vehicle produces two outputs which are the pole angle, () , and vehicle position, x. These signals are fed back to two controllers, the ()controller and the x -controller. The () -controller derives the derivative of (), and together with (), decides an output voltage to be fed to the motor so as to keep () as close to zero as possible. However with only the () -controller, the vehicle would tend to drift towards one direction due to inevitable offset between the reference set-point angle of the controller and the true () = 0 point. Therefore there is a need for an x -controller which produces a counter-offset to () before being sent to the () -controller. As with the () -controller, the x -controller derives the derivative of x and decides an appropriate () -offset so as to make the vehicle balance about a stationary point.

Fig. 6: Block diagram for FLC 1 For each of the sub-controllers, 7 fuzzy sets are used in each input universe with triangular membership functions and 50% overlap. FLC 2 is a fuzzy control scheme proposed by Yamakawa (Yamakawa, 1993) whereby only one fuzzy sub-controller is used. The inputs to the sub-controller are Ft and F2 which are linear functions of displacement, pole angle and their derivatives, as shown Fig. 7. The linear functions are given by:

The scaling parameters determine to which extent the feedback variables affect the control action. In other words they reflect the relative sensitivities of the control output to vehicle displacement, pole angle and their derivatives. FLC 3 is an attempt to combine FLCs 1 and 2 and to remove all their linear components. It comprises three fuzzy sub-controllers that replace the weighted summer in FLC 1 and the linear functions that generate Ft and F2 in FLC 2. This is clearly illustrated in Fig. 8. The motivation for

Triangular membership functions are used because of their simplicity and are least computational intensive compared to others like raised cosine or gaussian. The performance improvement if non-linear functions were used is minimal for the purpose of feedback control. The universe of discourse has to be defmed for x, x, () and iJ input variables and v, the output motor voltage. 5 antecedent and 7 consequent sets are

216

N2

NI

ZE

P1

P2

NZ

N4

N3

N2

NI

ZE

NI

N3

N2

NI

ZE

PI

ZE

N2

NI

ZE

PI

P2

PI

NI

ZE

PI

P2

P3

ZE

PI

P2

P3

P4

which means an output of positive from the x controller. Again the magnitude of acceleration is proportional to the magnitude of x and x. Given these considerations, the rule table of the x -controller turns out to be exactly the same as the B -controller's shown in Fig. 9. The x and B controllers have different characteristics and they were tuned separately. The difficulty in tuning lies in the fact that the characteristics of one controller heavily depend on the other' s to achieve optimum performance, or in other words the two controlled variables are tightly coupled. The main system defmition is the rule table. In the case of a pole balancer, the rules are quite fixed and obvious. The next thing to consider is the tuning of membership functions. In general. there are two classes of parameters to be varied: the width of the support of each set and the degree of overlap among sets. Overlap serves to interpolate the points on the control surface by taking into account the rules that govern a particular area on the surface. However if there is too much overlap, anyone rule could not dominate the system output in a particular surface area, and would result in linear interpolation. The rule of thumb is to use a degree of overlap in the region of 20 to 50 percent.

Fig. 9. Fuzzy Rules Table defmed on the input and output universes, respectively. The fuzzy sets are labeled as ZE for zero, P or N followed by an integer for positive and negative universes. After defming the input and output universes, the ifthen fuzzy rules have to be determined. Since the controllers have 2 inputs, the rules for anyone controller can be concisely defmed in the form of a two dimensional rule table. The rule table for the B -controller is illustrated in Fig. 9. There are altogether 25 rules for each controller. The rule table in Fig. 9 is derived based on common intuition. Firstly, when B and B are zero, the vehicle should stay stationary, therefore output is zero. If B is zero, a positive B should result in a movement in the positive direction. The larger the magnitude of B, the larger the reaction should be from the motor, hence corresponding to a larger output voltage.

The vehicle can be made to move by simply changing the position set-point of the x -controller according to a pre-defmed velocity-distance trajectory as shown in Fig.lO. With every distance read from the differential encoder, the velocity of the vehicle is calculated based on the trajectory and consequently the position set-point is derived. The defmitive velocities

xf,

Xb , and Xmax determines the reverse

reaction and speed of travel of the vehicle whereas Df and Db controls the amount of overshoot of the

Similarly if B is zero, a positive B should produce a positive movement and the reaction should also be proportional to the magnitude of B . As it turns out, the rules for the x -controller is exactly the same as the B -controller's. To understand how this comes about, let us consider what happens when an offset is added to the fed back angle B. If an offset of 0.1 degree is added to B, the B -controller would take that the angle is 0.1 degree when in actual case the pole is at vertical. Therefore it would move the vehicle so as to bring the received angle back to zero. The B -controller actually tries to balance the pole at a real angle of -0.1 instead of 0 because it interprets the real angle of -0.1 as 0 due to the added offset of 0.1. When this happens the vehicle would then accelerate in the negative direction because of its attempt to keep the pole at an angle of -0.1. Therefore the effect of a positive offset gives rise to a negative acceleration and correspondingly a negative offset gives positive acceleration. When x is zero and x is positive, the vehicle should accelerate negatively and thus the appropriate B offset would be positive. Similarly when x is zero and x is positive, the vehicle should accelerate in the negative direction

vehicle beyond certain pre-defmed boundaries on the platform. Owing to slippage of the vehicle tyres, the velocity cannot be set too high and the maximum velocity achievable is a function of surface and tyre condition. Furthermore, because of the drifting plant

velocity forward

Xmax

D

Db!

distance

.. _.... __ .__ . ····__·····_························_········· 7 ; - - - · reverse

Fig. 10. The Velocity-distance trajectory

217

Characteristics, such as temperature of the motor actuator and loosening of screws and gears of the vehicle chassis, the amount of distance overshoot varies from time to time. Hence the trajectory is made to adapt to these changing system characteristics by automatic online variation of the definitive velocities and distances.

xf'

7. CONCLUSION In the paper, the design and development of an autonomous fuzzy controlled pole balancing robot has been discussed in detail. After the completion of the project, the students have been trained in the several aspects: mechanical design, circuitry design, microprocessor architecture design, control system design, all of which are parts of the overall system design. This experiment training offered students further insight into the practical aspects of a nonlinear control system, and it is instrumental for students in gaining a better understanding of the various considerations in practical implementation.

Xb , and Xmax are increased if no

or minimal slippage is detected. The distance overshoot is measured using reflective tapes placed on the platform and infra-red sensors on the vehicle, and slippage is measured by means of two differential encoders coupled to the back driving wheels and free front wheels respectively. The fully autonomous robot is capable of balancing a ! meter aluminum pole while moving along a multisloped platform at high speed. After fme tuning, the robot is able to achieve as many as 40 rounds in 5 minutes.

REFERENCES Dubois, L., J. Dielot and P. Borne (1994). Use of fuzzy logic in multi-models control. Proc. of the Con[ on Systems, Man and Cybernetics, vol. 1, pp. 471-474, San Antonio, TX, USA. Driankov, D., H. Hellendoorn and M. Reinfrank (1996). An introduction to fuzzy control, Berlin ; New York: Springer. Ge, S.S., T.H. Lee and c.P. Wong (1996). Comparison Studies of Fuzzy Logic Control Strategies for an Inverted Pendulum. The Fourth

6. PHYSICAL PROBLEMS ENCOUNTERED Many undesired factors have to be taken into account in the design of a control system for a real physical plant (Ge, et al., 1999). In this inverted pendulum system, two of the most problematic physical factors are the slippage of the wheel tyres and the inevitable offset between the perceived and the true angle of the pendulum. The pole angle offset causes an attempt by the B -controller to balance the pendulum about a non-zero angle, albeit small. This results in a constant tendency for the vehicle to accelerate in the direction of the offset angle which poses as permanent disturbance to the x-controller. The controller structure used in this design solved this problem because of its inherent method of controlling the vehicle displacement by virtue of giving an offset to the angle perceived by the B -controller, which indirectly nullifies the unwanted error in angle measurement.

International Coriference on Control, Automation, Robotics and Vision (ICARCV'96), pp.1289-1293, Singapore. Ge, S.S., Y.K. Loi and c.y. Su (1999). Fuzzy logic control of a pole balancing vehicle. Proceedings of the Third International Conference on Industrial Automation, pp.! 0.17-10.20, 7-9 June 1999, Montreal, Canada. Jawitz, M.W. (1997). Printed Circuit Board Materials Handbook. McGraw Hill, New York. Lui, H.C., and M.K. Gu (1994). A Self-Tuning Adaptive Resolution (STAR) Fuzzy Control Algorithm. Proc. of the 3rd IEEE Con! on Fuzzy Systems, vol. 3, pp. 1508-1513, Orlando, FL, USA. Texas Instruments TMS320C3X User's Guide (1997), Custom Printing Company, Missouri, USA Yamakawa, T. (1993). A Fuzzy Inference Engine in Nonlinear Analog Mode and its Application to a Fuzzy Logic ControL IEEE Trans. On Neural Networks, vol. 4, no. 3, pp. 496-522. Yager, R.R., D.P. Filev (1994). Essentials of Fuzzy Modeling and Control. John Wiley and Sons, New York.

Another factor normally not taken into account in simulations is the system dead-band caused by system friction and high starting current required by some electrical motors. Since the fuzzy controller is inherently a non-linear system, it is expected to reduce the harmful effects of plant dead-band more than a linear controller can. Less noticeable but equally devastating factors include electrical noise and drifting plant characteristics due to heating of power devices and loosening of screws. Hence controlling an actual plant poses a much greater challenge as compared to a simplified simulated control. It was observed that the fuzzy system was less prone to the above-mentioned drifting plant characteristics than a PD controller, which serves to prove that fuzzy control is indeed more robust to changes in plant parameters than linear control.

218