< >
Home » Turtlebot4入门教程 » Turtlebot4入门教程-通过ROS2话题信息查看底盘传感器状态

Turtlebot4入门教程-通过ROS2话题信息查看底盘传感器状态

文章说明

  • 本教程主要介绍如何通过ROS2话题信息查看底盘传感器状态

测试环境

  • Create® 3 固件版本:H.2.6 (Humble)

操作步骤

查看所有话题
$ ros2 topic list
/battery_state
/cliff_intensity
/cmd_audio
/cmd_lightring
/cmd_vel
/dock_status
/hazard_detection
/imu
/interface_buttons
/ir_intensity
/ir_opcode
/kidnap_status
/mobility_monitor/transition_event
/mouse
/odom
/parameter_events
/robot_state/transition_event
/rosout
/slip_status
/static_transform/transition_event
/stop_status
/tf
/tf_static
/wheel_status
/wheel_ticks
/wheel_vels
/battery_state:电池状态
  • 机器人电池的状态信息,包括电压、电量百分比等
$ ros2 topic echo /battery_state
header:
  stamp:
    sec: 1724914453
    nanosec: 1924718
  frame_id: ''
voltage: 16.222000122070312
temperature: 35.54999923706055
current: -0.07999999821186066
charge: 1.9950000047683716
capacity: 1.9950000047683716
design_capacity: 1.9950000047683716
percentage: 1.0
power_supply_status: 0
power_supply_health: 0
power_supply_technology: 0
present: true
cell_voltage: []
cell_temperature: []
location: ''
serial_number: ''
---
/cliff_intensity: 悬崖传感器
  • 用于检测机器人是否接近悬崖或台阶
  • 4个悬崖传感器,放在地面的数值约为2200,离地面50cm时约为2170
$ ros2 topic echo /cliff_intensity
header:
  stamp:
    sec: 1724914555
    nanosec: 37836372
  frame_id: base_link
readings:
- header:
    stamp:
      sec: 1724914555
      nanosec: 37836372
    frame_id: cliff_side_left
  value: 2229
- header:
    stamp:
      sec: 1724914555
      nanosec: 37836372
    frame_id: cliff_front_left
  value: 2208
- header:
    stamp:
      sec: 1724914555
      nanosec: 37836372
    frame_id: cliff_front_right
  value: 2199
- header:
    stamp:
      sec: 1724914555
      nanosec: 37836372
    frame_id: cliff_side_right
  value: 2205
/cmd_audio: 底盘的扬声器状态
  • 使用话题让底盘扬声器播放指定的音符
/cmd_lightring:底盘灯环颜色的状态
  • 使用话题改变底盘灯环颜色
/cmd_vel:底盘运动控制的话题
/dock_status:充电桩对接状态
# 未充电状态
$ ros2 topic echo /dock_status
header:
  stamp:
    sec: 1724916675
    nanosec: 204302853
  frame_id: ''
dock_visible: true
is_docked: false
---

# 处于充电状态
$ ros2 topic echo /dock_status
header:
  stamp:
    sec: 1724916719
    nanosec: 205365805
  frame_id: ''
dock_visible: false
is_docked: true
---
/hazard_detection:碰撞传感器
  • 底盘前侧保险杠中的3个碰撞传感器。当底盘前侧碰到障碍时,话题会获取到相应的反馈数据
$ ros2 topic echo /hazard_detection
header:
  stamp:
    sec: 1724917655
    nanosec: 302413073
  frame_id: base_link
detections: []
---
header:
  stamp:
    sec: 1724917658
    nanosec: 917658288
  frame_id: base_link
detections:
- header:
    stamp:
      sec: 1724917658
      nanosec: 917658288
    frame_id: bump_right
  type: 1
---
header:
  stamp:
    sec: 1724917659
    nanosec: 397716633
  frame_id: base_link
detections: []
---
header:
  stamp:
    sec: 1724917667
    nanosec: 879995450
  frame_id: base_link
detections:
- header:
    stamp:
      sec: 1724917667
      nanosec: 879995450
    frame_id: bump_right
  type: 1
---
header:
  stamp:
    sec: 1724917667
    nanosec: 958128232
  frame_id: base_link
detections:
- header:
    stamp:
      sec: 1724917667
      nanosec: 958128232
    frame_id: bump_front_right
  type: 1
---
header:
  stamp:
    sec: 1724917668
    nanosec: 262019880
  frame_id: base_link
detections: []
---
header:
  stamp:
    sec: 1724917671
    nanosec: 622224805
  frame_id: base_link
detections:
- header:
    stamp:
      sec: 1724917671
      nanosec: 622224805
    frame_id: bump_left
  type: 1
---
header:
  stamp:
    sec: 1724917671
    nanosec: 894222958
  frame_id: base_link
detections: []
---
header:
  stamp:
    sec: 1724917674
    nanosec: 822549571
  frame_id: base_link
detections:
- header:
    stamp:
      sec: 1724917674
      nanosec: 822549571
    frame_id: bump_front_center
  type: 1
---
header:
  stamp:
    sec: 1724917675
    nanosec: 302475991
  frame_id: base_link
detections: []
---
/imu:惯性测量单元(IMU)数据
  • 惯性测量单元(IMU)数据,包括加速度和角速度,帮助机器人了解自身的姿态和运动状态
$ ros2 topic echo /imu
header:
  stamp:
    sec: 1724916238
    nanosec: 812918184
  frame_id: imu
orientation:
  x: 0.0035070981830358505
  y: -0.010525263845920563
  z: -0.0252175685018301
  w: 0.9996204376220703
orientation_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
angular_velocity:
  x: -1.2956194689469766e-05
  y: 5.3758141490533966e-05
  z: 3.881697209610013e-05
angular_velocity_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
linear_acceleration:
  x: 0.008076131343841553
  y: -0.022648990154266357
  z: 0.010005950927734375
linear_acceleration_covariance:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
---
/interface_buttons:Create® 机器人面板上 3 个接口按钮的状态
/ir_intensity:红外传感器
  • 底盘有七个红外传感器
$ ros2 topic echo /ir_intensity
header:
  stamp:
    sec: 1724916888
    nanosec: 299236787
  frame_id: base_link
readings:
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_side_left
  value: 0
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_left
  value: 7
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_front_left
  value: 5
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_front_center_left
  value: 57
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_front_center_right
  value: 2
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_front_right
  value: 7
- header:
    stamp:
      sec: 1724916888
      nanosec: 299236787
    frame_id: ir_intensity_right
  value: 1
---
/ir_opcode:机器人红外接收器检测到的操作码
  • 用于检测充电桩或者虚拟墙
/kidnap_status:绑架状态
  • 绑架状态是指,底盘被抬起,然后放在某处
# 正常状态
$ ros2 topic echo /kidnap_status
header:
  stamp:
    sec: 1724918163
    nanosec: 222615628
  frame_id: base_link
is_kidnapped: false

# 处于绑架状态,底盘被抬起
$ ros2 topic echo /kidnap_status
header:
  stamp:
    sec: 1724918439
    nanosec: 677696577
  frame_id: base_link
is_kidnapped: true
---
/mobility_monitor/transition_event:ROS标准话题
  • 通常用于发布与移动性监控(Mobility Monitor)相关的状态转换事件
/mouse:鼠标传感器
$ ros2 topic echo /mouse
header:
  stamp:
    sec: 1724922103
    nanosec: 947337875
  frame_id: mouse
integrated_x: 0.08332686871290207
integrated_y: 0.0390031561255455
frame_id: 76533
last_squal: 70
---
/odom:里程计数据
  • 里程计数据,提供机器人的位置和速度信息,用于导航和定位
$ ros2 topic echo /odom
header:
  stamp:
    sec: 1724916540
    nanosec: 454907416
  frame_id: odom
child_frame_id: base_link
pose:
  pose:
    position:
      x: -0.03215104714035988
      y: -0.04175001010298729
      z: -0.0007962860399857163
    orientation:
      x: 0.0036242797505110502
      y: -0.01050490327179432
      z: -0.02236960642039776
      w: 0.9996879696846008
  covariance:
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
twist:
  twist:
    linear:
      x: 0.0
      y: 0.0
      z: 0.0
    angular:
      x: 0.0
      y: 9.130597611317626e-09
      z: 0.0
  covariance:
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
  - 0.0
---
/parameter_events: ROS标准话题
  • 用于发布关于参数的变化事件
/robot_state/transition_event:ROS标准话题
  • 用于发布与机器人状态机(State Machine)相关的状态转换事件
/rosout:ROS标准话题
  • 所有通过 ROS 日志系统生成的消息都会被发布到这个话题上
/stop_status:停止状态
  • 检测机器人当前处于是否停止状态
# 底盘处于静止状态
$ ros2 topic echo /stop_status
header:
  stamp:
    sec: 1724919424
    nanosec: 243045247
  frame_id: base_link
is_stopped: true
---

# 底盘处以用手推动状态
$ ros2 topic echo /stop_status
header:
  stamp:
    sec: 1724919613
    nanosec: 246352087
  frame_id: base_link
is_stopped: true
---
/tf:坐标变换话题
$ ros2 topic echo /tf
transforms:
- header:
    stamp:
      sec: 1724920090
      nanosec: 369943014
    frame_id: odom
  child_frame_id: base_link
  transform:
    translation:
      x: -0.012280297465622425
      y: -0.030369525775313377
      z: -0.0006430541398003697
    rotation:
      x: -0.00041037972550839186
      y: -0.003118420485407114
      z: 0.36504942178726196
      w: 0.9309828281402588
- header:
    stamp:
      sec: 1724920090
      nanosec: 369943014
    frame_id: odom
  child_frame_id: base_footprint
  transform:
    translation:
      x: -0.012073596394088781
      y: -0.030370580504683886
      z: 0.0
    rotation:
      x: 0.0
      y: 0.0
      z: 0.365055114030838
      w: 0.9309859275817871
---
/tf_static:静态坐标变换
  • 用于描述机器人各个传感器和部件之间的相对位置
$ ros2 topic echo /tf_static
transforms:
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: cliff_side_left
  transform:
    translation:
      x: 0.069723941385746
      y: 0.1605103462934494
      z: 0.028999999165534973
    rotation:
      x: 0.0
      y: 0.7071067966408575
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: cliff_front_left
  transform:
    translation:
      x: 0.1694290190935135
      y: 0.04380417615175247
      z: 0.028999999165534973
    rotation:
      x: 0.0
      y: 0.7071067966408575
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: cliff_front_right
  transform:
    translation:
      x: 0.1694290190935135
      y: -0.04380417615175247
      z: 0.028999999165534973
    rotation:
      x: 0.0
      y: 0.7071067966408575
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: cliff_side_right
  transform:
    translation:
      x: 0.069723941385746
      y: -0.1605103462934494
      z: 0.028999999165534973
    rotation:
      x: 0.0
      y: 0.7071067966408575
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: bump_left
  transform:
    translation:
      x: 0.08749999850988388
      y: 0.1515544354915619
      z: 0.039000000804662704
    rotation:
      x: 0.0
      y: 0.0
      z: 0.5000000126183913
      w: 0.8660253964992068
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: bump_front_left
  transform:
    translation:
      x: 0.1515544354915619
      y: 0.08749999850988388
      z: 0.039000000804662704
    rotation:
      x: 0.0
      y: 0.0
      z: 0.25881905213951417
      w: 0.9659258244035116
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: bump_front_center
  transform:
    translation:
      x: 0.17499999701976776
      y: 0.0
      z: 0.039000000804662704
    rotation:
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: bump_front_right
  transform:
    translation:
      x: 0.1515544354915619
      y: -0.08749999850988388
      z: 0.039000000804662704
    rotation:
      x: 0.0
      y: 0.0
      z: -0.25881905213951417
      w: 0.9659258244035116
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: bump_right
  transform:
    translation:
      x: 0.08749999850988388
      y: -0.1515544354915619
      z: 0.039000000804662704
    rotation:
      x: 0.0
      y: 0.0
      z: -0.5000000126183913
      w: 0.8660253964992068
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_side_left
  transform:
    translation:
      x: 0.0945528969168663
      y: 0.14725741744041443
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: 0.479425538604203
      w: 0.8775825618903728
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_left
  transform:
    translation:
      x: 0.14144298434257507
      y: 0.10304795205593109
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: 0.30934103818521125
      w: 0.9509511670398726
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_front_left
  transform:
    translation:
      x: 0.1653674691915512
      y: 0.05725907161831856
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: 0.1657317753008956
      w: 0.9861708668661904
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_front_center_left
  transform:
    translation:
      x: 0.17481249570846558
      y: 0.008098957128822803
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: 0.02299797226499384
      w: 0.9997355116588079
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_front_center_right
  transform:
    translation:
      x: 0.16995327174663544
      y: -0.041723862290382385
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: -0.11971220462599909
      w: 0.9928086361749594
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_front_right
  transform:
    translation:
      x: 0.1478203535079956
      y: -0.09367039799690247
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: -0.2782772104862426
      w: 0.9605008038122589
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_intensity_right
  transform:
    translation:
      x: 0.08053240180015564
      y: -0.15536901354789734
      z: 0.052000001072883606
    rotation:
      x: 0.0
      y: 0.0
      z: -0.5192729617038252
      w: 0.8546084432319504
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: ir_omni
  transform:
    translation:
      x: 0.17499999701976776
      y: 0.0
      z: 0.09
    rotation:
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: mouse
  transform:
    translation:
      x: 0.10114508122205734
      y: 0.08789191395044327
      z: 0.04
    rotation:
      x: 0.0
      y: 0.0
      z: 0.9262826355655593
      w: 0.3768295092607811
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: left_wheel
  transform:
    translation:
      x: 0.0
      y: 0.11649999767541885
      z: 0.035750001668930054
    rotation:
      x: -0.7071067966408575
      y: 0.0
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: right_wheel
  transform:
    translation:
      x: 0.0
      y: -0.11649999767541885
      z: 0.035750001668930054
    rotation:
      x: -0.7071067966408575
      y: 0.0
      z: 0.0
      w: 0.7071067657322372
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: button_1
  transform:
    translation:
      x: 0.05999999865889549
      y: 0.03700000047683716
      z: 0.07999999821186066
    rotation:
      x: 0.0
      y: -0.7071067811865475
      z: 0.0
      w: 0.7071067811865476
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: button_2
  transform:
    translation:
      x: 0.05999999865889549
      y: -0.03700000047683716
      z: 0.07999999821186066
    rotation:
      x: 0.0
      y: -0.7071067811865475
      z: 0.0
      w: 0.7071067811865476
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: button_power
  transform:
    translation:
      x: 0.05999999865889549
      y: 0.0
      z: 0.07999999821186066
    rotation:
      x: 0.0
      y: -0.7071067811865475
      z: 0.0
      w: 0.7071067811865476
- header:
    stamp:
      sec: 1724860524
      nanosec: 805856214
    frame_id: base_link
  child_frame_id: imu
  transform:
    translation:
      x: 0.050999999046325684
      y: 0.03500000014901161
      z: 0.0685
    rotation:
      x: 0.0
      y: 0.0
      z: 0.0
      w: 1.0
---
/wheel_status:底盘两轮状态
$ ros2 topic echo /wheel_status
header:
  stamp:
    sec: 1724919844
    nanosec: 662081462
  frame_id: base_link
current_ma_left: 0
current_ma_right: 0
pwm_left: 0
pwm_right: 0
wheels_enabled: true
---
/wheel_ticks:底盘两轮编码器状态
$ ros2 topic echo /wheel_ticks
header:
  stamp:
    sec: 1724919914
    nanosec: 7830808
  frame_id: base_link
ticks_left: -174
ticks_right: -683
---
/wheel_vels:底盘两轮当前的速度
$ ros2 topic echo /wheel_vels
header:
  stamp:
    sec: 1724919696
    nanosec: 252227496
  frame_id: base_link
velocity_left: 0.0
velocity_right: 0.0
---

参考资料

  • https://github.com/iRobotEducation/irobot_create_msgs
  • https://iroboteducation.github.io/create3_docs/api/safety/
  • https://iroboteducation.github.io/create3_docs/api/ros2/
  • https://turtlebot.github.io/turtlebot4-user-manual/software/create3.html

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: none