ros2 run turtlesim turtlesim_node
ros2 run turtlesim turtle_teleop_key
ros2 topic list
/parameter_events
/rosout
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
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
---
ros2 bag record
#ros2 bag record <topic_name>
ros2 bag record /turtle1/cmd_vel
Record multiple topics
#
ros2 bag record -o subset /turtle1/cmd_vel /turtle1/pose
#
ros2 bag info
#ros2 bag info <bag_file_name>
ros2 bag info subset
#
ros2 bag play
#
ros2 bag play subset
Rosbag Read..........ddshoagbtlqk
from rosbags.rosbag2 import Reader
from rosbags.typesys import Stores, get_typestore
# Create a typestore and get the string class.
typestore = get_typestore(Stores.LATEST)
# Create reader instance and open for reading.
with Reader('subset') as reader:
# Topic and msgtype information is available on .connections list.
for connection in reader.connections:
print(connection.topic, connection.msgtype)
# Iterate over messages.
for connection, timestamp, rawdata in reader.messages():
if connection.topic == '/turtle1/cmd_vel':
msg = typestore.deserialize_cdr(rawdata, connection.msgtype)
print(msg.header.frame_id)
# The .messages() method accepts connection filters.
connections = [x for x in reader.connections if x.topic == '/turtle1/cmd_pose']
for connection, timestamp, rawdata in reader.messages(connections=connections):
msg = typestore.deserialize_cdr(rawdata, connection.msgtype)
print(msg.header.frame_id)
'SW > ROS' 카테고리의 다른 글
[Turtlebot3] noetic 동작 (0) | 2024.03.23 |
---|---|
[Docker] Ubuntu22.04 --> Ros1(Noetic) (0) | 2024.03.22 |
[humble] Using turtlesim, ros2, and rqt (0) | 2024.03.19 |
[Humble] Ubuntu22.04 개발환경설정 (0) | 2024.01.15 |
[Foxy] RQt Plugin, turtlebot GUI (0) | 2024.01.14 |