ArcRover is an outdoor rover with GPS using a Raspberry Pi as main computer. It is equipped with a WiFi router allowing me to log in and control it remotely with a laptop, and a web camera to stream images to the laptop as the rover is running.
In this project I will try to develop a robot that can efficiently navigate a waypoint route. To start with, the GPS will be the only sensor controlling the rover. Maybe I will add more sensors later. The objective of this project is to learn about controlling a robot with a “real” computer. I want to see what I can do when I have more computer power available. I also want to learn about Linux and other computer related topics, like sending data over a network.
Raspberry Pi and Linux
When I started working with the Raspberry Pi it was very new. And there were not much examples and articles about it on the internet. The Raspberry Pi is running Linux, which I had no experience with at all. Therefor it was hard to get started. It was a lot to learn before I could get the robot to do anything. But after a while I started to learn the basics and a realized that is was a very powerful and fun platform to work with.
By default, the main programming language in the Raspberry Pi is Python. I do not like it very much. I began programming in C++. but now a I use Java instead. I have also managed to install some other programs enabling me to log in to the Raspberry Pi over the network using SSH server (for terminal access only) and VNC server to use the graphical desktop environment over the network. I can also start a video stream from the web cam which can be viewed in VLC-player on another computer.
There are some PIC microcontrollers in this robot, controlling the servos and the ESC, used to control the motor speed. There is a hall-effect sensor in one of the front wheels that measures the speed of the robot. The power to the motor is adjusted by a PID-algorithm and input data from this sensor. This makes the robot run at fairly the same speed on different kinds of surfaces. The Raspberry Pi controls the robot by sending serial data to the microcontrollers using the built-in COM port.
The robot is powered by a large 2-cell 8000mAh LiPo battery. A low drop 5 volt linear regulator is powering the Raspberry Pi and the other electronics. If all systems is switched on simultaneously the rover consumes almost two amps of current. Therefore the regulator is mounted on a large heat sink.
One troublesome thing with this robot is the motor. The problems began when I was developing my third robot, the original motor got overheated and got destroyed. After that I replaced it with a slower motor (55T “crawler type”) with more torque. It worked better. But ArcRover weighs even more and that off course, puts more stress on the motor, so it also got overheated when I was running the robot in some tall grass. Now it is replaced by a new, even slower 100T motor. I have realized that the gearing in this RC car is optimized for very high speeds, which makes it bad at low speeds.
In the beginning I was using a GPS receiver with USB interface (BU-303) connected directly to the Raspberry Pi. It worked, but it was an old GPS running at only 1Hz. It was using a really slow baud rate of 4800bps. This became a problem when I realized that the serial library for Java did not work at that baud rate. I could not find a way to change the baud rate of the GPS, so I decided to replace it.
Now ArcRover uses a SUP500F. It runs at a higher baud rate of 115200bps. This GPS does not have USB, so the Raspberry Pi’s default serial port on the GPIO header is used instead. It can run at 10Hz update frequency, but I have found out that it is much more stable and accurate while running at 2Hz, so that is what I use.
First navigation tests in C++
I started to develop a program for the ArcRover in C++. I came to a point where the rover was able to navigate a track of waypoints. I used Google Earth to make a GPS track. The track was exported as a KML-file, which was converted to a GPX-file. This file was loaded and used by the navigation program in the rover. The ArcRover ran the track just by steering the wheels proportionally to the error between the rovers course and the heading to the waypoint. The program uses the WiringPi library to control the LEDs on the GPIO pins and the serial communication to the PIC processors.
This C++ program is used in the video on the to of this page.
Software development in Java
There are two reasons I prefer to use Java instead of C++. Firstly, it is much easier to set up a network communication between a server (the rover) and a client (a laptop) to send data over the network. Secondly, I like Java more than C++. Java is a more flexible programming language, and I also have more experience of Java than C++. Of course Java also has its flaws. Java runs on a virtual machine, this makes it less suitable for time critical applications. But I do not think that will be a large problem in my application.
To communicate with the rest of the robot’s systems I use the pi4j Library which provides direct access to the GPIO pins and serial communication. This Java library is built upon the WiringPi library.
Manuel remote control using Android application
Even though this rover is designed for autonomous navigation this video shows how it can be controlled over WiFi using a homemade Android app.
The App connects to a server program written in Java running in the rover. When the app is connected the the rover it sends a string of data containing desired rover speed, steering, and power switch state approximately 20 times a second. The server program in the rover receives the data and sends it away to the PIC processors.
The server program can be configured to run on boot up. By doing this there is no need to have a computer to log in to the Raspberry Pi using SSH. Just power on the rover and use to app to drive it.
Possible future development
The ArcRover is far from complete. There are a lot of things I would like to test, and the Raspberry Pi makes the possibility for further development almost endless. A few of the things I want to do is:
- Continue developing the waypoint navigation to make the rover use PID algorithms instead of just proportional steering to drive the track.
- Make the rover steer towards the line between two waypoints instead of just to the next waypoint.
- Develop some kind of program running in a laptop communicating with the rover. I want this program to be able to start an autonomous mission, as well as driving the rover manually.
- Specify an aria in which the rover should drive autonomously.