5.1. Mobile Robot Programming Strategies

Industrial robots often feature higher level programming environments specific to the task at hand and are usually strictly sequential in terms of the commands given to the robot. However, programming of mobile robots uses standard programming languages. As such, the programmer can use more advanced features such as concurrency with multi-threaded programming and object oriented programming. But also the programmer might need to have more advanced programming knowledge.

The most common programming languages used for mobile robotics programming are:

  • Python – The default for Raspberry Pi based robots.
  • C – Used for Arduino programming and for proprietary robots because of the speed advantage. It is used to write driver software for use with other programming environments such as Python or Java.
  • MATLAB – Often used because of convenient to use math capabilities. Not all robot platforms are supported.
  • Java – Although not as popular as Python, it has a following on platforms where drivers written in C have been developed for Java.
  • LabVIEW – It is mostly used with hardware from National Instruments, but it has the advantage of simplified concurrent programming.

5.1.1. Remote Host Control

Some small robots have the problem of having a slow microprocessor and being be difficult to program and troubleshoot. Usually the later problem stems from the fact that the programmer is using a regular computer while programs developed run on a separate processor on the robot. Larger mobile systems, such as self driving cars, solve these problems by carrying powerful computers and a local network on the systems. However, that is not an option with most mobile robots. Some small mobile robots are controlled by small computers such as a Raspberry Pi robot that have their own operating system that the programmer can remotely connect to over the network. Although the lack of an operating system can sometimes yield more processing capability to the robot program, debugging programs that run on platforms without an operating system adds additional challenges.

Some small robots have another problem of their microprocessor being limited in processing speed and memory. One solution to this problem, with some disadvantages but arguably more advantages, is remote host control. In such a model, the robot runs a small program that controls the motors, reads data from the sensors, and communicates over a network with a control computer. The control computer performs most of the calculations and runs the control algorithms based on the sensor data received from the robot and then sends motor control commands to the robot.

The main advantage of this approach are as follows.

  • Faster processing capabilities
  • Easier to program and debug / troubleshoot
  • Only a small, simple program need be remotely installed on the robot
  • Multiple programs can be tested using the same robot by each program connecting to the robot – not at the same time, of course.

The main disadvantage of this approach is the network latency, which is usually not a significant problem and the dependence on having a remote control computer. The remote host control strategy might sometimes be used to facilitate development of algorithms followed by development of a local robot program.

5.1.2. Polling and Concurrency

../_images/polling.png

Fig. 5.1 Robot Polling

../_images/concurrent.png

Fig. 5.2 Robot Polling with Concurrently Operated Parts

5.1.3. Localization and Path Planning

Localization refers to knowing the pose of a mobile robot, avoiding near-by obstacles and moving towards local goal locations. Localization will be the focus of our mobile robot efforts.

Path Planning refers to the bigger picture of the robot’s objective and usually involves the use of maps. There are many path planning algorithms in use. Unfortunately, we don’t have the time in this course to study them.

For example, if a robot is designed to move to various locations inside a building, then with the use of a map of the building a path planning algorithm will give directions to the robot of where it should go as a set of way-points. Let us say that someone has placed a box in a hallway. As the robot moves along its path, the obstacle avoidance algorithms will find the box and the localization algorithms will move the robot around the box and continue along the path. If the box remains at the same location for a long time, there may be an alert sent to the operators to see if the box should be added to the map or if it should continue to be regarded as a temporary obstacle.