Graph Resource Names provide a hierarchical naming structure that is used for all resources in a ROS Computation Graph, such as:
- Nodes
- Parameters
- Topics
- Services
There are four types of Graph Resource Names in ROS with the following syntax
- base
- relative/name
- /global/name
- ~private/name
Package Resource Names are used in ROS with Filesystem-Level concepts to simplify the process of referring to files and data types on disk. Examples:
- Message (msg) types. For example, the name "std_msgs/String" refers to the "String" message type in the "std_msgs" Package.
- Service (srv) types
- Node types
Any Graph Resource Names within a node can be remapped when it is launched at the command-line, This lets you launch the same node with multiple configurations from the command-line.
syntax is name:=new_name
This will remap the topic chat to chatter
rosrun tutorials talker chat:=/chatter
remapping so that the new node ends up subscribing to /needed_topic
when it thinks it is subscribing to /different_topic
<remap from="/different_topic" to="/needed_topic"/>
Refs: 1
- __name: name of the node
- __log: designates the location that the node's log file
- __ip: and __hostname: substitutes for
ROS_IP
andROS_HOSTNAME
. - __master: substitute for
ROS_MASTER_URI
. - __ns: substitute for
ROS_NAMESPACE
. TheROS_NAMESPACE
lets you push down a Node into a namespace. All of the names in the Node will be resolved relative to this value, including remapped names.
Example: This let you launch robot1 and robot2 start sedning their message (i.e. their position)
rosrun tutorials talker __ns:=robot1
rosrun tutorials talker __ns:=robot2
rosrun tutorials listener __ns:=robot1
rosrun tutorials listener __ns:=robot2
or you can run a node in a namespace, simply add the ns
attribute to a tag. For example
<node pkg="foo" type="bar" name="my_node" ns="my_namespace" />
Refs: 1
- public: /namespace/topic
ros::NodeHandle nh=ros::NodeHandle();
This will look for your parameter in the global namespace,it will find /my_param
- private: /namespace/node/topic
ros::NodeHandle nh=ros::NodeHandle("~my_private_namespace");
This will look under the nested namespaces of the node itself and will find /namespace/my_node_name/my_param.
- namespaced: /namespace/node/topic
ros::NodeHandle nh=ros::NodeHandle("my_namespace");
- global: /topic
ros::NodeHandle nh=ros::NodeHandle("/my_global_namespace");
Refs: 1
roslaunch tutorials display.launch model:=urdf/01-myfirst.urdf
Refs: 1
rosrun xacro xacro path/to/file.xacro > model.urdf
check_urdf model.urdf
Frames are attached to the links. Every link has an origin located in its center of mass which is called **link origin **. For instance for a cylinder it is in the center of that. Visual, inertia and collision can have offset relative to that. If a link is child of a joint, the **link origin ** is the ** joint origin **. joint origin is its parent link origin.
For instance here we have right_leg
<link name="right_leg">
<visual>
<geometry>
<box size="0.6 0.1 0.2"/>
</geometry>
<origin rpy="0 0 0" xyz="1 0 0"/>
</visual>
</link>
and
<joint name="base_to_right_leg" type="fixed">
<parent link="base_link"/>
<child link="right_leg"/>
<origin rpy="0 0 0" xyz="0 1 1"/>
</joint>
roslaunch tutorials complete_model.launch
Refs: 1
ROS1
rosrun tf static_transform_publisher x y z qx qy qz qw parent_frame child_frame period_in_ms
ROS2
ros2 run tf2_ros static_transform_publisher 1 2 3 0.5 0.1 -1.0 <parent-frame> <child-frame>
Refs: 1
To extract a part of a ROS bag:
rosbag filter example.bag sliced.bag "t.secs >= 1702474496 and t.secs <= 1702474660"
Refs: 1
always call catkin_make in the root of your catkin workspace
cd ~/catkin_ws
catkin_make
The above command will build any packages located in ~/catkin_ws/src. The equivalent commands to do this manually would be:
cd ~/catkin_ws
cd src
catkin_init_workspace
cd ..
mkdir build
cd build
cmake ../src -DCMAKE_INSTALL_PREFIX=../install -DCATKIN_DEVEL_PREFIX=../devel
make
Refs: 1
docker pull osrf/ros:noetic-desktop-full
allow GUI
export containerId=$(docker ps -l -q)
and
xhost +local: docker inspect --format='{{ .Config.Hostname }}' $containerId
then:
docker run -it --privileged \
--env=LOCAL_USER_ID="$(id -u)" \
-v /home/behnam:/home/behnam:rw \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
-e DISPLAY=$DISPLAY \
--network host \
--name=ros1 osrf/ros:noetic-desktop-full