printenv | grep ROS
source /opt/ros/<distro>/setup.bash
(for Bash, don't use sth else like setup.sh
!)
mkdir <path_to>/<workspace_name>/src
cd <path_to>/<workspace_name>/src
catkin_init_workspace
cd <path_to>/<workspace_name>
catkin_make [--source <src_dir>]
(this will create build
and devel
folders)
catkin_make install [--source <src_dir>]
(optional, like make install
)
!!! --source
should be used to specify the source directory if it is not named ./src
.
[i] further reading on CMake&Make and ./configure && make && make install.
source <path_to>/<workspace_name>/devel/setup.bash
(for Bash, don't use sth else like setup.sh
!)
echo $ROS_PACKAGE_PATH
(should include /opt/ros/<distro>/share
and the src
folder of the workspace)
!!! Tab
completion works for its commands.
rospack find <pkg_name>
!!! if fails with [rospack] Error: the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
, run rosdep update
rospack depends1 <pkg_name>
rospack depends <pkg_name>
roscd <pkg_name>[/<sub_dir>]
!!! Will only find ROS packages in ROS_PACKAGE_PATH
, check with echo $ROS_PACKAGE_PATH
.
roscd log
rosls <pkg_name>[/<sub_dir>]
[EDITOR='nano -w'] rosed <pkgname> <filename>
(change environment variable $EDITOR
to specify editor)
rosrun <pkgname> <nodename> [ARGS]
rosrun
can remap names in a node to run it in different ways.
- to change a (topic) name within a node:
rosrun <pkgname> <nodename> <old_name>:=<new_name>
- to change the name of a node:
rosrun <pkgname> <nodename> __name:=<new_nodename>
- to assign value
val
to private parameterparam
of a node:rosrun <pkgname> <nodename> _param:=val
- to change the namespace (from the package name) of a node:
ROS_NAMESPACE=<new_namespace> rosrun <pkgname> <nodename>
cd <path_to>/<workspace_name>/src
catkin_create_pkg <pkg_name> [<depend_pkg_1> <depend_pkg_2> ...]
<description>The xxx package</description>
<maintainer email="user@todo.todo">user</maintainer>
<license>BSD</license>
build tool packages: <buildtool_depend>catkin</buildtool_depend>
packages needed at compile time: <build_depend>std_msgs</build_depend>
packages needed at runtime: <run_depend>python-yaml</run_depend>
packages needed for test: <test_depend>gtest</test_depend>
Build its workspace. See 2.2
See appendix A.
roscore
(blocking initialize Master + rosout + parameter server)
rosnode
offers information and operations on currently running nodes.
rosnode ping [-a / -c count] <nodename>
check if a node is (easily) reachablerosnode list
list active nodesrosnode info <nodename>
print information about noderosnode machine [<machinename>]
list nodes running on a particular machine or list machinesrosnode kill [-a] <nodename>
kill a running noderosnode cleanup
purge registration information of unreachable nodes
rosrun <pkgname> <nodename> [ARGS]
see rosbash
commands
it runs a node within a package by name.
roslaunch <pkg_name> <file.launch>
starts nodes as defined in a launch file: wrapped in <launch></launch>
tag; nodes to be launched are specified by <node pkg="pkg_name" name="given_name" type="real_node_name"></node>
;remapping arguments are specified by <remap from="orignial_arg" to="new_arg" />
within <node>
tag; nodes can be grouped and given a namespace by wrapping <node>
tags within <group ns="namespace"> </group>
.
rostopic
offers information and operations on ROS topics.
rostopic bw
display bandwidth used by topicrostopic delay
display delay of topic from timestamp in headerrostopic echo
print messages to screenrostopic find
find topics by typerostopic hz
display publishing rate of topicrostopic info
print information about active topicrostopic list
list active topicsrostopic pub
publish data to topicrostopic type
print topic or field type
rosmsg
shows information about ROS Message types.
rosmsg show
Show message descriptionrosmsg info
Alias for rosmsg showrosmsg list
List all messagesrosmsg md5
Display message md5sumrosmsg package
List messages in a packagerosmsg packages
List packages that contain messages
rosservice
offers information and operations on ROS services.
rosservice args <servicename>
print service argumentsrosservice call <servicename> [<args>]
call the service with the provided argsrosservice find <srv_type>
find services by service typerosservice info <servicename>
print information about servicerosservice list [-n] [<namespace>]
list active services (with provider nodes / in namespace)rosservice type <servicename>
print service typerosservice uri <servicename>
print service ROSRPC uri
rossrv
shows information about ROS service types.
rossrv show <srv_type>
Show service descriptionrossrv info <srv_type>
Alias for rossrv showrossrv list
List all servicesrossrv md5 <srv_type>
Display service md5sumrossrv package [-s] <pkg_name>
List services in a packagerossrv packages [-s]
List packages that contain services
rosparam
shows and manipulates data on the ROS Parameter Server.
rosparam set [opt] <param> <val>
set parameterrosparam get [opt] <param>
get parameterrosparam load [-v] <filename.yaml> [<namespace>]
load parameters from filerosparam dump [-v] <filename.yaml> [<namespace>]
dump parameters to filerosparam delete [-v] <param>
delete parameterrosparam list [<namespace>]
list parameter names
It visualizes the ROS node graph with topic connections.
rosrun rqt_graph rqt_graph
It plots the evolution of data published to a topic in time.
It displays information about ROS topics.
It displays and filters ROS messages.
It adjusts the logger level of ros nodes. Only superior levels are displayed. (Fatal > Error > Warn > Info > Debug)
msg(srv) file has extension ".msg"(".srv"), are stored in /msg/
(/srv/
) sub-folder of the package and contains 1 list (2 lists seperated by a line of "---") of variables of build-in message types: bool, [u]int[8/16/32/64], float[32/64], string, time, duration, fixed-length array (type[size]) / variable-length array (type[]), Header and other msg files with respective variable names (plus a value for a constant), each taking 1 line: type var_name [= val]
.
- In
package.xml
, add/uncomment<build_depend>message_generation</build_depend>
and<run_depend>message_runtime</run_depend>
. - In
CMakeLists.txt
- add
message_generation
infind_package
list - uncomment/add the
generate_messages
list with linesDEPENDENCIES
,std_msgs
and all other packages dependencies containing.msg
files in use. - add
message_runtime
incatkin_package
list lineCATKIN_DEPENDS
- (for
srv
) uncomment/add theadd_service_files
list withFILES
in the 1st line and continue with allsrv
files of the package. - (for
msg
) uncomment/add theadd_message_files
list withFILES
in the 1st line and continue with allmsg
files of the package.
- add
!!! (re)make the package after this using catkin_make install
roswtf
is a tool for diagnosing issues with a running ROS system. Just run it when in trouble.
http://wiki.ros.org/ROS/Concepts
- node: a process (executable) that performs computation and uses decoupled undirectional streaming topics, client-active blocking remote procedure call services, and the Parameter Server etc. to communicate with other nodes. It is uniquely identified by its name.
- Client Libraries: libraries that let you write ROS nodes, publish and subscribe to topics, write and call services, and use the Parameter Server. Support C++ by
roscpp
, Python byrospy
, Lisp byroslisp
, etc. - topic: named buses over which nodes exchange messages which decouples the production of information from its consumption. It is intended for unidirectional, streaming communication. Strongly typed by the ROS message type msg file.
- service: request / reply interaction between nodes by a pair of messages: one for the request and one for the reply. A providing ROS node offers a service under a string name, and a client calls the service by sending the request message and awaiting the reply. Defined using srv files.
- names:
- Graph Resource Name: ROS-Computation-Graph-level concept provide a hierarchical naming structure (linux-filesystem-like) for all resources in a ROS Computation Graph, such as Nodes, Parameters, Topics, and Services. There are four types of Graph Resource Names in ROS:
- base: direct relative names
node1 -> /pkg/node1
- relative: relative to current package
foo/bar -> /pkg/foo/bar
- global: considered fully resovled
/foo/bar -> /foo/bar
- private: relative to current node
~foo/bar -> /pkg/node/foo/bar
- base: direct relative names
- Package Resource Name: Filesystem-Level concept simplify the process of referring to files and data types on disk. It is name of the Package that the resource is in plus the name of the resource (Package Resource Name = package name + Graph Resource Name).
- Graph Resource Name: ROS-Computation-Graph-level concept provide a hierarchical naming structure (linux-filesystem-like) for all resources in a ROS Computation Graph, such as Nodes, Parameters, Topics, and Services. There are four types of Graph Resource Names in ROS:
- message: C-struct-like data structure containing fields and constants specifying the content for communication between nodes.
- bag: a format for saving and playing back ROS message data from ROS topics.
- msg: messages description language for describing the messages that goes by the topics formatted as a list of data field (type name) descriptions and constant(type name = val) definitions on separate lines. Has commonly a header.
- svc: service description language for describing ROS service types as 2 msg lists seperated by a line of "---"
- master: provides naming and registration services to the rest of the nodes in the ROS system, pointing nodes to desired destinations so that they could then communicate P2P.
- rosout: ROS equivalent of stdout/stderr. Package for system-wide logging mechanism for messages sent to the /rosout topic.
- parameter: global variable with hierachical names and access (dictionary-based).
- parameter server: a global, multi-variate dictionary intended for configuration parameters (not efficient for large data block).
!!! difference between ROS topic/service/actionlib
http://wiki.ros.org/ROS/YAMLCommandLine
1
is an integer, 1.0
is a float, one
is a string, true
is a boolean, [1, 2, 3]
is a list of integers, and {a: b, c: d}
is a dictionary
TODO