• Aucun résultat trouvé

Development of a Joystick-based Control for a Differential Drive Robot

A. N. Chand and G. C. Onwubolu

Mechatronics Laboratory, School of Engineering and Physics University of the South Pacific, Suva, Fiji Islands

chand_an@fit.ac.fj, onwubolu_g@usp.ac.fj

Abstract-The design paradigm of a joystick based control mechanism intended to provide real time control for a differential drive robot built in-house is presented and described in this paper. The novelty of the work reported in this article is the attainment of a full 360-degree of freedom movement of the robot utilizing a low cost joystick while also allowing for a secondary or keyboard mode of control to be implemented.

I. INTRODUCTION

The use of computers and computer-based peripherals in control systems is steadfastly growing and they now form an integral part of most control systems [1]. As such, there are many scientific and engineering applications such as engineering computation and analysis, data acquisition and measurement and most importantly control systems, which are best suited to computers and their associated peripherals.

The reason for this is mainly twofold [2]: first, because the Personal Computer (PC) offers un-paralleled processing abilities at remarkable speeds. And secondly, it forms the ideal front-end human machine interface through the use of Graphical User Interfaces (GUIs). Globally, research and usage of control systems using embedded computer systems/peripherals is immense. A common computer peripheral used in robotics is a joystick.

Originally intended for use as a games console, the joystick has now surpassed its customary use and has evolved as a popular choice of control mechanism in many robotic applications. It is now commonly found as the controlling mechanism of wheelchairs, robotic arms and custom-made vehicles and a number of robotic literature make references to joysticks being used in robotic applications [3]. A wireless computer-based vehicle has been developed, which is controlled using a joystick [4]. Elsewhere, a stepper motor and DC motor hybrid controlled robot has been developed and a PC is used for it’s controlling purposes while a joystick provides a secondary mode control of the robot [5]. High precision teleoperation control of a robot crane has been achieved through the use of a joystick [6]. The OmniMate mobile robot has been developed achieving full omni-directional mobility through the sole use of a joystick [7]. The amount of literature on the use of joysticks in robotic applications is vast: using joystick for controlling a four-legged robot [8], with a similar project discussed by [9] for example. Such is the usefulness and versatility of joysticks that one has even been used to control a humanoid robot [10].

The primary goal of the work reported in this article is to use a low budget-end conventional joystick in providing real time control of an existing differential drive robot [11]. The attainment of such an implementation has the implication of accelerated development of future robots requiring a real time controlling mechanism.

II. DESIGN ANDIMPLEMENTATION

A. Design Overview

The conceptual model showing the framework development of the work reported in this paper is presented in Fig. 1. A typical inexpensive, commercial off-the-shelf joystick is used as the input controlling mechanism to translate analogue signals (the operator’s actions), into a digital representation through the PC’s game port. A computer is a digital machine; therefore those numbers are the language of computers. The joystick gives its digital output as a byte written at the PC’s game port. Customized software written in a high level language constantly accesses this port and the current data on it and reads the joy-stick position. The software constantly retrieves the data from the PC’s game port, compares it with a reference set of values obtained during calibration phase and makes out meaningful sense of those numbers in deciding what the instantaneous position of the joystick is and then relays appropriate four (4) bit codes to a micro controller resident on the robot via the PC’s standard parallel port. The pre-programmed micro controller then carries out the appropriate physical task – the maneuvering direction associated with those instructions.

Meanwhile the joystick button is used as the emergency stop or halt command for the robot so that for as long as the button is pressed, the robot will remain stationary. Releasing the button lets the robot resume its path. With this preamble, formal treatment is next discussed.

B. Joystick Driver Software

The joystick driver software used to read in the button states and position of the control joystick was written in C++

language in Disk Operating System (DOS) environment. C++

allows easy access to a PC’s ports using the outportb() and inportb() functions.

The internal construction, architecture and electronics of a joystick varies from manufacturer to manufacturer so for the

T. Sobh et al. (eds.), Innovative Algorithms and Techniques in Automation, Industrial Electronics and Telecommunications, 37–41.

© 2007 Springer.

37

A B

C D

4-bit

codes Movement

Fig. 1. Conceptual Framework

purpose of this paper it will suffice not to endeavor with the implementation details of the joystick but to just present the generalized layout, which will be common to all joysticks, and to understand the operation of a joystick. In principal, a joystick consists of two potentiometers which are used to give a numerical indication of the joystick’s movement. Because the joystick moves in a two (2) dimensional plane, the two potentiometers give the output reading in terms of x and y co-ordinates on an imaginary x and y axis planes.

The corresponding joystick port is a very simple eight (8) bit Input/Output (I/0) card which resides in the Industry Standard Architecture (ISA) bus I/O address 201h. The Central Processing Unit (CPU) can read and write to the joystick port I/O address 201h. Reading from this address starts joystick position measurement and when a byte is read from the I/O address 201h, the status information of the joystick interface is returned.

A joystick writes its instantaneous status (information about its position and button states) as a byte written at ISA bus address 201h. The orientation or position of the joystick is represented as a two dimensional coordinate of the form (x, y) and the button states have logic representation of either a high (1) or a low (0). Having priori knowledge of what bit of the byte at ISA address 201h carries which particular information, a joystick’s position and button states may be read by the software and this is illustrated in the exhibit of Fig. 2.

The four most significant bits contain the state of the joystick buttons while the four least significant bits contain the values of the x and y coordinate values, which are used for measuring the resistance values of the joystick position potentiometers. This is how the button states (0 if pressed and 1 if not pressed) and position of the joystick have been read by the software in the work reported in this paper

.

The joystick’s range of permissible movement was then divided into four regions, namely Forward, Right, Left and Back. This was done during the calibration phase of the joystick, by noting the position values it writes at the game port at the Points A, B, C and D (see Fig. 3). These values are then used as a reference set during the writing of the software to determine in what region the joystick is positioned at a particular point in time by the use of case decision structures.

There has to be a way of letting the robot realize its desired direction of movement. A four (4) bit code representing each region of movement is then written at the parallel port which

Game port 210h byte:

8 Butto4 7

Button3 6 Button2 5

Button1 4 y2

3 x2

2 y1

1 x1

Fig. 2. Individual bits of port 210h with corresponding joystick information

Fig. 3. Joystick movement region and corresponding codes

is used as a gateway to the robot. The codes used are depicted in Fig. 3.

In summary, the joystick software continuously reads the instantaneous position and button states of the joystick via the game port. When the joystick is positioned in any of the abovementioned regions, the software writes the corresponding four (4) bit code to the parallel port. Likewise if the joystick button is pressed, the joystick writes the halt code 0000 to the parallel port. The halt command is given precedence over other directional commands so that even if the joystick is in Forward mode but its button is pressed and held, it will remain stationary until the button is released A. Parallel Port Interfacing Circuit

When the four bit codes have been written to the parallel port, they next have to be interfaced to the microcontroller. A custom-made, unidirectional, Enhanced Parallel Port (EPP) based, software controlled output interfacing card was designed to provide the parallel port-microcontroller interfacing medium. A simple circuit consisting of a 74LS373 octal D-type tri state latch and a 74LS244 octal driver tri state buffer was used to buffer the four bit code arriving through the parallel port. The 74LS373 IC is used to latch the data and the 74LS244 IC boosts up the output current. In addition, resistors of values 150Ω and 1kΩ have been used to ground

Forward 0001 Left Right 0011 0010 Reverse 0100 Digital

signals to game port

via parallel port

Robot Analog

signals

CHAND AND ONWUBOLU 38

Fig. 4. Block diagram showing interfacing between parallel port, parallel port interfacing circuit and PIC16F877

the data lines of the interfacing card to ensure correct logic levels. This circuit serves the prime and sole purpose of providing an interface medium between the PC and the microcontroller housed on the robot as direct interfacing of the data lines of the parallel port to the microcontroller is not considered good design practice as it may damage the computer’s motherboard. Hence, the four bit codes arriving at the parallel port are latched in this circuit; this circuit is then interfaced to one of the input ports of the microcontroller. The exhibit of Fig. 4 illustrates the design of the unidirectional parallel port interfacing card.

A. Microcontroller

The hub of operations and intelligence of the differential drive robot is a PICmicro® microcontroller, specifically the Microchip Technology PIC16F877 eight bit CMOS microcontroller with built in EPROM. The microcontroller is available as a 40-pin DIP package containing a central processor, EPROM, RAM, timer(s), and TTL/CMOS compatible input/output lines. It will coordinate the four (4) bit code it receives from the buffering circuit and according to those codec instructions it will maneuver the robot accordingly. Other microcontrollers may be used; giving the microcontroller its intelligence is just elementary programming, described next. Port B of the PIC16F877 has been assigned as the input port. (Choice of using Port B as the input port was arbitrary and any port may be used). Being the input port, it has been interfaced to the buffering circuit so that it may receive the four bit codes and make the decision.

The micro controller software, programmed in the C programming language continuously reads port B for any arriving four-bit codes sent via the parallel port and the buffering circuit. Once a four-bit code is registered as port B, the micro controller makes a decision as to which motors (of the robot) it should control to attain the specified movement associated with that four bit code. This is done through the use of simple decision structures. The way in which the robot direction is controlled, based on the input signals provided to the motor controller circuits sent via the microcontroller is illustrated in the logic table of Table 1.

Thus, a low budget-end joystick and microcontroller has been used to provide real time control of a robot.

TABLE 1

MOVEMENT CODES AND CORESSPONDING MOTOE ACTIONS

Code Movement Motor Action

0000 Halt Motor A= off Motor B=off 0001 Forward Motor A= on Motor B=on 0010 Right Motor A= on Motor B=off 0011 Left Motor A=off Motor B=on

0100 Back Motor A=on (Anti C/W)

Motor B=on (Anti C/W)

B. Robot

The subject robot is in principle a relatively simple and existing differentially-driven mobile platform with each wheel of the robot coupled to an independently driven dc motor [11]. Attendant freely rotating passive wheels, castors, are fixed at the front and rear sides of the mobile base for easy movement and stability. The control electronics of the robot encompasses a motor controller circuit, microcontroller board, infra red sensors for obstacle detection and a simple regulator circuit.

The motor controller circuit consists of one monolithic, high voltage, high current Darlington pair current driver (ULN2003A) and four (4) Single Pole Double Throw (SPDT) relays which are used to control the rotational direction of the dc motors by controlling the direction of the flow of current through the motors. The microcontroller board is adapted on the circuit schematics provided by Microchip Technology [12].

III. KEYBOARD MODE OF CONTROL

The modular design of the hardware and microcontroller software settings has made it possible to implement a second mode of control with ease: the keyboard keys have been used to provide control of the robot as well, with the arrow keys being used to provide the four (4) directions and the space bar key used as the halt command. This is done by retrieving the ASCII codes of these keys using the bioskey() function on the bios.h header. The ASCII codes (American Standard Code for Information Interchange) are a set of distinct eight (8) bit codes assigned to each key on the keyboard such that examining the ACSII code of a key

Parallel port interfacing circuit Robot

4 bit code

Parallel Port 74LS373 74LS244 PIC16F877 Motor B

Motor Controller Circuit Motor A

DEVELOPMENT OF A JOYSTICK-BASED CONTROL 39

A

B

B’

α

α4

B

B’

α

reveals what key it is. This concept is used for establishing the identity of what arrow keys has been registered. Once an arrow key or the space bar has been registered, the corresponding four-bit code of that command is then again written to the parallel port just as in the case of using the joystick.

IV. SYSTEM REQUIREMENTS

A. Control Software

The joystick driver software for this research project was written with Borland® C++ 5.02 Compiler for Microsoft’s Windows® Operating System. The software can only be executed on machines running Windows® 98 and will not execute on Windows® 2000 / NT / XP platforms, as direct hardware access is not possible in these newer versions of Windows® operating systems without the use of invoking device drivers. The recommended minimum systems requirements are 64 MB RAM and 2 GB hard drive with one unused game port, one serial port and one parallel port.

B. Microcontroller Software

The software for the PIC16F877 micro controller was written with PIC C Compiler® which was used to convert the high level language into machine language compatible for the microcontroller. Tera Term Pro software was then used to send the machine language file to the micro controller through a serial port.

In summary, a Personal Computer with Windows 98 Operating System, Borland C++ compiler, PIC C Compiler, and Tera Term software together with one unused game port, serial port and parallel port were required.

V. TESTING AND EXPERIMENTATION

The validation and verification of any newly proposed or developed system is imperative. Therefore experimentation of the developed prototype was carried out to measure the performance of the joystick based control mechanism with several tests designed and executed to measure the efficacy of the system. Although this research attained results already accomplished elsewhere utilizing other controlling mechanisms, it demonstrates that reasonable functionality can be accomplished with low budget-end components. It is noteworthy to realize that the concept of real time control is directly related to how fast the robot responds to an input signal, provided by a user. Therefore, the important metric of measurement was the time lapse (t) between an input command provided by a user and the triggering of the robots motion in response to the input command. The first test consisted of a straight-line path investigation using the joystick control system developed. For the test results shown in Fig. 5 and Table 2, A = initial starting point, B = expected destination, B’ = actual destination,

α

= deviation of robot,

β

= braking distance of robot and t = time lapse between input signal and movement of robot.

Fig. 5. Test Case 1: Straight line investigation of joystick control

TABLE 2 TEST CASE 1RESULTS

Trial α

(meters)

β (meters)

t (seconds)

1 0.20 0.05 0.00

2 0.19 0.04 0.00

3 0.21 0.05 0.00

4 0.21 0.03 0.00

5 0.20 0.05 0.00

6 0.17 0.04 0.00

7 0.19 0.03 0.00

8 0.21 0.03 0.00

9 0.20 0.04 0.00

10 0.19 0.05 0.00

mean μ 0.18 0.04 0.00

std dev. σ 0.01257 0.008756 0.00

The second test consisted of a multi path investigation of the joystick control system developed. For the test results shown in Fig. 6 and Table 3, A = initial starting point; B, C, D

= expected destinations; B’, C’, D’ = actual destinations;

α

1,

α

2,

α

3,

α

4= deviations of robot and

β

1,

β

2,

β

3,

β

4= the braking distances of robot.

A’

Fig. 6. Test Case 2: Multi path investigation of joystick control α1

B

α3

α2

A

D’

D

C’

C

CHAND AND ONWUBOLU 40

TABLE 3 TEST CASE 2RESULTS Trial α1

(m) β1

(m) 2

α

(m) β2

(m) 3

α

(m) β3

(m) 4

α

(m) β4

(m) 1 0.20 0.05 0.21 0.04 0.19 0.03 0.17 0.04 2 0.19 0.04 0.21 0.04 0.19 0.05 0.18 0.03 3 0.21 0.05 0.19 0.03 0.17 0.04 0.18 0.03 4 0.21 0.03 0.18 0.02 0.18 0.04 0.18 0.04 5 0.20 0.05 0.19 0.05 0.19 0.03 0.19 0.03 6 0.17 0.04 0.20 0.05 0.21 0.02 0.18 0.03 7 0.19 0.03 0.21 0.04 0.20 0.03 0.19 0.03 8 0.21 0.03 0.20 0.03 0.21 0.03 0.22 0.03 9 0.20 0.04 0.18 0.02 0.19 0.04 0.19 0.04 10 0.19 0.05 0.20 0.03 0.19 0.04 0.17 0.04 μ 0.18 0.04 0.197 0.036 0.192 0.0372 0.185 0.037

σ 0.012 0.008 0.011 0.010 0.012 0.008 0.014 0.005

From the experimentations, it is important to indicate that it was noted in the testing phase that (1) there is no measurable time lapse (using a stopwatch) between an input command provided by the joystick and the triggering off of the robot’s motion implying the achievement of an excellent real time control, (2) any directional movement may be attained by the joystick, resulting in a full 360 degrees of freedom. In addition, the braking distances (

β

) and deviations (

α

) of the robot in reaching the desired destination points are negligible and therefore may be trivialized.

VI. CONCLUSION

The design and implementation of a joystick based control mechanism has been presented and successfully implemented in giving real time control of a differential drive robot. The hardware and micro controller software settings make it possible to utilize the computer keyboard arrow keys for controlling the direction and the space bar key as the stop button command as a secondary mode of control of the robot.

A Graphical User Interface (GUI) forms the front-end human interface and allows the end user to choose between the two modes of control. The control mechanism has been tested and found to give very reasonable control. There is no measurable time lapse between the joysticks movement and the robot’s triggered motion implying the achievement of a very reasonable real time control. That the proposed mechanism should be a low cost and economical one was achieved as the whole control mechanism was implemented at a mere cost of a value of less than US$150. Accomplishing real time control using a low budget end computer joystick was the novelty of this research project. Current ongoing work includes incorporating wireless transmission to ease the inherent restrictions in having a hardwired system.

ACKNOWLEDGEMENT

The authors would like to thank Mr. Shivendra Kumar and Mr. Hamendra Reddy of the School of Engineering and Physics at the University of the South Pacific.

REFERENCES

[1] Hordeski, M. F. (1992) Control System Interfaces. Design and Implementation Using Personal Computers, Prentice Hall.

[2] Tooley, M. (1995) PC Based Instrumentation and Control, Butterworth- Heinemann Ltd.

[3] Chiri, M. (2002) Joystick Control for TinyOS Robot. Department of Electrical Engineering and Computer Science. University of California, Berkeley.

[4] Lobato, E. P. (2000) A wireless computer-controlled vehicle.

Departmento de Ingenieria de Sistemas -Universidad de Antofagasta, Chile.

[5] Li, Y.(2000) Design of Stepper Motor and DC Motor Hybrid Controlled Robot. Proceedings of International Conference on Advanced Manufacturing Systems and Manufacturing.

[6] Dagalaki, H.G., Albus, J. S., Bostelman, R.V. and Fiala, F. (2000) Development of the NIST Robot Crane Teleoperation Controller.

National Institute of Standards and Technology.

[7] Borenstein, J. and Evans, J. (1997) The OmniMate Mobile Robot.

Proceedings of the IEEE International Conference on Robotics and Automation, Albuquerque, NM, Apr. 21-27, 1997, pp. 3505-3510.

[8] Germann, D., Bruckmann, T. and Hiller, M. (2001) Joystick Force Feedback based on Proximity to the Linearised Workspace of the Four-legged Robot ALDURO. 4th International Conference on Climbing and Walking Robots CLAWAR. Karslruhe, Germany, Septermber 24-26.

[9] Moore, K. L., and Flann, N. S. (1999) A Six-wheeled Omnidirectional Autonomous Mobile Robot. Proceedings of 1999 IEEE International Symposium on Intelligent Control / Intelligent Systems and Semiotics, Cambridge, MA, September 1999.

[10] Sian, N. E., Yokoi, K., Kajita, S., Kanehiro, F. and Tanie, K. (2002) Whole Body Teleoperation of a Humanoid Robot. Development of a

[10] Sian, N. E., Yokoi, K., Kajita, S., Kanehiro, F. and Tanie, K. (2002) Whole Body Teleoperation of a Humanoid Robot. Development of a

Outline

Documents relatifs