How to load more than one velocity controller

asked 2017-11-24 05:18:40 -0600

jdeleon gravatar image

Hello, I'm trying to control to maxon motors with ROS using the epos_hardware package.

I can control one motor perfectly in position and velocity mode, but when I try to add the second motor ROS says that can't load the controllers.

I have modify the URDF file to add the second motor, both in velocity profile.

<?xml version="1.0"?>
<robot name="example">

  <link name="link1">
    <inertial>
      <mass value="1"/>
      <inertia ixx="1" iyy="1" izz="1" ixy="0" ixz="0" iyz="0"/>
    </inertial>
  </link>

  <link name="link2">
    <inertial>
      <mass value="1"/>
      <inertia ixx="1" iyy="1" izz="1" ixy="0" ixz="0" iyz="0"/>
    </inertial>
  </link>

  <link name="link3">
    <inertial>
      <mass value="1"/>
      <inertia ixx="1" iyy="1" izz="1" ixy="0" ixz="0" iyz="0"/>
    </inertial>
  </link>

  <joint name="test_joint12" type="revolute">
    <parent link="link1"/>
    <child link="link2"/>
  </joint>

  <joint name="test_joint13" type="revolute">
    <parent link="link1"/>
    <child link="link3"/>
  </joint>

  <transmission name="test_joint_trans12">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="test_joint12">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="test_joint_actuator12">
      <mechanicalReduction>1000</mechanicalReduction>
    </actuator>
  </transmission>

  <transmission name="test_joint_trans13">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="test_joint13">
      <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
    </joint>
    <actuator name="test_joint_actuator13">
      <mechanicalReduction>1000</mechanicalReduction>
    </actuator>
  </transmission>

</robot>

Then I modified the launch file to add the new controllers:

<launch>

  <param name="robot_description" textfile="$(find epos_hardware)/robot/hexapodo_velocity.urdf" />

  <node name="epos_hardware" pkg="epos_hardware" type="epos_hardware_node"
        args="'left_drive_actuator' 'right_drive_actuator'"
        output="screen">
    <remap from="epos_hardware/joint_states" to="joint_states" />
    <param name="controller_rate" value="10.0" type="double" />
    <rosparam command="load" file="$(find epos_hardware)/config/epos_motors_2.yaml" />
    <rosparam command="load" file="$(find epos_hardware)/config/drive_epos_motor.yaml" param="left_drive_actuator"/>
    <rosparam command="load" file="$(find epos_hardware)/config/drive_epos_motor.yaml" param="right_drive_actuator"/>
  </node>

  <!-- Control en velocidad -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
        output="screen"
        args="joint_state_controller1 velocity_controller1
              joint_state_controller2 velocity_controller2"/>

  <param name="velocity_controller1/type" value="velocity_controllers/JointVelocityController" />
  <param name="velocity_controller1/joint" value="test_joint12" />

  <param name="position_controller1/type" value="position_controllers/JointPositionController" />
  <param name="position_controller1/joint" value="test_joint12" />

  <param name="joint_state_controller1/type" value="joint_state_controller/JointStateController" />
  <param name="joint_state_controller1/publish_rate" value="50" />

  <param name="velocity_controller2/type" value="velocity_controllers/JointVelocityController" />
  <param name="velocity_controller2/joint" value="test_joint13" />

  <param name="position_controller2/type" value="position_controllers/JointPositionController" />
  <param name="position_controller2/joint" value="test_joint13" />

  <param name="joint_state_controller2/type" value="joint_state_controller/JointStateController" />
  <param name="joint_state_controller2/publish_rate" value="50" />

</launch>

But when I try to launch all I have the next errors:

[INFO] [1511521448.356223]: Controller Spawner: Waiting for service controller_manager/load_controller

[INFO] [1511521448.356943]: Controller Spawner: Waiting for service controller_manager/switch_controller

[INFO] [1511521448.357662]: Controller Spawner: Waiting for service controller_manager/unload_controller

[INFO] [1511521448.358318]: Loading controller: joint_state_controller1

[ERROR] [1511521448.375306690]: This controller requires a hardware interface of type 'hardware_interface::JointStateInterface'. Make sure this is registered in the hardware_interface::RobotHW class.

[ERROR] [1511521448.375330763]: Initializing controller 'joint_state_controller1' failed

[ERROR] [1511521449.376551]: Failed to load joint_state_controller1

[INFO] [1511521449.376766]: Loading controller: velocity_controller1

[ERROR] [1511521449.394309423]: This controller requires a hardware interface of type 'hardware_interface::VelocityJointInterface'. Make sure this is registered in the hardware_interface::RobotHW class.

[ERROR] [1511521449.394331366]: Initializing controller 'velocity_controller1' failed ...
(more)
edit retag flag offensive close merge delete