自动驾驶小实验之Turtlebot3_Autopilot(Tensorflow, OpenCV, ROS, PID)

自动驾驶小实验之Turtlebot3_Autopilot

This is the final project in the 2021 Winter Camp of Cambridge University and I am following the Prof. Thomas.

Author: Beal.MS(河明山)

Date: 2021/2/25


目标检测

该模块由训练模型和应用模型组成。 训练模型的一部分主要由Tensorflow Api支持。 初步工作是对数据集进行校准和处理,然后根据Tensorflow Api中的目标检测训练步骤完成模型训练。 应用程序模型的一部分主要由Vision文件夹中的ROS精确张量流对象检测提供。 通过调用相机数据执行模型预测,最后将目标检测结果输出到图像。


Command:

# Training the model
$ python3 object_detection/model_main_tf2.py \
--pipeline_config_path="/home/hemingshan/auto_ws/src/vision/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/pipeline.config"\
--model_dir="/home/hemingshan/auto_ws/src/vision/training"\
--alsologtostderr\
$ python3 object_detection/export_inference_graph.py\
--input_type image_tensor \
--pipeline_config_path="/home/hemingshan/auto_ws/src/vision/ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8/pipeline.config" \
--trained_checkpoint_prefix="/home/hemingshan/auto_ws/src/vision/training/checkpoint.ckpt" \
--output_directory="/home/hemingshan/model"\
# Run the file
$ roslaunch turtlebot3_gazebo turtlebot3_autorace.launch
$ rosrun tensorflow_object_detector detect_ros.py 
$ rqt_image_view

调用tensorboard查看训练过程:

在这里插入图片描述


仿真结果:

在这里插入图片描述


路面检测

路面检测模块主要用于使汽车遵循交通规则以在道路范围内行驶。 此模块中有两种比较方法。 首先是使用opencv的图像处理和PID控制方法来完成模块的任务,但是通过下图,可以发现此方法将导致存在其他根据当前情况不会继续移动的路线 确定其他路线后的路线。 发生了 为了改进此方法,请调整摄像机的位置并将其对准地面,而不是像以前的方法那样面向前方,这表明摄像机的位置非常重要。


Command:

$ roslaunch turtlebot3_gazebo turtlebot3_auto.launch
$ rosrun tensorflow_object_detector detect_lane.py 

第一种方法:

在这里插入图片描述


第二种方法:

在这里插入图片描述

避障

在避障算法中,仅使用激光雷达测距的原理。 识别出障碍物后,将定位特定位置,最后通过简单的A *算法预测避障路线。

The result in the simulation:

在这里插入图片描述


最后,贴上我的Github地址:(https://github.com/MingshanHe/Autopilot-Demo.git)
欢迎大家私信探讨
还有,我的B站上也会有有趣的实验视频更新~

猜你喜欢

转载自blog.csdn.net/weixin_42139267/article/details/114045032
今日推荐