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 ...
Can you give the lines in the
crane+.xacro
where you include the ros_control plugin?You may have the same problem I had yesterday. All due to namespaces in the end. See here.
Sure thing
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!
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"
eitherargs="--namespace=/crane
, but just one to see if it works.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?
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.have you found a solution for your problem?? I'm having the same issue...
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.