Difference between revisions of "ECE434 Project - ROS"

From eLinux.org
Jump to: navigation, search
m
 
(27 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:ECE497 |PT]]
+
[[Category:ECE434Fall2020 |PC]]
[[Category:ECE434Fall2020 |PT]]
 
 
{{YoderHead}}
 
{{YoderHead}}
  
Line 27: Line 26:
 
== Executive Summary ==
 
== Executive Summary ==
  
Modern cars use a communication protocol known as a Control Area Network bus (CAN bus) to communicate between sensors, actuators and ECUs. Using a CAN bus transceiver, our project is to make a beaglebone display live data about a car while connected over the CAN bus. So far communicating with a car is still a WIP.
+
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:
  
Give two sentences telling what works.
+
Network Communication (ros_comm)
  
Give two sentences telling what isn't working.
+
Control Systems (ros_control)
  
End with a two sentence conclusion.
+
Robotic Kinematics (ros_moveit)
  
The sentence count is approximate and only to give an idea of the expected length.
+
Data Structures (ros_msgs)
 +
 
 +
Logging (ros_logs)
 +
 
 +
Navigation (ros_navigation)
 +
 
 +
Data Recording (ros_bag)
 +
 
 +
Robot Visualization (rviz)
 +
 
 +
Robot Simulation (gazebo)
 +
 
 +
Data Visualization (rqt, plot_juggler)
 +
 
 +
Odometry (ros_odom)
 +
 
 +
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.
  
 
== Packaging ==
 
== Packaging ==
If you have hardware, consider [http://cpprojects.blogspot.com/2013/07/small-build-big-execuition.html Small Build, Big Execuition] for ideas on the final packaging.
+
 
 +
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.
  
 
== Installation Instructions ==
 
== Installation Instructions ==
  
Give step by step instructions on how to install your project.
+
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.
  
* Include your [https://github.com/ github] path as a link like this to the read-only git site: [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn].  
+
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:
* Be sure your README.md is includes an up-to-date and clear description of your project so that someone who comes across you git repository can quickly learn what you did and how they can reproduce it.
+
 
* Include a Makefile for your code if using C.
+
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
* Include any additional packages installed via '''apt'''.  Include '''install.sh''' and '''setup.sh''' files.
+
 
* Include kernel mods.
+
export ROS_IP=192.168.7.1 //IP of the base station, the Bone should have 192.168.7.2 in it's bashrc
* If there is extra hardware needed, include links to where it can be obtained.
+
 
 +
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
 +
 
 +
$: catkin_make
 +
 
 +
$: cd src
 +
 
 +
$: git clone https://github.com/mdhummel076/ECE434Project
 +
 
 +
$: cd ~/ros_ws
 +
 
 +
$: catkin_make
 +
 
 +
$: source devel/setup.bash //It is recommended to add this line to ~/.bashrc for ease of repeatability
  
 
== User Instructions ==
 
== User Instructions ==
  
Once everything is installed, how do you use the program?  Give details here, so if you have a long user manual, link to it here.
+
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:
  
Consider making it autostart for full credit.
+
$: 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
  
 
== Highlights ==
 
== Highlights ==
  
Here is where you brag about what your project can do.
+
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.
 +
 
 +
== 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.
  
Include a [http://www.youtube.com/ YouTube] demo the audio description.
+
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.
  
== Theory of Operation ==
+
Both nodes are also logging data to their respective log files located at ~/.ros/log.
  
Give a high level overview of the structure of your software. Are you using GStreamer?  Show a diagram of the pipeline. Are you running multiple tasks?  Show what they do and how they interact.
+
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.
  
 
== Work Breakdown ==
 
== Work Breakdown ==
  
List the major tasks in your project and who did what.
+
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
  
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.
+
6. Wiring the system - Garrett
  
 
== Future Work ==
 
== Future Work ==
  
Suggest addition things that could be done with this project.
+
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.
  
 
== Conclusions ==
 
== Conclusions ==
  
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.
+
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.  
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 08:25, 30 November 2022

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Matt Hummel Garrett Hart

Grading Template

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

Executive Summary

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)

Logging (ros_logs)

Navigation (ros_navigation)

Data Recording (ros_bag)

Robot Visualization (rviz)

Robot Simulation (gazebo)

Data Visualization (rqt, plot_juggler)

Odometry (ros_odom)

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.

Packaging

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.

Installation Instructions

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

$: catkin_make

$: cd src

$: git clone https://github.com/mdhummel076/ECE434Project

$: cd ~/ros_ws

$: catkin_make

$: source devel/setup.bash //It is recommended to add this line to ~/.bashrc for ease of repeatability

User Instructions

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

Highlights

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.

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.

Work Breakdown

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

Future Work

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.

Conclusions

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.




thumb‎ Embedded Linux Class by Mark A. Yoder