Controller manager - How to correctly launch it
EDIT FOR THE SOLUTION OF THE ERROR
I was trying to configure the controllers for the real robot as a normal gazebo model.
but I was making an error. Ros CANopen only needs the URDF file of the robot, not the controllers. That was why I couldn't load the controller_manager.
If I add to the URDF of the real robot
<gazebo>
<plugin name="gazebo_ros_control" filename="libgazebo_ros_control.so">
<robotNamespace>/hexapodo</robotNamespace>
</plugin>
</gazebo>
and load the spawn the controllers in the launch file:
<!-- load the controllers -->
<node name="controller"
pkg="controller_manager"
type="controller_manager"
respawn="false"
output="screen"
ns="hexapodo"
args="spawn
joint_state_controller
motor_1_to_base_link_joint
pata2_velocity_controller
pata3_velocity_controller
pata4_velocity_controller
pata5_velocity_controller
pata6_velocity_controller"/>
They are correctly spawned:
jorge@jorge-ubuntu:~$ rostopic list
/clicked_point
/clock
/diagnostics
/gazebo/link_states
/gazebo/model_states
/gazebo/parameter_descriptions
/gazebo/parameter_updates
/gazebo/set_link_state
/gazebo/set_model_state
/hexapodo/joint_states
/hexapodo/motor_1_to_base_link_joint/command
/hexapodo/pata2_velocity_controller/command
/hexapodo/pata3_velocity_controller/command
/hexapodo/pata4_velocity_controller/command
/hexapodo/pata5_velocity_controller/command
/hexapodo/pata6_velocity_controller/command
/imu
/initialpose
/joint_states
/move_base_simple/goal
/robotest/laser/scan
/rosout
/rosout_agg
/tf
/tf_static
- - - - - - - - - END OF THE EDIT
Hi all, I am building the robot described in question #292882 and trying to control the Maxon MCD Epos with ROS Canopen.
I am running ROS Kinectic on a i7 desktop PC.
But now, I have a problem launching the controller_manager.
If I launch it, as is explain in the wiki
<launch>
<node name="controller_node"
pkg="controller_manager"
type="spawner"
args="controller_name1 controller_name2" />
</launch>
I have the next error:
[INFO] [1528197681.380398]: Controller Spawner: Waiting for service controller_manager/load_controller
[WARN] [1528197711.592166]: Controller Spawner couldn't find the expected controller_manager ROS interface.
[controller_node-3] process has finished cleanly
But, if I change the launch type and args, I have no error:
<node name="controller_node"
pkg="controller_manager"
type="controller_manager"
output="screen"
respawn="false"
args="spawn joint_state_controller pata1_velocity_controller" />
But I have no controllers loaded in my ROS. If I list the services, there isn't any for the controller_manager:
jorge@jorge-ubuntu:~$ rosservice list
/canopen_chain/get_loggers
/canopen_chain/set_logger_level
/driver/get_object
/driver/halt
/driver/init
/driver/recover
/driver/set_object
/driver/shutdown
/joint_state_publisher/get_loggers
/joint_state_publisher/set_logger_level
/robot_state_publisher/get_loggers
/robot_state_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level
/rviz/get_loggers
/rviz/reload_shaders
/rviz/set_logger_level
Also, if I run:
jorge@jorge-ubuntu:~$ rosrun controller_manager controller_manager spawn pata1_velocity_controller
The terminal doesn't show any message.
If somebody need, I can upload the xacro file of the robot, the yaml for the controllers and the launch file.
Many thanks, Jorge
EDIT: I load all the parameters for the motors with
<rosparam file="$(find hexapodo_control)/config/hexapodo_control.yaml" command="load"/>
This is the yaml file:
hexapodo:
# Publish all joint states -----------------------------------
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50
# Velocity Controllers ---------------------------------------
pata1_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_1_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
pata2_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_2_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
pata3_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_3_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
pata4_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_4_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
pata5_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_5_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
pata6_velocity_controller:
type: velocity_controllers/JointVelocityController
joint: motor_6_to_base_link_joint
pid: {p: 3.0, i: 0.0, d: 0.0}
required_drive_mode: 3
So, with this in the launch:
<!-- load the controllers -->
<node name="controller"
pkg="controller_manager"
type="controller_manager"
respawn="false"
output="screen"
ns="hexapodo"
args="spawn
joint_state_controller
pata1_velocity_controller
pata2_velocity_controller
pata3_velocity_controller
pata4_velocity_controller
pata5_velocity_controller
pata6_velocity_controller"/>
When I launch it, this is what I have with rostopic list:
jorge@jorge-ubuntu:~$ rostopic list
/joint_states
/rosout
/rosout_agg
/tf
/tf_static
With rosnode list:
/joint_state_publisher
/robot_state_publisher
/rosout
With rosservice list:
/joint_state_publisher/get_loggers
/joint_state_publisher/set_logger_level
/robot_state_publisher/get_loggers
/robot_state_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level
And with rosparam list:
jorge@jorge-ubuntu:~$ rosparam list
/hexapodo/joint_state_controller/publish_rate
/hexapodo/joint_state_controller/type
/hexapodo/pata1_velocity_controller/joint
/hexapodo/pata1_velocity_controller/pid/d
/hexapodo/pata1_velocity_controller/pid/i
/hexapodo/pata1_velocity_controller/pid/p
/hexapodo/pata1_velocity_controller/required_drive_mode
/hexapodo/pata1_velocity_controller/type
/hexapodo/pata2_velocity_controller/joint
/hexapodo/pata2_velocity_controller/pid/d
/hexapodo/pata2_velocity_controller/pid/i
/hexapodo/pata2_velocity_controller/pid/p
/hexapodo/pata2_velocity_controller/required_drive_mode
/hexapodo/pata2_velocity_controller/type
/hexapodo/pata3_velocity_controller/joint
/hexapodo/pata3_velocity_controller/pid/d
/hexapodo/pata3_velocity_controller/pid/i
/hexapodo/pata3_velocity_controller/pid/p
/hexapodo/pata3_velocity_controller/required_drive_mode
/hexapodo/pata3_velocity_controller/type
/hexapodo/pata4_velocity_controller/joint
/hexapodo/pata4_velocity_controller/pid/d
/hexapodo/pata4_velocity_controller/pid/i
/hexapodo/pata4_velocity_controller/pid/p
/hexapodo/pata4_velocity_controller/required_drive_mode
/hexapodo/pata4_velocity_controller/type
/hexapodo/pata5_velocity_controller/joint
/hexapodo/pata5_velocity_controller/pid/d
/hexapodo/pata5_velocity_controller/pid/i
/hexapodo/pata5_velocity_controller/pid/p
/hexapodo/pata5_velocity_controller/required_drive_mode
/hexapodo/pata5_velocity_controller/type
/hexapodo/pata6_velocity_controller/joint
/hexapodo/pata6_velocity_controller/pid/d
/hexapodo/pata6_velocity_controller/pid/i
/hexapodo/pata6_velocity_controller/pid/p
/hexapodo/pata6_velocity_controller/required_drive_mode
/hexapodo/pata6_velocity_controller/type
/robot_description
/rosdistro
/roslaunch/uris/host_jorge_ubuntu__44501
/rosversion
/run_id
There is nothing loaded about the controller_manager
Asked by jdeleon on 2018-06-05 06:30:57 UTC
Answers
Did you load .yaml file into param server?Something like this
<rosparam file="$(find robot)/config/robot.yaml" command="load"/>
And make sure that namespace arg is correct in your launch file.
<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
output="screen" ns="/robot_name" args="controller1 controller2 ">
Asked by ARB on 2018-06-05 06:57:05 UTC
Comments
yes, I load the yaml into the param server,
<rosparam file="$(find hexapodo_control)/config/hexapodo_control.yaml" command="load"/>
And if I use
rosparam list
I can see all the parameters for the motors configuration
Asked by jdeleon on 2018-06-05 07:22:01 UTC
[https://answers.ros.org/question/214712/gazebo-controller-spawner-warning/]
Did u check this? especially garebo_ros_control plugin in urdf?
Asked by ARB on 2018-06-05 08:28:39 UTC
Hi @ARB, as I comment to @akosodry, I was confused about how to configure ROS CANopen.
If I modify my URDF to be launched with Gazebo, I can launch correctly the controllers.
Asked by jdeleon on 2018-06-07 01:37:20 UTC
Comments
Hello. Can you share the github page of the project to check the files? Thnks in advance.
Asked by akosodry on 2018-06-06 10:57:27 UTC
Hi @akosodry, thank you for your reply. I have working now correctly the controllers. I was confused about how to configure ros canopen.
Ros CANopen only need the URDF file of the robot, not the controllers that normally you define for the Gazebo simulation.
Asked by jdeleon on 2018-06-07 01:35:23 UTC
If I put on my URDF
And then launch the controller_manager, it works correctly.
Asked by jdeleon on 2018-06-07 01:36:00 UTC
Okey, very good!
Asked by akosodry on 2018-06-07 01:58:33 UTC
Hi jdeleon, I am facing similar problems as you've seem to have solved, I would very much appreciate if you could take a glance on my setup in my question and see if you could lend a helpin hand, thank you
Asked by rhas on 2019-01-25 03:41:52 UTC
Hello there @jdeleon, have you solved the issue? I am currently facing the same error.
Asked by martinlucan on 2021-07-02 08:17:31 UTC
It will be better if you start a new question. It is not a good idea (according to the ros answers guideline) to use the answer section as comments !
Asked by pmuthu2s on 2021-07-02 08:44:00 UTC