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_video.json
- 再利用航点编辑工具,设置航点操作为TakeVideo
- 保存文件到目录并命名:
/home/ubuntu/waypoints/house_waypoints_video_ed.json
- 启动导航
ros2 run walking_application run_inspection_v5.py
- 文件已经默认指定航点文件为
/home/ubuntu/waypoints/house_waypoints_video_ed.json
- 执行效果:
$ ros2 run walking_application run_inspection_v5.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 video!
take video 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 video!
take video is done!
[INFO] [1653532823.229803675] [basic_navigator]: Navigating to goal: 0.0 0.0...
- 执行之后,自动在房间内导航,到达一个航点之后,会启动录像程序
- 视频保存的目录位于
/home/ubuntu/Videos/
下,命名类似:video_202205272005.avi - 进入视频目录,可以使用命令
vlc video_202205272005.avi
查看视频 - 使用的航点文件位于
/home/ubuntu/waypoints/house_waypoints_video_ed.json
演示视频
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号