cmd_vel is not present for multiple robots and namespace for control manager are same

asked 2021-10-28 16:59:01 -0600

Souvik Basak gravatar image

I am launching multiple ridgeback robots like said here https://answers.ros.org/question/4143... , but I could not control individual robots independently. I know the errors but does not know how to solve them. I am attaching the launch file. one_robot.launch

    <launch>
  <arg name="x" default="0" />
  <arg name="y" default="0" />
  <arg name="z" default="1" />
  <arg name="yaw" default="0" />
  <arg name ="robot_name" default="ridgeback"/>

 <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
        args="-urdf -model $(arg robot_name) -param /robot_description -x $(arg x) -y $(arg y) -z $(arg z) -Y $(arg yaw)" />
     respawn="false" output="screen" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" 
          name="robot_state_publisher" output="screen"/>

    <!-- The odometry estimator, throttling, fake laser etc. go here -->
    <!-- All the stuff as from usual robot launch file -->

 <rosparam param="/gazebo_ros_control/pid_gains">
    front_left_wheel:
      p: 1
      i: 0.1
      d: 0
    front_right_wheel:
      p: 1
      i: 0.1
      d: 0
    rear_left_wheel:
      p: 1
      i: 0.1
      d: 0
    rear_right_wheel:
      p: 1
      i: 0.1
      d: 0
  </rosparam>

 <!-- control -->

   <rosparam command="load" file="$(find ridgeback_control)/config/control.yaml" ns="/$(arg robot_name)"/>

  <group if="$(optenv RIDGEBACK_CONTROL_EXTRAS 0)" >
    <rosparam command="load" file="$(env RIDGEBACK_CONTROL_EXTRAS_PATH)" />
  </group>

  <node name="controller_spawner_$(arg robot_name)"  pkg="controller_manager" type="spawner"
        args=" --namespace=/$(arg robot_name) ridgeback_joint_publisher ridgeback_velocity_controller" />

      <node pkg="robot_localization" type="ekf_localization_node" name="ekf_localization" />

      <node pkg="topic_tools" type="relay" name="cmd_vel_relay"
            args="cmd_vel ridgeback_velocity_controller/cmd_vel" />

      <arg name="joy_dev" default="/dev/input/js0" />
      <arg name="joystick" default="true" />

  <group ns="bluetooth_teleop" if="$(arg joystick)">

    <group unless="$(optenv RIDGEBACK_PS3 0)" >
      <rosparam command="load" file="$(find ridgeback_control)/config/teleop_ps4.yaml" />
    </group>

    <group if="$(optenv RIDGEBACK_PS3 0)" >
      <rosparam command="load" file="$(find ridgeback_control)/config/teleop_ps3.yaml" />
      <param name="joy_node/dev" value="$(arg joy_dev)" />
    </group>

    <node pkg="joy" type="joy_node" name="joy_node" />

    <node pkg="teleop_twist_joy" type="teleop_node" name="teleop_twist_joy">
      <remap from="cmd_vel" to="/cmd_vel" />
    </node>
  </group>

  <arg name="config" default="linear" />

  <node pkg="interactive_marker_twist_server" type="marker_server" name="twist_marker_server">
    <remap from="twist_marker_server/cmd_vel" to="/cmd_vel" />
    <rosparam command="load" file="$(find interactive_marker_twist_server)/config/$(arg config).yaml" /> 
  </node> 
</launch>

robots.launch

<launch>
    <arg name="debug" default="false"/>
    <arg name="gui" default="true"/>
    <arg name="pause" default="false"/>
    <arg name="world" value="$(find hybrid_astar)/world/hospital_04.world"/>

    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" default="$(arg world)"/>
        <arg name="debug" value="$(arg debug)"/>
        <arg name="gui" value="$(arg gui)"/>
        <arg name="paused" value="$(arg pause)"/>
        <arg name="use_sim_time" value="true"/>
    </include> 

  <!-- <param name="/use_sim_time" value="true" />


  <node name="gazebo" pkg="gazebo_ros" type="gazebo" 
   args="$(find hybrid_astar)/world/empty_wall.world" respawn="false" output="screen" /> -->


 <!-- <node name="gazebo_gui" pkg="gazebo" type="gui" respawn="false" output="screen"/>-->

<arg name="config" default="dual_hokuyo_lasers" />
    <param name="robot_description"
        command="$(find ridgeback_description)/scripts/env_run ...
(more)
edit retag flag offensive close merge delete