Source: this legend
In order to learn ROS, you need to know in advance how to program in C++
or Python
. Also, you need to be comfortable using the Linux shell.
In order to run ROS nodes, you need to type roscore
into one of the terminals. Prior to that, you should make sure that you sourced these two directories in ~/.bashrc in order to make sure you can use your code with ROS functionalities:

If you want to develop such nodes, ROS works on a subscriber/publisher basis ros_architecture. Everything takes place in the catkin_ws
directory.
catkin_ws directory
In order to create a ROS package, we need to call in catkins_ws/src:
catkin_create_pkg package_name rospy[or roscpp] ros_packages
for example:
catkin_create_pkg my_robot_controller rospy turtlesim
which will return:![]()
If we want to add other packages later, we can simply add them in package.xml. To run, we would need to type in another terminal
rosrun my_robot_controller script.py
In order to build the new ROS package we just created, we call
catkin_make
inside /catkin_ws Also, in order to run the node throughrosrun
, you need to make the script executable withchmod +x script.py
Also, for the script to work, it needs to have#!/usr/bin/env python3
as first line in order to know the interpreter
ROS useful commands
Question
rosnode list
shows all active nodesrosnode kill node_name
kills any active noderqt_graph
opens up a GUI that shows the relationships between active nodes.rostopic info /node_name
gives details about the type, publishers and subscribers.![]()
rosmsg show
![]()
rostopic echo
gives real-time data of a topic