Gazebo Answers logo

I run a simulation into which I spawn a robot with gazebo_ros_control plugin called simply "gazebo_ros_control". This loads all successfully. Then there is a model inside the world which has gazebo_ros_control plugin. This one only starts the joint_states topic, but not the command, pid and state topic for each joint individually.

plugin of the model inside the world:

  <transmission name="tran_robotic_arm">
    <joint name="arm_base_joint1">
    <actuator name="arm_base_motor">

  <plugin name="testbench_control" filename="libgazebo_ros_control.so">

control yaml

    type: joint_state_controller/JointStateController
    publish_rate: 50  

    type: velocity_controllers/JointVelocityController
    joint: arm_base_joint1
    pid: {p: 10.0, i: 0.1, d: 0.01}

control launch file:


  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find testbench_control)/config/control.yaml" command="load"/>

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/testbench" args=" joint_state_controller
                                      arm_base_joint1_controller" />

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/testbench/joint_states" />


launch file

<?xml version="1.0"?>
    <!-- testbench ros_control launch file -->
    <!-- creates topics for joints state and joint controller -->
    <include file="$(find testbench_control)/launch/control.launch" />

I launch this launch file after the simulation is all loaded. I want to use the /testbench/arm_base_joint1_controller/command topic to control the robotic arm joint. Is it possible? What am I doing wrong?

Originally posted by kumpakri on Gazebo Answers with karma: 755 on 2019-01-30

Post score: 0


1 Answer 1


Gazebo Answers logo

Turned out, that if I use this --namespace argument when launching the controller_spawner, the gazebo_ros_control plugin is launched in that namespace and you can launch several of them this way.

  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/robot1" args=" --namespace=/robot1
                                      joint_right_wheel_controller" />

Originally posted by kumpakri with karma: 755 on 2019-02-05

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by Oscar Lima on 2021-03-01:
no need to add "--namespace=/robot1" , otherwise provided answer is correct


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.