issue launching multiple robots

asked 2021-11-16 03:06:37 -0500

dinesh gravatar image

updated 2021-11-16 03:10:06 -0500

I have launched two robots with same urdf with different name. And no error message is shown when launched in gazebo. The launch file is:

<launch>

  <!-- <rosparam file="$(find bini_simulation)/config/bini_sim_hw_interface.yaml" command="load" ns="bini1"/> -->

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find turtlebot3_gazebo)/worlds/turtlebot3_house.world"/>
    <arg name="paused" value="false"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>

  <group ns="Bini1">
    <param name="tf_prefix" value="Bini1_tf" />
    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" 
      args="-urdf -model Bini1 -x 0 -y 0 -z 0 -param robot_description" />

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description"
      command="$(find xacro)/xacro --inorder '$(find bini_simulation)/urdf/bini.xacro'" />
  </group>

  <group ns="Bini2">
    <param name="tf_prefix" value="Bini2_tf" />
    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="spawn_urdf" pkg="gazebo_ros" type="spawn_model" 
      args="-urdf -model Bini2 -x 1 -y 0 -z 0 -param robot_description" />

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description"
      command="$(find xacro)/xacro --inorder '$(find bini_simulation)/urdf/bini.xacro'" />
  </group>
</launch>

And the launch file for the ros controllers including joint_state_publisher is:

<?xml version="1.0"?>
<launch>

  <arg name="serial_port" default="/dev/ttyUSB0"/>
  <arg name="use_ekf" default="false"/>
  <arg name="simulation" default="false"/>
  <arg name="robot" default="$(env BINI_MODEL)"/>
<group ns="Bini1">
  <param name="tf_prefix" value="Bini1_tf" />
  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find motion_controllers)/config/bini_controllers.yaml" command="load"/>

  <param name="base_controller/enable_odom_tf" type="bool" value="true"/>

  <group unless="$(arg simulation)">
    <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find bini_simulation)/urdf/bini.xacro'" />
    <rosparam file="$(find motion_controllers)/config/bini_hw_interface.yaml" command="load"/>
    <param name="/hardware_interface/serial_port" type="string" value="$(arg serial_port)"/>
    <node name="bini_hw_main" pkg="motion_controllers" type="bini_hw_main"
      output="screen" launch-prefix="$(arg launch_prefix)">
    </node>
  </group>

  <group if="$(arg use_ekf)">
    <param name="base_controller/enable_odom_tf" type="bool" value="false"/>
  </group>

  <!-- load the controllers -->
  <node name="ros_control_controller_manager" pkg="controller_manager" type="controller_manager" 
    respawn="false" output="screen" args="spawn
              joint_state_controller
              base_controller 
              head_controller 
              body_controller">
  </node>

  <node name="move_head" pkg="motion_controllers" type="move_head">
    <remap from="local_plan" to="move_base/NavfnROS/plan"/>
    <remap from="command" to="head_controller/command"/>
  </node>

  <node name="move_body" pkg="motion_controllers" type="move_body" output="screen">
    <remap from="command" to="body_controller/command"/>
    <remap from="current_goal" to="move_base/current_goal"/>
  </node>

  <node name="update_footprint" pkg="motion_controllers" type="update_footprint_node" output="screen"/>

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg ...
(more)
edit retag flag offensive close merge delete

Comments

Hi @dinesh, take a look at this thread in gazebosim https://answers.gazebosim.org//questi...

osilva gravatar image osilva  ( 2021-11-16 06:41:23 -0500 )edit