< >
Home » walking机器人仿真教程_视频版 » walking机器人仿真教程-应用-多点导航结合闹铃播放实现移动闹钟

walking机器人仿真教程-应用-多点导航结合闹铃播放实现移动闹钟

walking机器人仿真教程-应用-多点导航结合闹铃播放实现移动闹钟

说明:

  • 介绍如何结合多点导航和铃声播放实现移动闹钟
  • 想法:分别导航到二个房间叫醒小朋友和大人 设定在早上6点,到房间A响闹铃, 结束之后到房间B响闹铃
  • 实现原理:通过航点编辑器设置航点文件,参考文章,再通过python3导航脚本读取航点文件,获取航点,进行导航,根据操作字段operate判断如果是闹铃,则启动播放闹铃.

步骤:

  • 加载gazebo
. /usr/share/gazebo/setup.bash 
  • 启动仿真
ros2 launch walking_application house_world_inspection.launch.py
  • gazebo效果:

请输入图片描述

  • rviz效果: 

请输入图片描述

  • 设计航点
  • 利用walking_navigation多点导航面板, 参考和目标点设置工具walkingGoal,参考,设定航点并保存航点
  • 目前设置两个航点,分别对应房间A和房间B

请输入图片描述

  • 保存文件到目录并命名:/home/ubuntu/waypoints/house_waypoints_alarm.json
  • 再利用航点编辑工具,设置航点操作为PlayAlarm

请输入图片描述

  • 保存文件到目录并命名:/home/ubuntu/waypoints/house_waypoints_alarm_ed.json
  • 启动导航
ros2 run walking_application run_inspection_v3.py
  • 文件已经默认指定航点文件为/home/ubuntu/waypoints/house_waypoints_alarm_ed.json
  • 执行效果: 
$ ros2 run walking_application run_inspection_v3.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
Executing current waypoint: 1
Executing current waypoint: 1
Executing current waypoint: 1
Executing current waypoint: 1
waypoint 1 is complete! 
Begin to play alarm !
play alarm 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
Executing current waypoint: 2
Executing current waypoint: 2
waypoint 2 is complete! 
Begin to play alarm !
play alarm is done!
[INFO] [1653532823.229803675] [basic_navigator]: Navigating to goal: 0.0 0.0...
  • 执行之后,自动在房间内导航,并到达一个航点之后,启动播放闹铃
  • 闹铃的mp3文件目录位于/home/ubuntu/Music/alarm_clock下.可以自己更换闹铃文件
  • 使用的航点文件位于/home/ubuntu/waypoints/house_waypoints_alarm_ed.json

演示视频

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

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


标签: walking机器人仿真教程