Robotics StackExchange | Archived questions

Controller manager won't load the controllers (effort_controllers and joint_state_controller)

Hi, I'm trying to run a simulation in gazebo of the Crane+robot,

After having a lot of trouble initializing the controller manager (sneaky namespace issue) I finally get it running. I check it with rosservice list | grep controller_manager and everything looks fine:

/controller_manager/list_controller_types
/controller_manager/list_controllers
/controller_manager/load_controller
/controller_manager/reload_controller_libraries
/controller_manager/switch_controller
/controller_manager/unload_controller

However, when I go check if my controllers are running with rosrun controller_manager controller_manager list I get:

No controllers are loaded in mechanism control

The end of my output looks like this:

   [ INFO] [1498111743.053574972, 0.212000000]: Loaded gazebo_ros_control.
    [WARN] [1498111835.614948, 92.563000]: Controller Spawner couldn't find the expected controller_manager ROS interface.
    [crane/controller_spawner-4] process has finished cleanly
    log file: /home/albagr/.ros/log/425536cc-5711-11e7-8542-7446a0a300e6/crane-controller_spawner-4*.log
    [ERROR] [1498111846.979653545, 103.904000000]: Could not load controller 'joint2_effort_controller' because the type was not specified. Did you load the controller configuration on the parameter server (namespace: '/joint2_effort_controller')?

What I understand from this is that although the controller manager has been initialized, it can't load the controllers for some reason. When I try to load controllers individually with rosrun controller_manager controller_manager load [controller] the last error from the output appears. I've checked and all ros-kinetic-ros-control ros-kinetic-ros-controllers ros-kinetic-joint-state-controller ros-kinetic-effort-controllers and ros-kinetic-position-controllers packages are installed and the joint type is correct. I've also added the hardwareInterface tags in the urdf file as in here,

<transmission name="joint5_trans">
        <type>transmission_interface/SimpleTransmission</type>
        <joint name="joint5">
            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        </joint>
        <actuator name="joint5_motor">
            <mechanicalReduction>2</mechanicalReduction>
            <hardwareInterface>hardware_interface/EffortJointInterface</hardwareInterface>
        </actuator>
 </transmission>

I don't know where else to look. If you could help me out I'll really appreciate it. Thank you!

Edit:

My .yaml file

crane:

#Publish all joint states------------
 joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50

#Effort controllers------------------
 joint1_effort_controller:
  type: effort_controllers/JointEffortController
  joint: joint1
  pid: {p: 0.75, i: 0.5, d: 0.01}
 joint2_effort_controller:
  type: effort_controllers/JointEffortController
  joint: joint2
  pid: {p: 0.75, i: 0.5, d: 0.01}
 joint3_effort_controller:
  type: effort_controllers/JointEffortController
  joint: joint3
  pid: {p: 0.75, i: 0.5, d: 0.01}
 joint4_effort_controller:
  type: effort_controllers/JointEffortController
  joint: joint4
  pid: {p: 0.75, i: 0.5, d: 0.01}
 joint5_effort_controller:
  type: effort_controllers/JointEffortController
  joint: joint5
  pid: {p: 0.75, i: 0.5, d: 0.01}

and my launch file

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

  <!-- load the controllers -->
  <node name="controller_spawner"
    pkg="controller_manager"
    type="spawner" respawn="false"
    output="screen" ns="/crane"
    args="--namespace=/crane joint_state_controller joint1_effort_controller joint2_effort_controller joint3_effort_controller joint4_effort_controller joint5_effort_controller --timeout 100"/>

 <!-- 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"> 
    <param name="/crane/robot_description" command="$(find xacro)/xacro.py '$(find crane_urdf)/src/crane+.xacro'" />
    <remap from="/joint_states" to="/crane/joint_states" /> 
  </node>
</launch>

EDIT:

If I remove the namespace from here (launch file)

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

      <!-- load the controllers -->
      <node name="controller_spawner"
        pkg="controller_manager"
        type="spawner" respawn="false"
        output="screen" ns="/crane"
        args=" joint_state_controller joint1_effort_controller joint2_effort_controller joint3_effort_controller joint4_effort_controller joint5_effort_controller --timeout 100"/>

ROS tries to load the controllers, as shown in the output: [INFO] [1498180465.079824, 0.180000]: Loading controller: jointstatecontroller [ERROR] [1498180465.082662156, 0.183000000]: Could not load controller 'jointstatecontroller' because the type was not specified. Did you load the controller configuration on the parameter server (namespace: '/jointstatecontroller')? [ERROR] [1498180466.083704, 1.177000]: Failed to load jointstatecontroller (same for all the controllers)

I don't understand why this happens if the beginning of the output shows this, which proves that the .yaml file has been parsed.

SUMMARY
========

PARAMETERS
* /crane/crane/joint1_effort_controller/joint: joint1
 * /crane/crane/joint1_effort_controller/pid/d: 0.01
 * /crane/crane/joint1_effort_controller/pid/i: 0.5
 * /crane/crane/joint1_effort_controller/pid/p: 0.75
 * /crane/crane/joint1_effort_controller/type: effort_controller...
 * /crane/crane/joint2_effort_controller/joint: joint2
 * /crane/crane/joint2_effort_controller/pid/d: 0.01
 * /crane/crane/joint2_effort_controller/pid/i: 0.5
 * /crane/crane/joint2_effort_controller/pid/p: 0.75
 * /crane/crane/joint2_effort_controller/type: effort_controller...
 * /crane/crane/joint3_effort_controller/joint: joint3
 * /crane/crane/joint3_effort_controller/pid/d: 0.01
 * /crane/crane/joint3_effort_controller/pid/i: 0.5
 * /crane/crane/joint3_effort_controller/pid/p: 0.75
 * /crane/crane/joint3_effort_controller/type: effort_controller...
 * /crane/crane/joint4_effort_controller/joint: joint4
 * /crane/crane/joint4_effort_controller/pid/d: 0.01
 * /crane/crane/joint4_effort_controller/pid/i: 0.5
 * /crane/crane/joint4_effort_controller/pid/p: 0.75
 * /crane/crane/joint4_effort_controller/type: effort_controller...
 * /crane/crane/joint5_effort_controller/joint: joint5
 * /crane/crane/joint5_effort_controller/pid/d: 0.01
 * /crane/crane/joint5_effort_controller/pid/i: 0.5
 * /crane/crane/joint5_effort_controller/pid/p: 0.75
 * /crane/crane/joint5_effort_controller/type: effort_controller...
 * /crane/crane/joint_state_controller/publish_rate: 50
 * /crane/crane/joint_state_controller/type: joint_state_contr...
 * /robot_description: <?xml version="1....
 * /robot_state_publisher/crane/robot_description: <?xml version="1....
 * /rosdistro: kinetic
 * /rosversion: 1.12.7
 * /use_sim_time: True

NODES
  /
    controller_spawner (controller_manager/spawner)
    crane_spawner (gazebo_ros/spawn_model)
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)

Asked by Alba Garcia on 2017-06-22 01:35:09 UTC

Comments

Can you give the lines in the crane+.xacro where you include the ros_control plugin?

Asked by SorinV on 2017-06-22 06:25:48 UTC

You may have the same problem I had yesterday. All due to namespaces in the end. See here.

Asked by SorinV on 2017-06-22 06:33:52 UTC

Sure thing

<gazebo>
    <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
    </plugin>
</gazebo>

It's funny because I saw your question this morning and that's what helped me solve the namespace issue. Still, the controllers don't initialize...But thanks for that!

Asked by Alba Garcia on 2017-06-22 07:26:43 UTC

Glad that helped you. So i figure there must be a problem in the launch files. For example you can try to spawn the controller only with one namespace param: either ns="/crane" either args="--namespace=/crane, but just one to see if it works.

Asked by SorinV on 2017-06-22 09:22:51 UTC

It didn't change anything. I have the impression that the .yaml file is not loading. If I try to start the controller manually, it will ask for the type. If I enter the type manually, it'll then ask for the joint. The yaml file is supposed to be loaded on .launch Can anyone tell me what I'm missing?

Asked by Alba Garcia on 2017-06-22 19:36:40 UTC

For sure there is a problem with the .yaml, but I cannot see what can be. The difference I have is that I group the robot like so <group ns="/robot1"> </group> and I load inside the config and spawn everything. That seems to work for me.

Asked by SorinV on 2017-06-23 02:10:53 UTC

have you found a solution for your problem?? I'm having the same issue...

Asked by Miriam on 2018-05-21 13:36:17 UTC

I'm suffering exactly the same thing. I'm running my code in THE CONSTRUCT IDE so it isn't a case of not having the .so files library installed. Everything's right in that regard. I'm o-level frustrated at the moment.

Asked by afroRoboticist on 2019-02-26 10:50:19 UTC

Hi all! Sorry for taking so long to respond. I left this project more than one year ago. I finally found the solution in a japanese website: https://www.rt-shop.jp/blog/?s=ROS%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%9FCRANE%2B%E3%81%AE%E5%8B%95%E3%81%8B%E3%81%97%E6%96%B9&submit=Go

Asked by Alba Garcia on 2019-03-01 10:20:56 UTC

If you open the previous link on google chrome and use the translate feature it's pretty easy to follow. Go to the bottom to find part 1 of the tutorial. I never understoot why what I was previously doing didn't work, but it did after following this steps. Goog luck everybody! Hope this helps

Asked by Alba Garcia on 2019-03-01 13:31:45 UTC

Alba, I am having difficulties using google chrome to translate that website. Do you happen to know what you changed or what step/part in that tutorial helped resolve the issue?

Asked by crazy_computer on 2019-07-05 15:07:18 UTC

There is nothing in the referred tutorial. I'm having the exact problem and I've tried everything with no success.

Asked by CroCo on 2022-05-22 17:25:13 UTC

Answers

I faced the same issue yesterday and solved it by installing control pkgs,

sudo apt-get install ros-indigo-ros-control ros-indigo-ros-controllers

Asked by Yogi_4 on 2017-06-23 07:20:22 UTC

Comments

Thanks for your answer. Yes, I thought that might be the issue, but I checked several times and everything looks fine on that end.

Asked by Alba Garcia on 2017-06-25 23:04:31 UTC

type: "effort_controllers/JointTrajectoryController" try this as type in your yaml file

Asked by Yogi_4 on 2017-06-26 02:38:12 UTC

I see you already have what I was going to suggest but...... in my somename_control.launch file I had to put all the controllers and joint states ( that I had in my .yaml ) in order for it to work. Hopefully that helps someone !

<!-- load the controllers -->  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"  output="screen" ns="/yournamespace" args="joint_state_controller
                  jointname1_position_controller
                  jointname2_position_controller
                  jointname3_position_controller
                  jointname4_position_controller
                  jointname5_position_controller"/>

Asked by 1hada on 2020-01-20 17:04:36 UTC

Comments

Possibly if you change the directory "carne_control" to just "carne" the problem solve.

change to

Sorry for my english.

Asked by LeninSanchez on 2020-03-01 22:07:30 UTC

Comments

It may help to specify the namespace when you include the plugin:

<robotNamespace>/crane</robotNamespace>

Asked by Nichole Groener on 2020-04-25 11:43:30 UTC

Comments