gazebo, controller not started

asked 2020-10-16 17:44:35 -0600

Hi there,

I'm trying to use ros control with gazebo

URDF:

<transmission name="trans_base_joint">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="base_joint">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="base_joint_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>
<transmission name="trans_shoulder">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="shoulder">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="shoulder_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>
<transmission name="trans_elbow">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="elbow">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="elbow_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>
<transmission name="trans_wrist">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="wrist">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
    </joint>
    <actuator name="wrist_motor">
        <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
        <mechanicalReduction>1</mechanicalReduction>
    </actuator>
</transmission>
<gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
        <robotNamespace>/</robotNamespace>
    </plugin>
</gazebo>

gazebo launch file:

<?xml version="1.0"?>
<launch>


  <arg name="paused" default="false"/>
  <arg name="gazebo_gui" default="true"/>
  <arg name="urdf_path" default="$(find robot_arm_pkg)/urdf/arduino_robot_arm.urdf"/>

  <!-- startup simulated world -->
  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" default="worlds/empty.world"/>
    <arg name="paused" value="$(arg paused)"/>
    <arg name="gui" value="$(arg gazebo_gui)"/>
  </include>

  <!-- send robot urdf to param server -->
  <param name="robot_description" textfile="$(arg urdf_path)" />

  <!-- push robot_description to factory and spawn robot in gazebo at the origin, change x,y,z arguments to spawn in a different position -->
  <node name="spawn_gazebo_model" pkg="gazebo_ros" type="spawn_model" args="-urdf -param robot_description -model robot -x 0 -y 0 -z 0"
respawn="false" output="screen" />



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

  <!-- Load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" args="arm_controller "/>



</launch>

yml config file:

joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50


arm_controller:
  type: position_controllers/JointTrajectoryController
  joints:
    - base_joint
    - shoulder
    - elbow
    - wrist
  gains:
    base_joint:
      p: 100
      d: 1
      i: 1
      i_clamp: 1
    shoulder:
      p: 100
      d: 1
      i: 1
      i_clamp: 1
    elbow:
      p: 100
      d: 1
      i: 1
      i_clamp: 1
    wrist:
      p: 100
      d: 1
      i: 1
      i_clamp: 1

the problem is I got this warn message and errors, and the created arm_controller not started

[WARN] [1602886436.457933, 0.000000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
Exception in thread /clock (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
  File "/usr/lib/python2.7/threading.py", line 754, in run
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_pubsub.py", line 185, in robust_connect_subscriber
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 824, in receive_loop
<type 'exceptions.TypeError'>: 'NoneType' object is not callable

I installed all these dependencies:

sudo apt-get install ros-kinetic-gazebo-ros-control joint-state-publisher
sudo apt-get install ros-kinetic-controller-manager
sudo apt-get install ...
(more)
edit retag flag offensive close merge delete

Comments

Probably the error is here:

  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" args="arm_controller "/>

You left a space after "arm_controller", so ros is not able to find it.

matteocotifava gravatar image matteocotifava  ( 2020-10-22 14:30:27 -0600 )edit