control multiple robots in gazebo

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

Merolla Safwat gravatar image

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

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 image gvdhoorn  ( 2016-04-25 07:07:10 -0600 )edit

format in done :)

Merolla Safwat gravatar image Merolla Safwat  ( 2016-04-25 07:25:14 -0600 )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 image F.Brosseau  ( 2016-04-25 09:59:43 -0600 )edit