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

ROS2 humble, controller wont connect to service

asked 2023-02-19 04:58:42 -0600

Anis_Shakkour gravatar image

Hello, Running ROS2 humble, Ubuntu 22.04.1LTS.

I have a model which is spawned in gazebo 11, and another node which is publishing data on '/forward_position_controller/commands', and the model is supposed to movie in space.

My problem is running the controller.

I have a yaml:

controller_manager:
 ros__parameters:
  update_rate: 100

  joint_trajectory_controller:
    type: joint_trajectory_controller/JointTrajectoryController

  #broadcaste the state
  joint_state_broadcaster:
    type: joint_state_broadcaster/JointStateBroadcaster

  #joint_trajectory_controller:
  #  type: joint_trajectory_controller/JointTrajectoryController

  forward_position_controller:
    type: forward_command_controller/ForwardCommandController
  forward_vilocity_controller:
    type: forward_command_controller/ForwardCommandController


forward_position_controller:
  ros__parameters:
   joints:
    - crutch_joint__imu_position #joint the controller will control
   interface_name: position       #same name as defined in the sdf/urdf file
   command_interfaces:
     - position                   # 
  state_interfaces:
    - position
    - velocity

forward_vilocity_controller:
  ros__parameters:
   joints:
    - crutch_joint__imu_position
    interface_name: velocity
    command_interfaces:
     - velocity
   state_interfaces:
    - velocity

and in my launch I run the controller

     ExecuteProcess(
        cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', "forward_position_controller"],
        name="forward_position_controller",
        output='screen'),

    #Start controller
    ExecuteProcess(
        cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', "forward_velocity_controller"],
        name="forward_velocity_controller",
        output='screen'),

but I always get the same error: "Could not contact service /controller_manager/load_controller"

A friend of mine running ros2 galactic is having the same issue Another friend is running ros1 and having similar issue. (its done little bit different but same error)

Is there any other way to move a model which is spawned in gazebo11 from a node that publishes data, any data. All i need for now is just to move the model....

BR, Anis

edit retag flag offensive close merge delete

Comments

Not (necessarily) the cause, but just wanted to draw attention to the forward_vilocity_controller vs forward_velocity_controller ..

gvdhoorn gravatar image gvdhoorn  ( 2023-02-19 11:15:50 -0600 )edit

Yeah I noticed it, but not fixing the problem.

Anis_Shakkour gravatar image Anis_Shakkour  ( 2023-02-20 08:19:06 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-02-20 13:15:35 -0600

Sam_Prt gravatar image

Hello, You need to add the controller_manager node to your launch file to be able to load controllers. Also, you will not need to load the controllers manually with the ExecuteProcess command. However, you will need your robots URDF to be able to launch the ros2_control hardware components. You can replace your ExecuteProcess with this :

Node(
    package="controller_manager",
    executable="ros2_control_node",
    parameters=[<your_robots_urdf>, <your_controllers_yaml_file_path>]
)
edit flag offensive delete link more

Question Tools

Stats

Asked: 2023-02-19 04:58:42 -0600

Seen: 2,801 times

Last updated: Feb 20 '23