Pi2Go, a Low-Cost Moving Robot
It is great fun to teach robotics in the classroom or learn the basics of robotics at home. It is strongly recommended to use a moving robot, because it is the archetype of many robot applications in the daily life, like self-driving cars, mars mobiles, home cleaning robots, etc. People take as an evidence that robots contain some kind of a computer that provides the "intelligence" of the system. And this computer has to be programmed to achieve this goal, so computer programming and algorithms is considered as the central part of a robot system.
In contrast to other teaching robotic systems, like the Lego NXT or EV3, the Pi2Go robot from 4tronix and TTS distributed world-wide by many local robot shops is a prebuild system with 2 motors and several typical sensors, button(s) and lamps (Leds). Because in contrast to the Lego system, the Raspberry PI (RPi) and not a custom microcontroller system is used, it can easily be expanded via the I2C/SPI bus and the RPi camera port. Moreover, the RPi runs a fully accessible Linux system with a multitude of libraries and applications.
In the previous site you learned how to access the RPi Linux system, so have a look there. For programming Python and Java with the Pi2Go, a special SD card is available at the RaspiBrick site. It contains a preconfigured Linux with many additional Pi2Go oriented libraries and scripts that simplify the programming, especially when the TigerJython IDE is used.
Robot-to-Robot Communication Over TCP/IP
In the previous session you already learned how to use TCP/IP for the communication between the RPi and a program running on a PC. This practice helps you to develop applications to control the Pi2Go remotely. Because the RaspiBrick distribution contains a pre-built TCP socket server (like the EV3 BrickGate), the remote control will not be covered here.
The focus in this chapter is the communication between two robots. As you imagine, there are many interesting applications where several robots exchange data and information, in other words "talk to each other". As demonstration we show a circular course with a pass-by. If you imagine that the robots represents trains, the pass-by could be at the railway station, where one of the trains remains stopped until the other train arrives.
To detect the railway station two flexible strips of white paper wrapped into a transparency cross the track and trigger the front infrared sensor. The left and right line infrared sensors are used to detect the edge of the track. A very simple roadside follower algorithm is implemented as follows: When the white color of the background is detected, the robot moves on a arc back to the black track.
For the client, most of the code remains the same. A common library module could be used to avoid code duplication.