您的位置:首页 > 其它

ROS 模拟激光仿真数据 使用stage进行仿真 在stage中控制两个机器人

2017-01-02 21:08 966 查看
首先启动测试 是否有stage的安装包
roslaunch turtlebot_stage turtlebot_in_stage.launch
若没有该包则进行安装
若有错误 则把立马的某些位置更改一下即可

先把turtlebot_stage 中的maps文件夹复制到自己的工作空间中
maps中有这些文件
maze.png  maze.yaml  robopark2.bmp  robopark_plan.yaml  stage,其中stage 是一个文件夹 里面有maze.world  robopark_plan.world  turtlebot.inc
然后自己写一个启动satge的launch文件 名字为stage_test.launch
<launch>
<arg name="world_file"     default=" $(find agv)/maps/maps/stage/maze.world"/>
<node pkg="stage_ros" type="stageros" name="stageros" args="$(arg world_file)">
<param name="base_watchdog_timeout" value="0.5"/>
<remap from="odom" to="odom"/>
<remap from="base_pose_ground_truth" to="base_pose_ground_truth"/>
<remap from="cmd_vel" to="mobile_base/commands/velocity"/>
<remap from="base_scan" to="scan"/>
</node>
</launch>


测试启动launch文件
成功出现和上图一样的画面

改变代码 添加两个机器人

打开maze.world 在最下面添加一段代码

turtlebot

(

  pose [ 2.0 5.0 0.0 0.0 ]

  name "turtlebot1"

  color "blue"

)

将之重命名为maze_two.world

更改launch文件

<launch>
<arg name="world_file" default=" $(find agv)/maps/maps/stage/maze_two.world"/>
<node pkg="stage_ros" type="stageros" name="stageros" args="$(arg world_file)">
<param name="base_watchdog_timeout" value="0.5"/>
<remap from="odom" to="odom"/>
<remap from="base_pose_ground_truth" to="base_pose_ground_truth"/>
<remap from="cmd_vel" to="mobile_base/commands/velocity"/>
<remap from="base_scan" to="scan"/>
</node>
</launch>启动测试 出现了第二个蓝色的机器人

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  机器人仿真 ROS stage
相关文章推荐