walking机器人仿真教程-应用-多点导航结合拍照功能实现移动摄影
walking机器人仿真教程-应用-多点导航结合拍照功能实现移动摄影
说明:
- 介绍如何结合多点导航和拍照功能实现移动摄影
- 想法:每天可以在各个房间不同点进行拍照
- 实现原理:通过航点编辑器设置航点文件增加操作项,再通过python3导航脚本读取航点文件,获取航点进行导航,根据操作字段operate判断为拍照动作,从而启动拍照程序
步骤:
- 加载gazebo
. /usr/share/gazebo/setup.bash
- 启动仿真
ros2 launch walking_application house_world_v2.launch.py
- gazebo效果:
- rviz效果:
- 摄像头效果:
- 保存文件到目录并命名:
/home/ubuntu/waypoints/house_waypoints_picture.json
- 再利用航点编辑工具,设置航点操作为TakePicture
- 保存文件到目录并命名:
/home/ubuntu/waypoints/house_waypoints_picture_ed.json
- 启动导航
ros2 run walking_application run_inspection_v4.py
- 文件已经默认指定航点文件为
/home/ubuntu/waypoints/house_waypoints_picture_ed.json
- 执行效果:
$ ros2 run walking_application run_inspection_v4.py
pygame 2.1.2 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
[INFO] [1653532675.804807687] [basic_navigator]: Publishing Initial Pose
[INFO] [1653532679.841127306] [basic_navigator]: Nav2 is ready for use!
[INFO] [1653532679.842634932] [basic_navigator]: Navigating to goal: -6.65857267 -0.0444915...
Executing current waypoint: 1
Executing current waypoint: 1
Executing current waypoint: 1
Executing current waypoint: 1
Executing current waypoint: 1
waypoint 1 is complete!
Begin to take picture!
take picture is done!
[INFO] [1653532758.265608384] [basic_navigator]: Navigating to goal: -6.3024497 -2.95511127...
Executing current waypoint: 2
Executing current waypoint: 2
Executing current waypoint: 2
Executing current waypoint: 2
Executing current waypoint: 2
Executing current waypoint: 2
waypoint 2 is complete!
Begin to take picture!
take picture is done!
[INFO] [1653532823.229803675] [basic_navigator]: Navigating to goal: 0.0 0.0...
- 执行之后,自动在房间内导航,到达一个航点之后,会启动拍照程序
- 图片保存的目录位于
/home/ubuntu/Pictures/
下,命名类似:pic_202205272005.jpg - 进入图片目录,可以使用命令
eog pic_202205272005.jpg
查看图片 - 使用的航点文件位于
/home/ubuntu/waypoints/house_waypoints_picture_ed.json
演示视频
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号