ROS electric

ROS topic의 이해

신영식 2014. 1. 8. 14:45

예제

$ roscore
$ rosrun turtlesim turtlesim_node
$ rosrun turtlesim turtle_teleop_key

1. rostopic

$ rostopic -h
다음과 같은 도움말이 출력

rostopic bw display bandwidth used by topic rostopic echo print messages to screen rostopic hz display publishing rate of topic rostopic list print information about active topics rostopic pub publish data to topic rostopic type print topic type

1) rostopic echo [topic]

$ rostopic echo /turtle1/command_velocity

2) rostopic list [-option]

$ rostopic list -v

3) rostopic type [topic]

$ rostopic type /turtle1/command_velocity

$ rosmsg show turtlesim/Velocity

4) rostopic pub [topic] [msg_type] [args]

사용자가 임의로 데이타를 발행

$ rostopic pub -1 /turtle1/command_velocity turtlesim/Velocity -- 2.0 1.8
$ rostopic pub /turtle1/command_velocity turtlesim/Velocity -r 1 -- 2.0 -1.8(1Hz 단위로 데이타발행 유지)

5) rostopic hz [topic]

데이타 발행 주기 확인

$ rostopic hz /turtle1/pose