Introduction
This publication provides instructions for installing and running a robot operating system (ROS) on a mobile robot EduMIP. EduMiP is a self-balancing robot built around a BeagleBone Black with an integrated onboard microprocessor and a Beaglebone Black Robotics Cape, developed by James Strawson and Professor Thomas Bewley in concert with Coordinated Robotics Laboratory at UCSD and their employees. BeagleBone Blue, recently released in mid-2017, combines the functions of BeagleBone Black and Robotics Cape in a single board. Professor Bewley uses this robot in his MAE144 - Embedded Control & Robotics course at the Department of Mechanical and Aerospace Engineering UCSD.
I answer questions in the comments.
Component List
Please note that you need either one Baglebone Blue or each of Beaglebone Black and Robotics Cape.
- Beaglebone Blue (BBBL) : Recently released in mid-2017, combines the features of BeagleBone Black and Robotics Cape in a single-board computer.

- Beaglebone Black (BBB) : low cost, supported by community developers and amateurs, with AM335x with 1 GHz ARM Cortex processor, 512 MB DDR3 RAM, 4 GB 8-bit emmc memory on board.
- Robotics Cape (BBB-RC) : Beaglebone Black Robotics Cape is an I / O card for Beaglebone Black that provides several sensors and rich hardware support, including the following:
- Sensors:
- I / O:
- 4 square encoders
- 4 H-bridge motor drivers
- 8 Servo / ESC Outputs
- Standard DSM RC radio interface
- I2C UART ADC SPI GPIO PWM
- Lithium polymer battery charge controller
- EduMIP Kit : The kit consists of DC motors, gearboxes, encoders, wheels, plastic parts, wires, and fasteners.

- Micro-SD Card : A micro-SD card is at least 8GB in size.
- Ubuntu 16.04 LTS image for BeagleBone Black and Blue : Image provided by Robert Nelson, Jeff O'Brian here . This image contains a Kinetic ROS with a pre-installed ROS, as ros catkin workstation with basic EduMIP ros pre-installed packages. Here are two Ubuntu images, make sure you use the correct image:
- Use this image for BragleBonbne Blue:
2018_02_03_beaglebone_blue_16p04_Ubuntu_LTS_EduMIP_ROS.img.zip - Use this image for BeagleBone Black Wireless + Robotics Cape:
2018_02_03_beaglebone_black_wireless_16p04_Ubuntu_LTS_EduMIP_ROS.img.zip
The 8 GB image is compressed into a 2.5 GB zip file. YOU DO NOT NEED TO UNLESS THE ZIP FILE. The program (Etcher) can unpack it on the fly. - USB joystick : useful for tutorials in the Robot Systems Programming course. A good inexpensive model is the Logitech Gamepad F310
Assembling and testing the EduMIP kit (part of the programming course assignment for Robotic Systems # 3)
Assemble and Test EduMIP as follows. Be careful. Be gentle.
1.
Build EduMIP : Follow the step-by-step instructions for building EduMIP presented
here .
Watch my video on the assembly in Russian:
2.
Some Additional Notes:- Additional documentation is available here.
- If you are using BEAGLEBONE BLACK + ROBOTIC CAPE, DO NOT MISS THE POWER SUPPLY + 5V and + 9V: BBB has a power connector for + 5V. Robotics Cape has an identical ballel power connector for + 9V. Heck!
- Do not plug in the + 9V power supply directly to the + 5V connector on the BBB-result will be a dead BBB.
- Turn off the power when not using the robot: when you are not using EduMIP or charging the battery:
Disconnect the 12V charging cable from the EduMIP
Before transporting the robot Disconnect the battery from the Robotics Cape. - DO NOT damage the connectors of the motor and the ENCODERS: The connectors on the Robotics Cape for encoders and motors are very small.
Configuring Beaglebone Black / Blue and EduMIP (part of the ROS # 3 course assignment)
Configure your Beaglebone Blue for use with EduMIP as follows.
1.
Check your BeagleBone Blue / Black: before building your edumip, test your beaglebone blue — it comes with Debian Jessie installed on its built-in 4GB flash drive.
- Follow the instructions here . To install udev rules on your linux PC. Use this page only to learn how to protect the UDEV rules on your LINUX PC, ignore everything else.
- After you set the appropriate udev rules on your linux computer, it will establish an Ethernet connection to the BBB via a USB connection via the usb0 virtual Ethernet adapter. Your host computer will be at IP address 192.167.7.1, and the BBB will be at 192.168.7.2. SSH from the host computer to the BBB "ssh debian@192.168.7.2". The default password for “debian” is “temppwd”.
- Whenever you finish working with BBBL and are ready to shut it down, don't just turn it off — run the “sudo poweroff” command to turn off Linux and turn off board power. After all the LEDs on the board go out, then it is normal to disconnect the USB cable.
2.
Install and Test the 8GB Ubuntu 16.04 LTS Linux image with ROS and BBBL / EduMIP support on your BBBL : we have created an Ubuntu 8gb image that has ros kinetic and BBBL support. Your EduMIP Kit has a blank 32GB or 64GB Micro SD card.
- Download: a ready-made Ubuntu 16.04 image for ARM support for BBBL and ROS, see the instructions above titled “Ubuntu 16.04 LTS image for beaglebone black and blue”.
- You do not need to unpack the archived image.
- Download Etcher: download and install Etcher on your computer with etcher.io- Etcher is a program for recording disk images on SD cards.
- Write the disk image to the micro-SD card.
- Carefully Install the micro SD card: Install the micro SD card in the micro SD card slot and beaglebone. DO NOT TRANSFER IT, IT PROVIDES ONLY TIME TO GO TO TO INSTALL.
- Download it! Download the BBBL from the Micro-SD card image by connecting it to your computer using a USB cable.
- If the Micro-SD card contains a boot image, then the BBBL will boot from it, and not from its built-in flash disk.
- SSH in BBBL (“ssh ubuntu@192.168.7.2” with the password “temppwd”) and make sure that you are actually working in a 32GB image. The df -h command should show at least 2 GB of free space, and the htop command should show 1 GB of the active paging file.
3.
EduMIP test : check EduMIP by logging in as a “ubuntu” user with the password “temppwd” as follows:
- Error Message Notice : The latest version of the roboticscape library, which is loaded onto the Ubuntu image that we are using, has some PRU support bugs that display the error message “ERROR: pru-rproc driver missing” when invoking the roboticscape library to access the hardware BBBL. We can ignore this warning, it will be fixed in a later release. Expect to see one of these warnings when running programs such as rc_balance, rc_test_encoders, edumip_balance_ros, etc.
Here is an example of this error message:
ubuntu@arm:~$ rc_test_imu ERROR: pru-rproc driver missing try 'test_imu -h' to see other options Accel XYZ(m/s^2) | Gyro XYZ (rad/s) | Mag Field XYZ(uT) | Temp (C) 0.23 -3.06 9.72 | 0.0 -0.0 -0.0 | 22.9 -4.1 -54.9 | 37.9
- Test encoders : execute the “rc_test_encoders” command and turn the wheels slightly - you will see the E2 and E3 encoders showing the change in the number of revolutions.
- Engine Testing : execute the command “rc_test_motors-D 0.1” - when you lift the EduMIP, the two wheels should rotate in opposite directions.
- Gyro Calibration : Place the EduMIP on a table, motionless, and run the "rc_calibrate_gyro" command and follow the instructions. This calibration program writes the gyro calibration to the /var/lib/roboticscape/gyro.cal file.
- Gyro test : execute the “rc_test_imu” command and make sure that the “Gyro XYZ (rad / s)” data is zero (or almost zero).
- Calibrate the Magnetometer : execute the “rc_calibrate_mag” command and follow the instructions - you will be asked to hold the EduMIP in your hand and rotate (“spin”) it in all orientations. This calibration program writes the magnetometer calibration file /var/lib/roboticscape/mag.cal
- Magnetometer test : run the “rc_test_imu” command and make sure that the “Mag Field XYZ (uT)” data is non-zero. The magnitude of the vector of the Earth’s magnetic field in Baltimore and Woods Hole is about 52 uT, but don’t worry yet if your magnetometer seems a bit off.
You can find out the latitude, longitude and magnetic field strength for Baltimore by entering your zip code on this web page . - EduMIP balancing test : Run the “rc_balance” command, and set the robot up. Your robot must balance in place.
4.
ROS test on BBBL- Check the .bashrc file. At the end, the file should have the following commands in the following order:
First, the “source /opt/ros/kinetic/setup.bash” command for setting ROS environment variables.
Second, the command “source ~ / catkin_ws / devel / setup.bash” to add the local catkin workspace to the ROS environment (this is called “worspace overlay”). - Run the "source .bashrc" command to set the ROS environment variables. Check them with the “printenv / grep ROS” command.
- Make sure you can run “roscore” and other ROS utilities.
- Make sure that you can run "catkin_make" in the BBBL ROS workspace.
- Image verified
5.
Update and test ROS EduMip balance program :
- If you have not done so already, calibrate the EduMIP gyro with the "rc_calibrate_gyro" command while the robot is still on the table.
- Log in to EduMIP with the username "ubuntu" and the password "temppwd"
- Configure Wi-Fi on EduMIP: Configure your Wi-Fi so that you can clone ROS packets from our git repository.
- If you installed the pre-installed Ubuntu 16.04 image as described above, then you will already have the packages “edumip_msgs” and “edumip_ros_balance” in the source directory of catkin worskace, i.e. ~ / catkin_ws / src / edumip_msgs, and ~ / catkin_ws / src / edumip_balance_ros. Update the edumip_balance_ros package with “cd ~ / catkin_ws / src / edumip_balance_ros” and “git pull” to download the latest code of this package. If you get the error message "it would be overwritten by merge:
src / edumip_balance_ros.cpp Please, commit your changes or stash them before you can merge. ”, then delete the interfering src / edumip_balance_ros.cpp file, and“ git pull ”again. - If your edumip_msgs and edumip_balance_ros are not yet in the src directory of your EduMIP catkin workspace (it should be ~ / catkin_ws / src ), then clone these two ROS packages into ~ / catkin_ws / src ):
- The edumip_msg package defines a custom message type edumip_msf / EduMipState for EduMIP. This package does not contain the source code, only the definitions of messages and links CMakeLists.txt and package.xml. If your computer needs to access this type of message, you must also clone the project to your computer. This package is architecture independent. This package can be git cloned from this public URL .
- The edumip_balance_ros package contains the edumip_ros_node C ++ ROS.cpp node, which is the ROS-ified version of the rc_balance program. In the linux image that we have provided you, the drivers Robotics Cape and ROS are already installed. This package can be git cloned from this public URL .
- Create these two packages using the “catkin_make” command in the main catkin workspace directory.
- Check that ROS is now aware of user messages defined in the edumip_msgs package with the command: rosmsg show edumip_msgs / EduMipState
- Open two remote ssh sessions on EduMIP:
First, in the first shell, run “roslaunch edumip_balance_ros edumip_balance_ros”
Secondly, in the second shell, see topics ros and output topics / edumip / state.
Put your robot, it must balance.
6.
Turn off the BBBL correctly : when you are finished and ready to turn off the BBBL, do not just turn it off - execute the “sudo poweroff” command to turn off Linux and turn off the power to the board. After all the LEDs on the board go out, you can disconnect the USB cable.
Some useful Linux notes for BBB and BBBL
- The emacs and nano editors are already installed on the BBB linux image provided for this tutorial.
- The linux utility “locate” is not installed by default, but you can install it with “sudo apt-get install locate” and initialize the locate database with the command “sudo updatedb” (takes a few minutes).
- The NTP time server is installed on the BBB linux image provided for this lesson, but it will only be synchronized if the BBB has a route to the Internet, for example, when your WIFi is on. Network USB connection to the computer by default is not routed to the Internet. You can check the status of ntp using the "ntpq-p" command.
Notes on setting up BeagleBone Black (BBB) and beaglebone Blue (BBBL) with Ununtu 16.04 and ROS
(They are listed here for reference only and should not be mandatory steps to complete task 3).
Connect your PC to BBB via USB- Follow the instructions here.
- After you install the appropriate udev drivers or rules on the host computer, it will establish an Ethernet connection to the BBB via the USB connection through the usb0 virtual Ethernet adapter. Your host computer will be by IP address 192.167.7.1, and the BBB will be 192.168.7.2. SSH from the host computer to the BBB "ssh ubuntu@192.168.7.2". The default password for “ubuntu” is “temppwd”.
How to establish an Ethernet connection with DNS and route to the external InternetWiFi (BBBL, BBB Wireless, BBB Classic + USB WiFi Adapter):
- WiFi in a flash : follow the instructions for the connmanctl listed in the comments to the / etc / network / interfaces file. To read comments, use the cat / etc / network / interfaces command.
- Note : The connmanctl utility does not support corporate networks such as hopkins, but it does support the WPA / WPA2 network.
- Note : When downloading the BBBL WiFi adapter is not always correct. If you do not see “wlan0” in the output of the ifconfig command, try manually turning on BBBL as wlan0 interfce with the command “ifconfig wlan0 up”. Then you should see wlan0 in the output of the ifconfig command.
- Ifconfig : Use the “ifconfig” command to see all configured network interfaces (LAN, WiFi, USB, etc.) on your machine.
- Iwconfig : Use the “iwconfig” command to see all configured WiFi network interfaces on your computer.
- Who am i? The easiest way to determine the IP address (or addresses) of a Linux machine is to enter it and use the “ifconfig” command.
- Wifi Groundhog Day! Unfortunately, BBBL currently does not remember WiFi settings.
The preferred WiFi connection should be both BBBL and your computer is connected to a single Wi-Fi access point, so you can log in via ssh to BBBL from your computer, and your BBBL has Internet access to git repos, etc.
In addition, you can directly connect to the BBBL using it as a Wi-Fi access point by connecting the computer to the BeagleBone-XXXX Wi-Fi network, where XXXX is unique to your BBBL. The WiFi password is “BeagleBone". This is a simple connection, but in this configuration neither your BBBL nor your computer will have access to the Internet to git repos, etc. After connecting, your computer will have an IP address of 192.168.. The BBBL IP address will be 192.168.XXX.1
Updating your BBBL Ubuntu DistributionOn the BBB, run the Linux command “sudo apt update” and “sudo apt dist-upgrade”
Installing Robotics Cape software on BBBL- Robotics Cape / BBBL support is already available on the pre-configured Ubuntu image for BBBL described above, you do not need to reinstall it.
- Binary installation under Ubuntu 16.04 on ARM: "sudo apt-get install roboticscape"
- Installation from source
You want to install a copy of the source code of the robotics cape and code samples on your BBB. It is available
here . Installing a copy in the home directory:
"Cd ~"
"Git clone
github.com/StrawsonDesign/Robotics_Cape_Installer.git "
Now you can view the source code of the robotics cape and follow the instructions for compiling and installing the robotics cape library and sample programs.
Installing Basic ROS Packages for EduMIPClone these two git repos into your ~ / catkin_ws / src directory:
cd to ~ / catkin_ws and compile catkin_make packages.
To run the edumip_balance_ros node, the program requires root privileges. Perhaps the easiest way to do this is to change the permissions and ownership of the compiled binary file using these two commands (in this order) after you have compiled it:
- sudo chown root: root ~ / catkin_ws / devel / lib / edumip_balance_ros
- sudo chmod u + s ~ / catkin_ws / devel / lib / edumip_balance_ros
Launch ROS node edumip_balance_ros "
roslaunch edumip_balance_ros edumip_balance_ros.launch ". The robot will balance, receive messages twist velocity of the command topic / edumip / cmd and publish its state in the ROS topic topic / edumip / state
If you cannot find the
edumip_balance_ros.launch startup
file in the ~ / catkin_ws / src / edumip_balance_ros / launch directory, then you need to "git pull" the latest version of this package, as indicated above, and recompile the source with "catkin_make".
See the 3rd week assignment on this course webpage for more information on using these ROS backages: Robot Systems Programming Week 3 Assignment
Notes on running EduMIP with ROS
Why do I get permission errors when starting edumip_balance_ros and how can I fix this?Read this if you get errors like “can't open:
/ sys / devices / platform / ocp / ocp: H18_pinmux / state
Pinmux: Permission denied ”when running edumip_balance_ros.
When compiling the edumip_balance_ros project on edumip with catkin_make, compile the executable file:
"~ / catkin_ws / devel / lib / edumip_balance_ros / edumip_balance_ros"
ubuntu @ arm: ~ / catkin_ws $ ls -l devel / lib / edumip_balance_ros /
total 272
-rwxrwxr-x 1 ubuntu ubuntu 278292 Feb 18 18:48 edumip_balance_ros
Note that the owner and group of the file are ubuntu: ubuntu, and that it is executable ("-rwxrwxr-x").
When you try to run this newly compiled file, you will get permission errors, as shown below:ubuntu @ arm: ~ / catkin_ws $ roslaunch edumip_balance_ros edumip_balance_ros.launch
… Logging to /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/roslaunch-arm-2845.log
Checking the log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server 192.168.10.102 : 37365 /
SUMMARY
========
PARAMETERS
* / rosdistro: kinetic
* / rosversion: 1.12.12
NODES
/
edumip_balance_ros_node (edumip_balance_ros / edumip_balance_ros)
ROS_MASTER_URI = http: //192.168.10.101: 11311
process [edumip_balance_ros_node-1]: started with pid [2874]
[INFO] [1518979862.674565427]: File /home/ubuntu/catkin_ws/src/edumip_balance_ros/src/edumip_balance_ros.cpp compiled on Feb 3 2018 19:38:02.
can't open: / sys / devices / platform / ocp / ocp: H18_pinmux / state
Pinmux: Permission denied
can't open: / sys / devices / platform / ocp / ocp: C18_pinmux / state
Pinmux: Permission denied
can't open: / sys / devices / platform / ocp / ocp: U16_pinmux / state
Pinmux: Permission denied
can't open: / sys / devices / platform / ocp / ocp: D13_pinmux / state
Pinmux: Permission denied
can't open: / sys / devices / platform / ocp / ocp: J15_pinmux / state
Pinmux: Permission denied
can't open: / sys / devices / platform / ocp / ocp: H17_pinmux / state
Pinmux: Permission denied
WARNING: missing PINMUX driver
You probbaly just need a newer kernel
Unable to open / dev / mem
mmap_gpio_adc.c failed to initialize gpio
[INFO] [1518979862.806645002]: ERROR: failed to initialize cape.
[edumip_balance_ros_node-1] process has died [pid 2874, exit code 255, cmd / home / ubuntu / catkin_ws / devel / lib / edumip_balance_ros / edumip_balance_ros __name: = edumip_balance_ros_node __log: = / home / ubunt / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / bu / / / / / / / / / / / / / / / / / / / / / / / / /. 14dc-11e8-b293-dc5360d671c6 / edumip_balance_ros_node-1.log].
log file: /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/edumip_balance_ros_node-1*.log
roslaunch will exit
shutting down processing monitor ...
... shutting down processing monitor complete
done
The problem here is that your executable file should work as “root”, and not as a normal user, in order to gain access to the hardware registers of BeagleBone.
After compiling edumip_ros_balance, you can change the permissions of the executable file owned by root (sudo chown root: root <filename>) and set it to sticky bit (sudo chmod u + s <filename>) by running the following script:
"~ / catkin_ws / src / edumip_balance_ros / scripts / edumip_change_perms.sh"
If you look at this shell script, you will see that it executes these two commands:
sudo chown root: root ~ / catkin_ws / devel / lib / edumip_balance_ros / edumip_balance_ros
sudo chmod u + s ~ / catkin_ws / devel / lib / edumip_balance_ros / edumip_balance_ros
After running this script (it will ask you for a sudo password) the access rights and groups of the executable file will be changed from ubuntu: ubuntu to root: root, and its sticky bit will be set (the permissions were previously "- rwxrwxr-x" and become "- rwsrwxr -x "):
ubuntu @ arm: ~ / catkin_ws $ ls -l devel / lib / edumip_balance_ros /
total 272
-rwsrwxr-x 1 root root 278292 Feb 18 18:48 edumip_balance_ros
Now when you start edumip_balance_ros, it should work fine, as shown below:
ubuntu @ arm: ~ $ roslaunch edumip_balance_ros edumip_balance_ros.launchubuntu @ arm: ~ $ roslaunch edumip_balance_ros edumip_balance_ros.launch
… Logging to /home/ubuntu/.ros/log/a271dd92-14dc-11e8-b293-dc5360d671c6/roslaunch-arm-2099.log
Checking the log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server 192.168.10.102 : 34253 /
SUMMARY
========
PARAMETERS
* / rosdistro: kinetic
* / rosversion: 1.12.12
NODES
/
edumip_balance_ros_node (edumip_balance_ros / edumip_balance_ros)
ROS_MASTER_URI = http: //192.168.10.101: 11311
process [edumip_balance_ros_node-1]: started with pid [2108]
[INFO] [1518981653.978399507]: File /home/ubuntu/catkin_ws/src/edumip_balance_ros/src/edumip_balance_ros.cpp compiled on Feb 3 2018 19:38:02.
ERROR: pru-rproc driver missing
[INFO] [1518981654.104574860]: Inner Loop controller D1:
order: 2
timestep dt: 0.0100
-4.9450z² + 8.8620z + -3.9670
- 1.0000z² + -1.4810z + 0.4812
[INFO] [1518981654.107474727]:
Outer Loop controller D2:
order: 2
timestep dt: 0.0100
0.1886z² + -0.3721z + 0.1835
- 1.0000z² + -1.8605z + 0.8605
[INFO] [1518981654.573431369]:
Hold your MIP upright to begin balancing
ROS cannot find my ROS packageIf your ROS environment does not understand that you have new packages in catkin_ws / src, then try updating your rospack profile with the “rospack profile” command, and update the rosdep cache with the “rosdep update” command.
Compiling and linking to the Robotics Cape "C" librariesThe Robotics Cape library comes pre-installed on Ubuntu 16.04, available from the link provided earlier on this page. It was installed using the sudo apt-get install roboticscape command.
The robotics cape library and its associated header files are already installed on EduMIP. Link to the libraries /usr/lib/libroboticscape.so, and two top-level header files rc_usefulincludes.h and roboticscape.h.
You can refer to the
edumip_balance_ros project to learn how to use robotics cape C header files and a C reference library with a C ++ ROS node.
See edumip_balance_ros / src / edumip_balance_ros.cpp to see how to include C header files in a C ++ program with extern "C" directive.
See edumip_balance_ros / CMakeLists.txt to learn how to link your program with the roboticscape C library.
Edumip_balance_ros Package- To compile the edumip_balance_ros package, you must also install the edumip_msgs package.
- The edumip_balance_ros package will not compile on your computer, it is only for compiling on EduMIP.
Horizontal EduMIP ConfigurationSeveral student teams used the EduMIP in a horizontal configuration with a caster wheel.
To do this, you will need to replace the “edumip_balance_ros” project with your own new code for controlling wheel motors, as well as for reading and publishing wheel encoders. And yesterday I reviewed one of the possible packages in class, you can use the differential_drive ROS package (http://wiki.ros.org/differential_drive). To use the differential_drive package, you need to write a new C ++ node for edumip, which (a) reads the wheel encoders and publishes them by topic, and (b) subscribes to the topics of engine commands and voltage commands for wheel motors.


Interaction with Serial Port Devices (Serial Port Devices)In order to interact with the sensors via a serial port, such as a USB ultrasound sensor demonstrated in class, you will need to be able to open, read, and send through serial ports.



A good package for this
ROS serial package . You can install it "sudo apt-get install ros-kinetic-serial".
A simple example is
here.A copy of src can be cloned into the ROS workspace using the “git clone
github.com/wjwwood/serial.git ” command and compiling it using “catkin_make”. The “examples” directory contains more complex examples of using the serial port with the “serial” package.
Please note that this ros package with the name “serial” is not a “rosserial” package. "Serial" package is a lightweight general-purpose library for reading and sending data on serial ports. "Rosserial" is a package for interfacing small devices, such as the Arduino, as nodes grew.
Addition from the translator:I added my photos and videos to the article, as well as photos of students' works. In general, all you need to do is to run this instruction, it is advisable to have at least minimal experience in the linux command line and a basic understanding of the ROS architecture. The scripts of the robot are written in C.
You can ask questions in the comments, I read and answer.