ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to activate controller in ROS2 Control with Gazebo

asked 2022-11-11 09:58:50 -0600

updated 2022-11-11 14:49:59 -0600

I am trying to build a very simple simulated robot with one joint and I want to control is using ROS2 control. Based on the code from ros2 control, I created a small repo with the simple robot.

When I try to start the controller with:

ros2 control load_controller joint_trajectory_controller
ros2 control set_controller_state joint_trajectory_controller inactive
ros2 control set_controller_state joint_trajectory_controller active

I get the error message: [ign gazebo-1] [ERROR] [1668181548.332225200] [controller_manager]: Can't activate controller 'joint_trajectory_controller': Command interface with 'the_joint/position' does not exist

When I type: ros2 control list_hardware_interfaces I get the following output:

command interfaces
        the_joint/position [unavailable] [unclaimed]
state interfaces
        the_joint/effort
        the_joint/position
        the_joint/velocity

How can I make the interface available, claim it, and activate it?

Ps. The whole output is

[INFO] [launch]: All log files can be found below /home/ros/.ros/log/2022-11-11-16-45-11-944006-NB20200198-1586
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ign gazebo-1]: process started with pid [1587]
[INFO] [robot_state_publisher-2]: process started with pid [1590]
[INFO] [create-3]: process started with pid [1592]
[robot_state_publisher-2] Link robot_base had 1 children
[robot_state_publisher-2] Link robot_arm had 0 children
[robot_state_publisher-2] [INFO] [1668181512.131834800] [robot_state_publisher]: got segment base_link
[robot_state_publisher-2] [INFO] [1668181512.132055300] [robot_state_publisher]: got segment robot_arm
[robot_state_publisher-2] [INFO] [1668181512.132070900] [robot_state_publisher]: got segment robot_base
[ign gazebo-1] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ros'
[create-3] [INFO] [1668181512.449957400] [ros_gz_sim]: Requesting list of world names.
[create-3] [INFO] [1668181512.720797300] [ros_gz_sim]: Waiting messages on topic [/robot_description].
[create-3] [INFO] [1668181512.821121700] [ros_gz_sim]: Requested creation of entity.
[create-3] [INFO] [1668181512.821182500] [ros_gz_sim]: OK creation of entity.
[INFO] [create-3]: process has finished cleanly [pid 1592]
[ign gazebo-1] [INFO] [1668181513.322262100] [ignition_ros_control]: connected to service!! robot_state_publisher asking for robot_description
[ign gazebo-1] [INFO] [1668181513.323385800] [ignition_ros_control]: Received URDF from param server
[ign gazebo-1] [INFO] [1668181513.329669800] [ignition_ros_control]: Loading joint: the_joint
[ign gazebo-1] [INFO] [1668181513.329722600] [ignition_ros_control]:    State:
[ign gazebo-1] [INFO] [1668181513.329737500] [ignition_ros_control]:             position
[ign gazebo-1] [INFO] [1668181513.329790900] [ignition_ros_control]:             velocity
[ign gazebo-1] [INFO] [1668181513.329819100] [ignition_ros_control]:             effort
[ign gazebo-1] [INFO] [1668181513.329834900] [ignition_ros_control]:    Command:
[ign gazebo-1] [INFO] [1668181513.329841600] [ignition_ros_control]:             position
[ign gazebo-1] [INFO] [1668181513.330471100] [resource_manager]: Initialize hardware 'IgnitionSystem'
[ign gazebo-1] [WARN] [1668181513.330483800] [ignition_ros_control]: On init...
[ign gazebo-1] [INFO] [1668181513.330689500] [resource_manager]: Successful initialization of hardware 'IgnitionSystem'
[ign gazebo-1] [INFO] [1668181513.330745500] [ignition_ros_control]: Loading controller_manager
[ign gazebo-1] [INFO] [1668181526.116253500] [controller_manager]: Loading controller 'joint_trajectory_controller'
[ign gazebo-1] [INFO] [1668181526.136404400] [joint_trajectory_controller.interpolation_methods]: No interpolation method parameter was given. Using the default, VARIABLE_DEGREE_SPLINE.
[ign gazebo-1] [INFO] [1668181537.188835300] [controller_manager]: Configuring controller 'joint_trajectory_controller'
[ign gazebo-1] [INFO] [1668181537.189276100] [joint_trajectory_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
[ign gazebo-1] [INFO] [1668181537.189357500] [joint_trajectory_controller]: Command interfaces are [position] and state interfaces are [position velocity].
[ign gazebo-1] [INFO] [1668181537.189409100] [joint_trajectory_controller.interpolation_methods]: No interpolation method parameter was given. Using the default, VARIABLE_DEGREE_SPLINE.
[ign gazebo-1] [INFO] [1668181537.189417600] [joint_trajectory_controller]: Using 'splines' interpolation method.
[ign gazebo-1] [INFO] [1668181537.193457700] [joint_trajectory_controller]: Controller state will be published at 50.00 Hz.
[ign gazebo-1] [INFO] [1668181537.198800800] [joint_trajectory_controller]: Action status changes will be monitored at 20.00 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-11-27 14:45:43 -0600

Hey, I looked at your config .yaml file.

I don't know if you tried to delete the quotes on "joint_trajectory_controller/JointTrajectoryController":

controller_manager: ros__parameters: update_rate: 1000 # Hz

joint_trajectory_controller:
  type: joint_trajectory_controller/JointTrajectoryController


joint_state_broadcaster:
  type: joint_state_broadcaster/JointStateBroadcaster
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2022-11-11 09:58:50 -0600

Seen: 2,012 times

Last updated: Nov 11 '22