ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

Starting a controller in the same namespace as the controller_manager

asked 2017-06-21 06:07:26 -0500

SorinV gravatar image

updated 2017-06-21 07:07:38 -0500

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

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-06-21 07:01:09 -0500

SorinV gravatar image

updated 2019-02-26 14:38:48 -0500

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 namespace 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 figured it does not calculate the tf for the link. I don't know how to solve this

edit flag offensive delete link more

Comments

I was unable to connect my Rviz model to my Gazebo...to elaborate...

upon running demo_gazebo.launch from the MSA, a model would spawn in Rviz and be capable of planning, but the gazebo model that would also spawn would be erratic and I was receive the WARNING at the top of this page.

Removing the namespace from the gazebo plugin tag "synced" (probably not the right word) my Rviz model and my gazebo model. Now my rviz model is in the same position as my gazebo model so its a step in the right direction.

Thanks @SorinV

matthewmarkey gravatar image matthewmarkey  ( 2020-05-12 05:30:01 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-06-21 06:07:26 -0500

Seen: 4,890 times

Last updated: Feb 26 '19