0
$\begingroup$

currently I am working on visualizing a drone in Gazebo. My base is the sjtu_drone. I am trying to control the propellers of my drone with ros2_control but when i start the ros2 controller manager the terminal says "Controller manager not available" after checking the node list. It appears a node named "simple_drone/controller_manager". How can I fix the issue that the controller manager starts in simple_drone?

Error in Terminal:

[gzserver-4] [INFO] [1710412893.630305338] [simple_drone.controller_manager]: Loading controller 'joint_state_broadcaster'
[gzserver-4] [INFO] [1710412893.662219724] [simple_drone.controller_manager]: Configuring controller 'joint_state_broadcaster'
[gzserver-4] [INFO] [1710412893.662911110] [simple_drone.joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
[gzserver-4] [INFO] [1710412893.840692078] [simple_drone.controller_manager]: Loading controller 'rotor_controller'
[gzserver-4] [INFO] [1710412894.056333002] [simple_drone.controller_manager]: Configuring controller 'rotor_controller'
[gzserver-4] [ERROR] [1710412894.056406458] [simple_drone.rotor_controller]: 'joints' parameter was empty
[gzserver-4] [WARN] [1710412894.056439109] [simple_drone.rotor_controller]: Error occurred while doing error handling.
[gzserver-4] [ERROR] [1710412894.056459593] [simple_drone.controller_manager]: After configuring, controller 'rotor_controller' is in state 'unconfigured' , expected inactive.

My Controller yaml-File:

simple_drone/controller_manager:
  ros__parameters:
    update_rate: 10
    use_sim_time: true

    rotor_controller:
      type: velocity_controllers/JointGroupVelocityController

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

rotor_controller:
  ros__parameters:
    joints:
      - rotation1
      - rotation2
      - rotation3
      - rotation4

My controller.launch.py


def generate_launch_description():

    robot_description = ParameterValue(
        Command(
        [
            "xacro ",
            os.path.join(get_package_share_directory("drone_description"), "urdf", "drone.urdf.xacro")
        ]
        ),
        value_type=str
    )

    robot_state_publisher = Node(
        package="robot_state_publisher",
        executable="robot_state_publisher",
        parameters=[{"robot_description": robot_description}]
    )

    joint_state_broadcaster_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=[
            "joint_state_broadcaster",
            "--controller-manager",
            "simple_drone/controller_manager"
        ]
    )

    rotor_controller_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=[
            "rotor_controller",
            "--controller-manager",
            "simple_drone/controller_manager"
        ]
    )

    return LaunchDescription([
        robot_state_publisher,
        joint_state_broadcaster_spawner,
        rotor_controller_spawner
    ])

My URDF.xacro: (only the transmission tag and gazebo tag)

<xacro:macro name="rotor1_transmission">
    <transmission name="rotation1_tran">
        <plugin>transmission_interface/SimpleTransmission</plugin>
        <actuator name="rotation1_motor" role="actuator1"/>
        <joint name="rotation1" role="joint1">
            <mechanical_reduction>1.0</mechanical_reduction>
        </joint>
    </transmission>
</xacro:macro>

<xacro:macro name="rotor2_transmission">
    <transmission name="rotation2_tran">
        <plugin>transmission_interface/SimpleTransmission</plugin>
        <actuator name="rotation2_motor" role="actuator2"/>
        <joint name="rotation2" role="joint2">
            <mechanical_reduction>1.0</mechanical_reduction>
        </joint>
    </transmission>
</xacro:macro>

...

<gazebo>
    <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
      <robot_param>robot_description</robot_param>
      <robot_param_node>robot_state_publisher</robot_param_node>
      <parameters>$(find drone_bringup)/config/rotor_controller.yaml</parameters>
    </plugin>
</gazebo>

```
$\endgroup$
4
  • $\begingroup$ try to run your nodes with --debug and also pin the output of ros2 topic list, it will be easier to solve the problem. $\endgroup$
    – Jakub Ivan
    Commented Mar 13 at 12:53
  • $\begingroup$ Link to topic list: drive.google.com/file/d/1dFyRbAd4Y_l4vUfKl4pxCoGxQjWYSGDj/… $\endgroup$
    – lukaz55
    Commented Mar 13 at 13:01
  • $\begingroup$ please don't upload pictures of your console output. Better add it as formatted text to your question. $\endgroup$ Commented Mar 13 at 14:03
  • $\begingroup$ Hi and welcome. Please paste any code or console output as code formatted text and not as a screenshot. Screenshots are not text searchable, amongst other things... it also makes it difficult to copy/paste. Also, any additional information should be put in the answer and not in the comments. Comments are ephemeral in nature and tends to get deleted. $\endgroup$ Commented Mar 13 at 14:12

1 Answer 1

0
$\begingroup$

According to your console output, you have set a namespace. This is why the node name also includes your namespace.

You don't have to manually start a controller_manager: gazebo_ros2_control already creates one (see your console output).

$\endgroup$
17
  • $\begingroup$ Okay, but when I run the command "ros2 run controller_manager spawner velocity_controller" it says: "waiting for controller_manager node to exist" and then "Controller manager not available" $\endgroup$
    – lukaz55
    Commented Mar 13 at 15:18
  • $\begingroup$ yes, because you have set the namespace as I said above. Remove it or set the same namespace for the spawner. $\endgroup$ Commented Mar 13 at 16:44
  • $\begingroup$ okay thank you very much! Now I've come to another error. I have set the update_rate for the controller_manager in my yaml file. However, the error message appears in the terminal saying that I did not set this update_rate. $\endgroup$
    – lukaz55
    Commented Mar 13 at 17:32
  • $\begingroup$ please add the relevant code of your yaml file, otherwise it is hard to tell. You can also use rqt_dynamic_reconfigure (or ros2cli) to check if you really have set the parameter. $\endgroup$ Commented Mar 13 at 18:06
  • $\begingroup$ i have added the yaml File to my main question $\endgroup$
    – lukaz55
    Commented Mar 13 at 18:19

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.