프로그래밍/ROS
[ROS2] turtlesim 기본 실행
복습
2024. 10. 5. 14:18
728x90
- 터미널 1
$ ros2 run turtlesim turtlesim_node
- 터미널 2
ye2202@ye2202-HP-Laptop-14s-fq0xxx:~$ ros2 run turtlesim turtle_teleop_key
Reading from keyboard
---------------------------
Use arrow keys to move the turtle.
Use G|B|V|C|D|E|R|T keys to rotate to absolute orientations. 'F' to cancel a rotation.
'Q' to quit.
- 터미널 3
ye2202@ye2202-HP-Laptop-14s-fq0xxx:~$ ros2 node list
/rqt_gui_py_node_58206
/turtlesim
ye2202@ye2202-HP-Laptop-14s-fq0xxx:~$ ros2 topic list
/parameter_events
/rosout
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
- 터미널 4
~$ rqt_graph
특정 토픽 확인
~$ ros2 topic echo /turtle1/cmd_vel
위
---
linear:
x: 2.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
---
왼쪽 화살표
---
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 2.0
---
아래
---
linear:
x: -2.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
---
오른쪽 화살표
---
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: -2.0
---
Twist 정보 확인
ye2202@ye2202-HP-Laptop-14s-fq0xxx:~$ ros2 interface show geometry_msgs/msg/Twist
# This expresses velocity in free space broken into its linear and angular parts.
Vector3 linear
float64 x
float64 y
float64 z
Vector3 angular
float64 x
float64 y
float64 z
트위스트 토픽을 직접입력해서 동작시키기
~$ ros2 topic pub --once /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 0.0, y: 2.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}"
publisher: beginning loop
publishing #1: geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.0, y=2.0, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0))
728x90