Tutorial: Part 5 – Gumstix on the iRobot Create 2

July 6, 2015 | Jesse Ludtke

In this final instalment of the tutorial, we’ll explore going further with robotics on the iRobot Create 2.

Catch up on any tutorials you’ve missed:

Tutorial 1
Tutorial 2
Tutorial 3
Tutorial 4
Tutorial 5 (You are here)

1 Replacing WLAN with Access Point Mode on Supported Gumstix Computers

Several computers in the Gumstix line up support access point mode. At time of writing, this includes COM’s under the Overo line with names ending in ‘Y’ or ‘P’, and Pepper 43C, 43R. After setting up access point mode on the Overo/Pepper, the host can connect to this the same way you would connect to any wireless network. Adding this feature makes your Create 2 and laptop teleoperation pair unconstrained by your router’s range!

First we’ll prepare the access point on the Overo:

Open up /etc/hostapd.conf on the Overo:

# vim /etc/hostapd.conf

Edit ssid to be your desired access point name. Uncomment and modify wpa_passphrase if you would like your access point to be password protected.

Enable access point mode and reboot:

# systemctl enable hostapd
# sudo reboot

After reboot, check that the access point is up and running, also take note of the new address of the Overo!

# ifconfig
ap0 Link encap:Ethernet HWaddr nn:nn:nn:nn:nn:nn
inet addr:192.168.2.xxx Bcast:192.168.2.abc Mask:

The inet addr under ap0 is your Overo’s address, this is how the host will identify the Overo on the Overo’s network.

Next, connect your host machine to the access point. The network’s name will be what you set ssid to earlier.

Now we want to check the address assigned to the host machine:
(on Host):

$ ifconfig
wlan0 Link encap:Ethernet HWaddr nn:nn:nn:nn:nn:nn
inet addr:192.168.1.yyy Bcast:192.168.1.abc Mask:

The inet addr field under wlan0 is the address assigned to the host by the Overo.

Now lets add the Overo’s address to /etc/hosts on the host machine so we can SSH:

(on Host):

$ sudo vim /etc/hosts

Add the Overo’s address to /etc/hosts:

192.168.2.xxx overo

Next we move to the Overo and add the host address to its /etc/hosts
(on Overo):

# vim /etc/hosts

Add HOSTNAME(name of your host machine) and the overo itself addresses to the file:

192.168.2.yyy HOSTNAME
192.168.2.xxx overo

Finally, modify ros_init.sh to reflect the new host machine address (you can also use HOSTNAME instead of 192.168.2.yyy):

# vim .../ros_init.sh
export ROS_MASTER_URI=http://192.168.2.yyy:11311

That’s it for setup! Next we launch our ROS package on this new network:

(on Host):

$ roslaunch irobotcreate2 unified_launch_kb.launch

Note: You can also use unified_launch_ps3.launch as specified in the previous tutorial in this series.

If all goes well, you should be looking at a video stream and a box to enter commands!

2 Expanding on the irobotcreate2 Package

This tutorial series focused more on ROS package development and deployment than on the individual packages and libraries used. We’ve only scratched the surface of these packages: their features could be utilized further to create much more impressive projects.

2.1 Ps3joy Package

The ps3joy package by Blaise Gassend, Pascale and Melonee Wise was used to connect to a PS3 controller, this driver works with both the Dual Shock 3 and SIXAXIS controllers. This package handles connection with the joystick and modifies the data received so that it looks like a normal joystick in userland.

This package provides access to every feature on the joystick: buttons, sticks, accelerometre, gyroscrope, LED’s, and motors. We only made use of the two sticks to drive the Create 2. Create2_teleop.cpp and instructions.msg can be modified to watch more button states/values. After modifying create2_teleop.cpp, you will need to run catkin_make at the root of your catkin workspace to build the new binaries. You can also send information back to the controller to control the LED’s and vibration motors.

2.2 Create2Class.py Python Class

The Create2Class.py Python class wraps up most of the serial commands available from iRobot’s Open Interface [2] in a user friendly, decently documented Python class. Through this Python class, you get access to: both drive wheels, drive encoders, cliff sensors, bump sensors wall sensors, buttons, and also get battery information. You can also make the Create 2 play different tones and display different characters on the 7-segment displays, as well as light up several LED’s by consulting this guide, and using the sendASCIICommand() function to easily send serial commands to the Create 2.

3 Conclusion

Congratulations for sticking with the tutorial to the end! I encourage you to have a look through Create2Class.py as well as the ps3joy ROS package to improve on this package, but for now we have a pretty decent teleoperated robot with a range limited by the wireless network’s range.

Hopefully this tutorial series has taken some of the guesswork out of getting started with ROS for you. Good luck in your adventures with ROS!