Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Can I run two gazebo_ros_control plugins in one simulation?

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">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="arm_base_joint1">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="arm_base_motor">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <plugin name="testbench_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/testbench</robotNamespace>
    <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
    <legacyModeNS>true</legacyModeNS>
  </plugin>

control yaml

testbench:
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

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

launch file

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

Can I run two gazebo_ros_control plugins in one simulation?

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">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="arm_base_joint1">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="arm_base_motor">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <plugin name="testbench_control" filename="libgazebo_ros_control.so">
    <robotNamespace>/testbench</robotNamespace>
    <robotSimType>gazebo_ros_control/DefaultRobotHWSim</robotSimType>
    <legacyModeNS>true</legacyModeNS>
  </plugin>

control yaml

testbench:
  joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 50  

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

control launch file:

<launch>

  <!-- 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" />
  </node>

</launch>

launch file

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