0
$\begingroup$

Rosanswers logo

Hi everyone. I have a problem and I hope you can help me. :)

I have a robot: Two Schunk lwa4d arms mounted on a box.

I can load this robot in gazebo.

I can load this robot in moveit + rviz and plan path for it.

But the problem is making connection between these two. So far, I am unable of doing so. I know that in both sides, gazebo and moveit, i need to have some modifications. But my major suspicion is a warning message that I receive when launching my robot in gazebo, where it warns:

[WARN] [WallTime: 1438070984.731293] [4.961000] Controller Spawner couldn't find the expected controller_manager ROS interface.

[WARN] [WallTime: 1438070984.740924] [4.954000] Controller Spawner couldn't find the expected controller_manager ROS interface.

I know it has something to do with controller_manager. In my launch file, I have:

<!-- controllers -->
<rosparam file="$(find schunk_lwa4d)/config/TwoArm/TwoArm_arm_controller_v2.yaml" command="load"/>
<rosparam file="$(find schunk_lwa4d)/config/joint_state_controller.yaml" command="load"/>
<!-- start_controllers -->
<node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner" args="joint_state_controller" respawn="false" />
<node name="arm_controller_spawner" pkg="controller_manager" type="spawner" args="arm_controller" />

What I know for now is that each warning is related to one control spawning. My file, joint_state_controller.yaml is very small:

joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50

ROS is able to locate it. So the problem shouldn't be finding the file. But in spawning it using controller spawner, something is going wrong.

I tried to copy-paste the other file, TwoArm_arm_controller_v2.yaml, here too. But I couldn't format it in a good way to be easily readable. But the basic structure is something like:

## joint_names
joint_names: [arm1_1_joint, arm1_2_joint, arm1_3_joint, arm1_4_joint, arm1_5_joint, arm1_6_joint, arm1_7_joint, arm2_1_joint, arm2_2_joint, arm2_3_joint, arm2_4_joint, arm2_5_joint, arm2_6_joint, arm2_7_joint]
## joint trajectory controller
arm_controller:
  type: position_controllers/JointTrajectoryController
  joints:
    - arm1_1_joint
    ...
    - arm1_7_joint
    - arm2_1_joint
    ...
    - arm2_7_joint

  constraints:
    goal_time: 0.6
    stopped_velocity_tolerance: 0.05
    arm1_1_joint: {trajectory: 0.1, goal: 0.1}
    ...
    arm2_7_joint: {trajectory: 0.1, goal: 0.1}
  stop_trajectory_duration: 0.5
  state_publish_rate:  25
  action_monitor_rate: 10

What I could find by now is that there may be two reasons for this warning:

  • controller manager not running.
  • not launching the spawned script in the same namespace as the controller manager.

But honestly, I don't know how to move forward from this point. I know that controller_manager has been installed:

ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find controller_manager

/opt/ros/indigo/share/controller_manager

Unfortunately I don't know how to remove the warnings. I have the feeling that if Moveit can't communicate with gazebo, this warning can be a reason. Any help is highly appreciated. :)

UPDATE:

After launching my robot in gazebo, I tried this command:

ros@ros:~$ rosrun controller_manager controller_manager list

Nothing appears. The terminal goes frozen. I asked the same thing from my friend whose robot (2 U10 arms on a box) is loaded and controlled properly by moveit. Here is his result:

merosy@MeRoSy-1:~$ rosrun controller_manager controller_manager list joint_state_controller - hardware_interface::JointStateInterface ( running )

arm_controller - hardware_interface::PositionJointInterface ( running )

Seemingly my controller_manager is not working properly. Any suggestion?

Edit:

The first thing here to check if we include gazebo plugin in our urdf or not. I had forgotten it. So to my main robot.xacro file, I added:

<!-- gazebo_plugin for arm -->
<gazebo>
     <plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
     </plugin>
</gazebo>

Now the warning disappeared. But this error replaced it:

[ERROR] [1438148855.306557869, 1.195000000]: Could not load controller 'joint_trajectory_controller' because controller type 'position_controllers/JointTrajectoryController' does not exist.
[ERROR] [1438148855.306675796, 1.195000000]: Use 'rosservice call controller_manager/list_controller_types' to get the available types

I do:

ros@ros:~$ rosservice call controller_manager/list_controller_types

And the message was right: I didn't have joint trajectory controller in the list. I installed the stack ros_controllers. The error still exists but it has changed a bit into:

[ERROR] [1438241832.828501125, 1.325000000]: Could not load class joint_state_controller/JointStateController: Could not find library corresponding to plugin joint_state_controller/JointStateController. Make sure the plugin description XML file has the correct name of the library and that the library actually exists.
[ERROR] [1438241832.828590337, 1.325000000]: Could not load controller 'joint_state_controller' because controller type 'joint_state_controller/JointStateController' does not exist.
[ERROR] [1438241832.828620348, 1.325000000]: Use 'rosservice call controller_manager/list_controller_types' to get the available types
[ERROR] [WallTime: 1438241833.829661] [2.315000] Failed to load joint_state_controller

This time, while the program running, in another terminal, I try again:

ros@ros:~$ rosservice call controller_manager/list_controller_types

And 'joint_state_controller/JointStateController' is between the results.

I again thank you for your attention and apologize if my ROS knowledge is not good enough.

Edit:

Maybe a clue: I know that the package joint_state_controller has been installed:

ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find joint_state_controller
/opt/ros/indigo/stacks/ros_controllers/joint_state_controller

And I know that when loading the robot in gazebo, the controller is there [well, I don't know how to write this: the controller is ... recognized???]:

ros@ros:~$ rosrun controller_manager controller_manager list-types
cob_omni_drive_controller/OdometryController
cob_omni_drive_controller/WheelController
controller_manager_tests/EffortTestController
controller_manager_tests/MyDummyController
...
joint_state_controller/JointStateController
velocity_controllers/JointTrajectoryController
...

But as I search the file: libjoint_state_controller.so In opt/ros/indigo/lib

I don't find the file! Now it also gives some ideas to me why I always had problem with initial controllers of schunk (and finally I decided to remove them from sim.launch file and follow the instructions by gazebo):

ERROR: cannot launch node of type [cob_control_mode_adapter/cob_control_mode_adapter_node]: can't locate node [cob_control_mode_adapter_node] in package [cob_control_mode_adapter]

But anyway! Maybe this is not related! Back to the discussion, I couldn't find the .so file. P.S. My ros_controllers is not in opt/ros/indigo/share. I downloaded it in opt/ros/indigo/stacks. Although I don't think it makes any difference. Just said because you (Adolfo) emphasized the folder ros/indigo/share. :)


Originally posted by Damon on ROS Answers with karma: 137 on 2015-07-28

Post score: 13

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Check two things:

Firstly, that the controller_manager is running. You can check this by executing on the command line:

rosservice list | grep controller_manager

The expected output should look like:

/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

If you don't get any output, then you're probably not loading the gazebo_ros_control plugin in your robot model:

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

Notice that if you specify <robotNamespace> above (it's optional), the controller_manager ROS API will be namespaced to /MYROBOT/controller_manager/...

Secondly, check that the controller_manager and the spawner are in the same namespace. That is, if you spawn the controller_manager under the MYROBOT namespace, the spawner should be pushed to the same namespace as well. roslaunch allows spawning nodes in namespaces.

You might be interested in this related question


Originally posted by Adolfo Rodriguez T with karma: 3907 on 2015-07-28

This answer was ACCEPTED on the original site

Post score: 31


Original comments

Comment by Damon on 2015-07-29:
Thank you so much Adolfo. You were right and I added the plugin. So the warning disappeared. Nevertheless, now I see another problem: Could not load class joint_state_controller/JointStateController: Could not find library corresponding to plugin joint_state_controller/JointStateControlle

Comment by Damon on 2015-07-29:
I know that joint_state_controller/JointStateController is between my controllers. I see it when:

ros@ros:/opt/ros/indigo/stacks$ rosservice call controller_manager/list_controller_types

:(

Comment by Adolfo Rodriguez T on 2015-07-29:
Are you positive that the library exists and is visible by your current ROS environment?. If installing from binaries, ros-<distro>-joint-state-controller should be installed. If building from source, rospack find joint_state_controller should yield a valid path. Make sure the package is built.

Comment by Damon on 2015-07-30:
Hi again, Adolfo.

ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find joint_state_controller
/opt/ros/indigo/stacks/ros_controllers/joint_state_controller

Comment by Damon on 2015-07-30:
Before installing the stack ros_controllers, I had the same error. So your guess is true that not having the controller causes this error. BUT! The difference is that when having the package, the error says: " Make sure the plugin description XML file has the correct name of the library and ... "

Comment by gvdhoorn on 2015-07-30:
@Damon: edit your original question with any new information. The comments are really way too limited to add copy/pastes of console output. Just add Edit: and then place whatever new info you have after that.

Comment by Adolfo Rodriguez T on 2015-07-30:
Did you mean /opt/ros/indigo/**share**/ros_controllers/joint_state_controller?. Could you check that /opt/ros/indigo/lib/libjoint_state_controller.so exists?.

Comment by Adolfo Rodriguez T on 2015-07-30:
You mention in the question update that you downloaded the controller into /opt/ros/indigo/stacks, so, you're not installing from binaries. The actual plugin (the .so library) needs to be built, it's not part of the version-controlled files in the repository. Is this what's going on?.

Comment by Damon on 2015-07-31:
Dear Adolfo, sadly I should admit that is exactly what was going on. :( My wrong understanding of some basics in ROS. I feel a bit embarrassed but at least I can say that I am learning as I move forward. I hope I didn't annoy you much. :(

Comment by Adolfo Rodriguez T on 2015-07-31:
Great!. Happy coding then. Could you please mark the question as answered?.

Comment by Damon on 2015-07-31:
Yes. Also the problem here was solved and I finished the project successfully. :) Thanks Adolfo for the patience. I will try to write another answer in here as soon as I finish my thesis (deadline: 15th of August).

Comment by filipposanfilippo on 2016-04-20:
Hi, I am having the same problem.

When running:

rosservice list | grep controller_manager

I do not get any output even if the gazebo_ros_control is loaded in my robot model. Any ideas? Can you help me?

Comment by Alba Garcia on 2017-06-20:
Hi, I'm getting the same error and after following all the instructions written here, I still can't fix it. I think the problem comes from the controller_manager and spawner namespace, but I'm not sure I understand what this exactly means. I specify it in the plugin and .launch file.Any ideas? Thx

Comment by dmpatod on 2019-01-23:
https://github.com/DMPatod/industrial_robot_proj I'm having the same problem here. I've put all namespace with the same name but the warn persist

Comment by Fookii on 2020-04-07:
For anyone who is new to ros and learning with urdf-tutorial. the second point us important cause they have in tutorial empty robot namespace. And thanks Adolfo

$\endgroup$
0
$\begingroup$

Rosanswers logo

just install ros-kinetic-gazebo-ros-control by :

sudo apt install ros-kinetic-gazebo-ros-control

Originally posted by khaled0000 with karma: 21 on 2018-06-09

This answer was NOT ACCEPTED on the original site

Post score: 3

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.