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

首先启动测试 是否有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>
启动测试 出现了第二个蓝色的机器人





评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值