control multiple robots in gazebo

asked 2016-04-25 06:48:23 -0500

Merolla Safwat gravatar image

updated 2016-04-25 07:33:51 -0500

hello

at first, I could control one robot.

now, I could spawn multiple robot with same description in gazebo but I can't control them

one_robot.launch

<launch>
  <arg name="robot_name"/>
  <arg name="init_pose"/>
  <node name="spawn_minibot_model" pkg="gazebo_ros" type="spawn_model"
     args="$(arg init_pose) -sdf -param /robot_description -model $(arg robot_name)"
     respawn="false" output="screen" />
  <node pkg="robot_state_publisher" type="state_publisher" 
  name="robot_state_publisher" output="screen"/> 
</launch>

robots.launch

<launch>
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />
<include file="$(find maasndt_gazebo)/launch/one_robot.launch" >
<arg name="init_pose" value="-x 1 -y 1 -z 0" />
<arg name="robot_name"  value="Robot1" />
</include>
</group>

<group ns="robot2">
<param name="tf_prefix" value="robot2_tf" />
<include file="$(find maasndt_gazebo)/launch/one_robot.launch" >
<arg name="init_pose" value="-x -1 -y 1 -z 0" />
<arg name="robot_name"  value="Robot2" />
</include>
</group>
</launch>

maasndt_control.launch

<launch>
 <rosparam file="$(find maasndt_control)/config/maasndt_control.yaml" command="load"/>
 <node name="controller_spawner"
 pkg="controller_manager"
 type="spawner" respawn="false"
 output="screen" ns="/maasndt"
 args="joint_state_controller
  LeftWheel_Motor  RightWheel_Motor"  />
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"   respawn="false"        output="screen">
  </node> 
 </launch>

maasndt.launch

  <launch> 
   <include file="$(find gazebo_ros)/launch/empty_world.launch">
   <arg name="world_name" value="$(find maasndt_gazebo)/worlds/maasndt.world"/>
   </include>

   <include file="$(find maasndt_gazebo)/launch/robots.launch"/> <include file="$(find maasndt_control)/launch/maasndt_control.launch"/>
  </launch>

Thank you :)

edit retag flag offensive close merge delete

Comments

Could you please format your launch file xml using the Preformatted text button on the toolbar (it's the one with 101010 on it)? Just select the text, and either press the button, or ctrl+k.

gvdhoorn gravatar imagegvdhoorn ( 2016-04-25 07:07:10 -0500 )edit

format in done :)

Merolla Safwat gravatar imageMerolla Safwat ( 2016-04-25 07:25:14 -0500 )edit

Can you control one of them or none of them ? Do you have an error message ? What is in your maasndt_control.yaml file ?

F.Brosseau gravatar imageF.Brosseau ( 2016-04-25 09:59:43 -0500 )edit