Gazebo | Ignition | Community
Ask Your Question

Can I run two gazebo_ros_control plugins in one simulation?

asked 2019-01-30 07:17:33 -0500

kumpakri gravatar image

updated 2019-01-30 09:21:00 -0500

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="">

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-02-05 11:05:11 -0500

kumpakri gravatar image

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" />
edit flag offensive delete link more


no need to add "--namespace=/robot1" , otherwise provided answer is correct

Oscar Lima gravatar imageOscar Lima ( 2021-03-01 13:14:13 -0500 )edit

Question Tools

1 follower


Asked: 2019-01-30 07:17:33 -0500

Seen: 1,702 times

Last updated: Feb 05 '19