The Computation Graph is the P2P network of ROS processes that are processing data together.
The executable units in ROS are called nodes. They are Python scripts or compiled C++ programs that perform some type of computation.
Nodes exchange information through the Computation Graph thanks to the master, which acts similarly to an event dispatcher in a publish-subscribe architecture.
ROS is based on a message-oriented middleware where channels are called topics.
Topics implement the publish-subscribe paradigm and provide no guarantee about the delivery of a sent message.
Topics can be set to have a specific message type.
Services in ROS work like Remote Procedure Calls, which implement the client-server architecture.
Requests and responses in ROS services are implemented synchronously: the client waits for the server to complete the execution and to receive the result back before proceeding.
ROS's parameter server is a shared, multivariable dictionary accessible through the network. Nodes use it to store and retrieve parameters at runtime.
The ROS parameter server is connected to and accessed though the master.
ROS bags are files with the extension .bag
made to store and play back messages. They are ROS's primary mechanism for data logging.
Bags can record anything that is exchanged through the Computation Graph.
roscore
is a collection of nodes and programs that act as the foundations for a ROS-based system. It must be running for ROS nodes to be able to communicate.
roscore
contains:
- A ROS master
- A ROS parameter server
- A logging node called
rosout
Command | Description |
---|---|
roscore |
Starts the main ROS middleware: roscore |
roscd package_name[/subdirectory] |
Change directory within the ROS file system |
rospack command [options] [package] |
Returns information about installed packages |
rosnode command |
Retrieves information about running nodes |
rosrun package_name node_name |
Runs a specific node from a specific package |
rostopic command topic_name |
Gets information about a specific topic |
rosmsg command [message] |
Gets information about messages |
rosservice command |
Calls a service |
rosbag command |
Manages bags |
rqt_graph |
Shows the running nodes and their publications/subscriptions as a graph |
rqt_plot data |
Plots data published by nodes on topics |
Command | Description |
---|---|
catkin_create_pkg package_name [dependencies] |
Creates a new ROS package |
catkin_make |
Recompiles all packages (has to be run in the main Catkin workspace) |
- Run the command
catkin_create_package
in your workspace'ssrc
directory:catkin_create_package package_name [dependency1] [dependency2] [...]
- Create the executables in the
package/src
directory - Create custom message types in the
package/msg
directory - Create custom services in the
package/srv
directory - Add the following lines to your
CMakeLists.txt
depending on what you added to your package:- For every executable:
add_executable(executable_name path/to/executable.cpp) target_link_libraries(executable_name ${catkin_LIBRARIES})
- When adding custom messages:
add_message_files( FILES CustomMessage1.msg CustomMessage2.msg ) generate_messages( DEPENDENCIES std_msgs custom_msg_dependency ) catkin_package( CATKIN_DEPENDS roscpp rospy std_msgs message_runtime ) add_dependencies(executable_name executable_name_generate_messages_cpp)
- When adding custom services:
add_service_files( FILES CustomService1.srv CustomService2.srv )
- For every executable:
- Uncomment the following lines in your
package.xml
file when adding new message types:<build_depend>message_generation</build_depend> <exec_depend>message_runtime</exec_depend>
- Once everything is set up, run
catkin_make
in your catkin workspace to compile the package
In order to dynamically reconfigure parameters, add this functionality to your node by following the tutorial here.
Then, when it's time to change some parameters, run:
rosrun dynamic_reconfigure dynparam set package_name parameter_name parameter_value
You can also make changes via a GUI:
rosrun rqt_reconfigure rqt_reconfigure