1. run turtlesim
$ ros2 run turtlesim turtlesim_node
$ ros2 run turtlesim turtle_teleop_key
$ rqt_graph
* executable name is not same with real node name
2. node
a single purpose, reusable
$ ros2 run <package_name> <executable_name>
$ ros2 pkg list
and find executable nodes in a package
$ ros2 pkg excutables <package_name>
3. run the same node with different name
$ ros2 run turtlesim turtlesim_node --ros-args --remap __node:=turtle2
or
$ ros2 run turtlesim turtlesim_node __node:=new_turtle
4. node information
$ ros2 node info <node_name>
$ ros2 node info /turtle2
5. Topic
$ ros2 topic list
$ ros2 topic list -t
$ ros2 topic info /turtle1/cmd_vel
topic echo
$ ros2 topic echo /turtle1/cmd_vel
topic bw
$ ros2 topic bw /turtle1/cmd_vel
topic hz
$ ros2 topic hz /turtle1/cmd_vel
6. publish
it is usual that publish code in a source code
but now we'll try by terminal
$ ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
$ ros2 topic pub --rate 1 /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"
7. topic record
$ ros2 bag record /turtle1/cmd_vel
$ ros2 bag info rosbag2_2021_10_06-14_55_49/
$ ros2 bag play rosbag2_2021_10_06-14_55_49/
8. service
$ ros2 run turtlesim turtlesim_node
$ ros2 service list
$ ros2 service list -t
'기계공학부 시절의 기록 > ROS2 Study' 카테고리의 다른 글
8week ROS homework : Simple node code explain (0) | 2021.10.25 |
---|---|
ROS homework week7 (0) | 2021.10.18 |
6 week HW Parameter control using turtlesim node (0) | 2021.10.12 |
ROS2 course week5. homework (0) | 2021.10.06 |
[ROS2 install] VM or dual OS(Ubuntu 20.04) 그리고 ROS2 (0) | 2021.09.13 |
댓글