ECE434 Project - ROS
Embedded Linux Class by Mark A. Yoder
Team members: Matt Hummel Garrett Hart
I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!
09 Executive Summary 09 Packaging 09 Installation Instructions 09 User Instructions 09 Highlights 09 Theory of Operation 09 Work Breakdown 09 Future Work/Conclusions 09 Hackster.io 09 Demo/Poster 00 Not Late Score: 90/100
The Robot Operating System(ROS) is a large group of open-source software libraries and tools designed for robotic applications. While ROS is called an operting system, it is more accurately described as middleware. ROS includes drivers and algorithms for nearly every possible desired robotics application, including but definitely not limited to:
Network Communication (ros_comm)
Control Systems (ros_control)
Robotic Kinematics (ros_moveit)
Data Structures (ros_msgs)
Data Recording (ros_bag)
Robot Visualization (rviz)
Robot Simulation (gazebo)
Data Visualization (rqt, plot_juggler)
Linear Algebra (eigen)
Geometric Transforms (tf, tf2)
Action Servers (ros_actionlib)
Standardized Launch (ros_launch)
Parameter Server (ros_param)
just to name a very limited selection. Because of it's variety of powerful tools, ROS is used a wide variety of industry applications for intelligent robotics.
The goal of our project is to demonstrate some basic capabilities of ROS on the BeagleBone Black (BBB). While the BBB is not officially a supported platform by ROS, ROS is universal enough to be adapted to most linux-based platforms. For the our purposes, we will be demonstrating motor control over a network and data logging+visualization using ros_comm, ros_log, rqt and ros_bag. We will be using a base operating station(Ubuntu 20.04 machine) with an Xbox gamepad controller as the user interface, while the motor control will be handled by the BBB.
For best use, the PWM outputs of the BBB should be attached to motor controllers to drive a robot. For our demonstration purposes, we used LEDs to show the PWM signals.
The first step in creating a ROS project is installing ROS onto your platform. Unfortunately, ROS does not officially support the BBB and therefore does not have available binaries for installation from a package manager. For this reason, ROS will need to be built from the source code. Instructions to complete this on the debian 10 (buster) installation we used for the BBB can be found at http://wiki.ros.org/noetic/Installation/Source. The version of ROS that will be compatible for compiling on Debian 10 is ros_noetic. Note: compiling ROS took approxiametely 15 hours on the BBB, so plan accordingly.
To set up base station machine, there are binaries available. Using an Ubuntu 20.04 machine, follow the directions at http://wiki.ros.org/noetic/Installation/Ubuntu. The base station can also operate off of Ubuntu 18.04 with ROS Melodic, if preferred.
To configure the ROS network for communication between the base station and the BBB, follow the intructions at http://wiki.ros.org/ROS/Tutorials/MultipleMachines. Specifically, add the following lines to ~/.bashrc:
export ROS_MASTER_URI=http://192.168.7.2:11311 //Note: substitute 192.168.7.2 for "bone" if you have configured your /etc/hosts
export ROS_IP=192.168.7.1 //IP of the base station, the Bone should have 192.168.7.2 in it's bashrc
This way ROS on the base station will recognize the that the overarching management node for ROS, roscore, will be on the BBB and they will be able to link. Next, we will need to add create our workspace and add the project code. Repeat these steps on both the BBB and base station:
$: mkdir -p ~/ros_ws/src
$: cd ~/ros_ws
$: cd src
$: git clone https://github.com/mdhummel076/ECE434Project
$: cd ~/ros_ws
$: source devel/setup.bash //It is recommended to add this line to ~/.bashrc for ease of repeatability
To run the code, first start roscore on the BBB:
$: roscore //it is recommended to start this in a tmux session, and leave it detached
Then in a separate terminal session, start the BBB motor code:
$: rosrun Motors motors.py
Finally, on the base station with the Xbox controller attached, start the Driver's program:
$: rosrun Xbox xbox.py
Now you can control the motors using the Xbox controller on the base station. To simplify this startup process, checkout http://wiki.ros.org/roslaunch
On the BBB, you can view the recorded log files using:
$: roscd log
And finally, you can record and view the joystick data. To view live, on the base station:
$: rostopic echo /commands
Or if you prefer a graphical display,
$: rqt_plot /commands
To record and then play back a bag file:
$: rosbag record -o <bag-name>.bag /commands
$: rosbag play <bag-name>.bag
While there might be easier ways to control a motor over a network and log the data, the real point of this project is to demonstrate that the BeagleBone is capable of implementing all of the powerfull tools in ROS. This means that the BeagleBone could be used in projects of a similar scale as Boston Dynamic's Spot, or Amazon's package delivery robots.
Include a YouTube demo the audio description.
Theory of Operation
The main "core" of ros is the roscore node. This node acts as the center for all other nodes to connect to to integrate together. In this application, the roscore node is running on the BeagleBone.
The other two nodes, the Xbox parser and the motor controlling nodes, run on the base station and the beaglebone respectively. The Xbox parser node reads data from the USB Xbox controller, a publishes the data to the ros topic "commands". The motor controlling node then subscribes to the "commands" topic and reads the data published by the Xbox parser. That data is then used to control the speed a direction of the motors connected to the BeagleBone.
Both nodes are also logging data to their respective log files located at ~/.ros/log.
For the rqt and bag files, data is pulled from the /commands topic. RQT plots the data, while the bag file records the exact time of each published value on the topic. Therefore when the bag is replayed, it is able to repeat the topic's behavior exactly as it was.
1. Installing ROS on the BeagleBone - Matt
2. Installing ROS on the base station - Garrett
3. Configuring ROS - Matt
4. Writing the Xbox software - Matt
5. Writing the Motor software - Matt
6. Wiring the system - Garrett
This project has nearly endless possibilities for continued work, as the ROS platform is immense in scale and capability and growing constantly. One common application of ROS which could be added to this project is to implement an autonomous vehicle with localization sensors and an active map to navigate terrain. For a list of projects that this could be expanded into, check out https://awesomeopensource.com/projects/ros
It is also very common for mobile robotic platforms to communicate wirelessly, since a physical connection becomes a constraint. Because of this, a logical next step for this project would be incorporating a WIFI connection.
Finally, building ROS from source on the bone is a very slow process. Therefore, cross-compiling from the base station onto the BBB would be much more effective and is something we would have explored more if we had more time.
ROS is an extremely powerful tool, and it used fairly universally in the world of robotics. The BeagleBone Black is not an officially supported platform for ROS due to being a 32-bit system, but we have been able to demonstrate that the BeagleBone is capable of running this software platform. This demonstrates that the BeagleBone is also capable of many more complicated tasks like robotic arms and autonomous vehicles.
Embedded Linux Class by Mark A. Yoder