What the hell is ROS?
ROS stands for Robot Operating System. It is a set of tools and libraries (frameworks) to help create robotic systems. At the very basic level, ROS allows you to create nodes (different modules of your robot) that communicate with each other in a very modular way (and gives you tools to monitor the communication).
- Learning from our past mistakes (avoid reinventing the wheel).
- Utilize all the tools (for monitoring and debugging).
- Use already-existing libraries instead of creating them from scratch.
- Fastest way to get a robot up and running.
Here are instructions for beginners:
- Install Ubuntu 14.04 on your laptop (you may use a virtual machine if you really want to). Get familiar with using the Bash terminal (a quick search for Bash tutorial brings up this). I recommend you go over this if you're not comfortable with using the terminal.
- Install ROS Indigo by following instructions here.
- Go over these tutorials in this order: #1, #2, #3, #4, #5, #7, #9, #11, #13, #15, #16, and then the rest.
How to set up a ROS system
What you need to do:
- Install ROS Indigo (The distribution (distro) we use).
- Clone the repo on your machine (to get a local copy).
- Source the setup.bash file for your particular ROS installation (usually in
- Now you can go into the catkin workspace folder of your repo (usually
catkin_ws), then run
catkin_maketo build the packages (will be stored in build and devel folders).
- Source the the setup.sh file in your devel folder in order to access the packages in the repo (assuming you built them by running catkin_make).
- Now you can run your packages and do stuff to them.
Note: You can paste the source commands into your ~/.bashrc file if you want to avoid typing in the source commands in every terminal you ever open...
Yet another note: when creating new packages, make sure to include the package.xml and CMakeLists.txt files. Check out this article for Using CMake.
Switching ROS distros
If you decide to switch to another ROS distro, then just source its setup.bash instead of the old one. Now delete your old devel and build folders and then run catkin_make again. Run the following command to check whether your system has actually switched distros (read the name of the distro in the response): `export | grep ROS`
C++ and Python
With ROS, you can write nodes in either C++ or Python (and they automatically work together). Since most of our code relies on C++ libraries (such as SerialPort), most of our nodes will be written in C++. Read the article on C++ Tips. Some nodes may be written in Python for prototyping (if possible and if they make life easier).
Useful ROS Tricks
- When running a ROS node using `rosrun`, you can remap arguments or assign parameters as shown here.
- Make sure your package is set up right, and that your message files are being generated properly (very common kind of build error).
Notes & Hints (useful things we learned along the way)
- The documentation might seem to be a bit shotty and sparse sometimes. That's ok, try the QA website or ask more experienced members.
- Remember, there's a few books out there for ROS; make sure you read them whenever you get bogged down on a problem!
- Give yourself a pat on the back; this is pretty hardcore stuff, so it's normal to feel frustrated and challenged.
- Most importantly, plan and design your code WAAAY before you actually START writing the code. First, make a sketch with pencil and paper. Then, try to fill it in with higher-level pseudo-code. Afterwards, write a comment block for each function (with proper documentation standards) explaining (in plain English) what it takes as parameters, what it does, and what it returns. 95% of the bug-catching and head-scratching will be done by now (automatically). Finally, fill in your beautiful comment blocks with actual code and run tests.
List of Readings
- ROS Powerpoints
- ROS Where Next?
- Tutorials for Navigation stack in ROS (has literally all tutorials for navigation in ROS)
- Dr. Hessmer's Navigation Tutorial
- EKF ROS (does extended Kalman Filter for robot position input. There's tons of more stuff like that in ROS Navigation stack)
- TF Tutorials in ROS
- PID Controller Wikipedia
- List of ROS APIs
- Gazebo Tutorials
- Courses taught using ROS
- ROS Start Guide (has Concepts pages)
- ROS Tools page
- Kalman Filter StackExchange
- ROS Cheat Sheet
- 5-day Course on ROS
- Catkin intro