Home | Tutorials | Wiki | Issues
Ask Your Question
0

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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_state_controller
                                      joint_left_wheel_controller
                                      joint_right_wheel_controller" />
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

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

Seen: 101 times

Last updated: Feb 05