Gazebo | Ignition | Community
Ask Your Question
0

Spawning multiple robots each with a controller in the same namespace as the controller_manager

asked 2017-06-21 05:42:56 -0600

SorinV gravatar image

updated 2017-06-21 06:40:34 -0600

I have a problem when trying to start controllers for multiple robots that they cannot find the controller_manager

[WARN] [1498038782.062813, 84.949000]: Controller Spawner couldn't find the expected controller_manager ROS interface.

I am using the plugin in the .xacro file like so:

<gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
      <robotNamespace>/</robotNamespace>
    </plugin>
</gazebo>

and then launching each robot in a group with a different namespace.

What am I doing wrong?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-06-21 06:33:50 -0600

SorinV gravatar image

updated 2017-06-21 06:56:07 -0600

Minutes after posting this question I managed to resolve it:

First of all you have to remove the namespace tag from the .xacro/urdf file in order for the robots to get a namespece you specify, like so:

 <gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    </plugin>
  </gazebo>

Second, you have to specify the namespace almost everywhere even if you have the group tag, and I'll give an example for one robot:

<group ns="/robot1">
  <param name="tf_prefix" value="atlas1" />
   <rosparam file="$(find YOUR_PACKAGE)/config/control.yaml" command="load" ns="/robot1" /> 
   <param name="/robot1/robot_description" command="$(find xacro)/xacro --inorder $(arg model)"/>
      <node name="urdf_spawner_1" pkg="gazebo_ros" type="spawn_model"
        args="-z 1.0 -unpause -urdf -model robot1 -param robot_description " respawn="false" output="screen">
      </node>

      <node pkg="robot_state_publisher" type="robot_state_publisher"  name="robot_state_publisher_1">
        <param name="publish_frequency" type="double" value="30.0" />
      </node>

      <node name="robot1_controller_spawner" pkg="controller_manager" type="spawner" 
        args="--namespace=/robot1
        joint_state_controller
        tri_wheel_controller
        arm_controller
        --shutdown-timeout 3">
      </node>

      <node name="rqt_robot_steering1" pkg="rqt_robot_steering" type="rqt_robot_steering">
        <param name="default_topic" value="/robot1/tri_wheel_controller/cmd_vel"/>
      </node>
  </group>

And so on for another robot. Keep in mind that i redefined the robot_description each time in order for the controller to find it in the same namespace. It didn't work for me to define it outside and the use it in the group like /robot_description

tf_prefix is used in order to see all the robots in rviz. I am not sure how does it work without it, or how to use something else as tf_prefix is deprecated. For now it does not work to see it in rviz so I figures it does not calculate the tf for the link. I don't know how to solve this

edit flag offensive delete link more

Comments

Wonderful, this works well for me. For anyone in the same problem, control.yaml should remove the robot namespace (first line of the yaml), if multiple robots have same configuration.

DangTran gravatar imageDangTran ( 2020-03-27 23:32:10 -0600 )edit
0

answered 2019-12-18 21:28:10 -0600

chngdickson gravatar image

Not sure if this answer is relevant after all it's been 2 years.

Anyways, here goes. There are 2 things that the model needs to spawn in gazebo and rviz

  1. --namespace : Changing this in robot_description changes the model name.

  2. tf_prefix : This parameter changes your TF description. WHY??? So that we can find the relationship between the models.

  3. group ns : changing this parameter changes your node names. type /rosnode list or rostopic list

OK here are some examples:

1 node name="robot1_controller_spawner" pkg="controller_manager" type="spawner" args="--namespace=/robot1

Model name of base_link is now .... robot1/base_link robot1/sexy_link

2 Conditions ....

a. if (tf_prefix=null) No transform from [robot1/sexy_link] to [robot1/base_link]
b. if(tf_prefix=robot1) Your model works fine.

BUT WAIT, THERE'S more Why does my model still not work??? and the error No transform from [robot1/sexy_link] to [robot1/base_link] is still present???

Here are the steps 1. go to somefile.rviz Instructions below are the two changes

  1. find Fixed Frame , change this to Fixed Frame: robot1/base_link

  2. find Link Tree Style, change the parameter to Joints in Alphabetic Order,

    like so... Link Tree Style: Joints in Alphabetic Order

^Knowing this information... Will help u understand rviz better Here's a more modular answer. https://answers.ros.org/question/2634...

Step 1: change Fixed Frame : map

Step 2: add this into launch file

node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 map robot1/base_link 100"

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

Asked: 2017-06-21 05:42:56 -0600

Seen: 5,447 times

Last updated: Dec 18 '19