ROS1: setting up workspaces
ROS1 is a very useful framework if you have some older microprocessors or you don't want or cannot install a newer version Ubuntu variant of Linux(ROS1 is stable for Debian and Ubuntu version of Linux up to Ubuntu 20.04 only) such as if you are going to purchase nvidea jetson series Linux board which btw has inbuilt gpu, for that you can only install L4T(Linux for Tegra) and it only comes with Ubuntu 18.04, then ROS1 get very handy.
ROS1 service is deprecated for newer versions of Linux i.e 22.04 and it is being replaced by ROS2.ROS2 has so much functionality improvement over ROS1 that it is much more suitable to use for industrial purposes.
Some improvement ROS2 has over ROS1 are:
- They can be much more usable on Windows and mac os as well
- They are not dependent on the “master” system that is if the system which runs ROSMASTER is offline then our ROS can be used.
To learn more about ROS’s framework refer to this article.
However ROS1 still has some advantages over ROS2, like some of the well-used application in ROS hasn't transitioned from ROS1 to ROS2, and even though ROS1 has some bugs which are sometimes irritating, ROS1 is quite stable for Ubuntu.
Before installing you need to have some experience with Linux terminal as almost all the work is done through the Terminal.
If you are understanding what's happening in this image then you are good to continue with this tutorial. if not go through these links
https://ubuntu.com/tutorials/command-line-for-beginners#1-overview
http://www.ee.surrey.ac.uk/Teaching/Unix/
Installing ROS1
Before installing ROS1, understand a bit of its history.
ROS's first release was in 2009 named mango tango or ROS 0.4 and after that developer decided to use an interesting name for its distribution
- Box Turtle, in 2010
- ROS C-Turtle, in 2010
- Diamond Back, in 2011
- ROS Electric Emys, in 2011
- ROS Fuerte Turtle, in 2012
- ROS Groovy Galapagos, in 2012
- ROS Hydro Medusa, in 2013
- ROS Indigo Igloo, in 2014
- ROS Jade Turtle, in 2015
- ROS Kinetic Kame, in 2016
- ROS Lunar Loggerhead, in 2017
- ROS Melodic Morenia, in 2018
- ROS noetic Ninjemys, in 2020
We will continue with ROS melodic as it is available for Ubuntu 18.04(Jetson nano runs on Ubuntu 18.04 plus it has some bugs issues which will be covered here).
To Install ROS melodic
Copy the following and paste it into your terminal
sudo apt install curl # if you haven't already installed curlcurl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt install ros-melodic-desktop-full
Then you have to set up the environment
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrcsource ~/.bashrc
source /opt/ros/melodic/setup.bash
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep initrosdep update
mkdir -p /Documents/”name of your ros workspace”/src
cd /Documents/”name of your ros workspace”
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3
catkin_make
But the above code uses Python2 to compile your Python files instead of Python3. Python has 2 versions python2 and Python3. And there won't be any python4 as a transition from python2 to python3 has some severe compatibility issues where python2 files with python3 syntax might not compile.ROS melodic is also a victim of python2 python3 compatibility issues. Some nodes of need to build using Python3 but by default catkin_make for melodic uses Python2, for the first time, add this line later you won't require
source devel/setup.bashecho "source devel/setup.bash" >> ~/.bashrc
Now you are ready to build your ros projects.
A ros workspace has many files.
Every ros package must contain
- Package.xml
- CMakeList.txt
- Src (or any other folder where you will write scripts)
A package.xml file contains the list of dependencies that catkin will require to build our scripts.
here this package depends on rospy, geometry_msgs, etc (To learn more about package.xml click here)
Similarly, CMakeList should also dependencies on what our project will be needed so that it can be built.
Next src folder, here you have different node scripts, Which will depend on the files and binaries specified in package.xml and CMakeList.txt
Each script is a ROS node.
ROS launch folder launch file. A launch file in ROS helps to execute multiple nodes and even passes on parameters if a node requires any.
And that's what the ros1 workspace looks like.
0 Comments