跳转至

交通杆识别

校准

1.启动gazebo节点

roslaunch turtlebot3_gazebo turtlebot3_autorace_2020.launch

2.启动键盘控制移动到标志前

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
  • TB3移动到位置后,关闭键盘控制节点

3.启动相机的内标定

roslaunch turtlebot3_autorace_camera intrinsic_camera_calibration.launch

4.启动相机的外标定

roslaunch turtlebot3_autorace_camera extrinsic_camera_calibration.launch

5.启动交通灯检测校准节点

roslaunch turtlebot3_autorace_detect detect_level_crossing.launch mode:=calibration

6.加载交通杆控件

roslaunch turtlebot3_autorace_core turtlebot3_autorace_mission.launch

7.打开可视化界面

rqt
  • 点击rqt左上角菜单栏Plugins -> Cisualization -> Image view,依次添加三个窗口且分别订阅/detect/image_level_color_filtered/compressed/detect/image_level/compressed两个主题

8.打开rqt_reconfigure工具

rosrun rqt_reconfigure rqt_reconfigure
  • 点击detect_level_crossing后调整参数来过滤红色,实际需要的过滤效果可以参考上图

  • 新终端,将调整好的值写入turtlebot3_autorace_detect/param/level/level.yaml文件中
---
detect:
  level:
    red:
      hue_l: 0
      hue_h: 179
      saturation_l: 24
      saturation_h: 255
      lightness_l: 207
      lightness_h: 255

测试

1.关闭所有终端,打开gazebo

roslaunch turtlebot3_gazebo turtlebot3_autorace_2020.launch

2.启动键盘控制节点,移动到标志前

roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch
  • TB3移动到位置后,关闭键盘控制节点

3.启动相机内标定

roslaunch turtlebot3_autorace_camera intrinsic_camera_calibration.launch

4.启动交通杆检测单独任务

roslaunch turtlebot3_autorace_core turtlebot3_autorace_core.launch mission:=level_crossing

5.加载gazebo任务

roslaunch turtlebot3_autorace_core turtlebot3_autorace_mission.launch

6.设置decided_mode为2

rostopic pub -1 /core/decided_mode std_msgs/UInt8 "data: 2"