0
$\begingroup$

I'm trying to use the controller_manager with ROS2 Humble and Ubuntu 22.04 on a Raspberry Pi 4B. However, it keeps saying that the controller_manager isn't available, even though I've installed all the necessary packages and even have a specific node in one of my launch files! This is the launch output:

[INFO] [launch]: All log files can be found below /home/flamethrower/.ros/log/2024-06-28-18-15-41-358196-robot-14069
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [14070]
[INFO] [ign-2]: process started with pid [14072]
[INFO] [create-3]: process started with pid [14074]
[INFO] [spawner-4]: process started with pid [14076]
[INFO] [spawner-5]: process started with pid [14078]
[create-3] [INFO] [1719591343.162278479] [ros_gz_sim]: Requesting list of world names.
[robot_state_publisher-1] [INFO] [1719591343.391371370] [robot_state_publisher]: got segment FL_wheel
[robot_state_publisher-1] [INFO] [1719591343.394197330] [robot_state_publisher]: got segment FR_wheel
[robot_state_publisher-1] [INFO] [1719591343.394428195] [robot_state_publisher]: got segment RL_wheel
[robot_state_publisher-1] [INFO] [1719591343.394491212] [robot_state_publisher]: got segment RR_wheel
[robot_state_publisher-1] [INFO] [1719591343.394521841] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1719591343.394548785] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1719591343.394575377] [robot_state_publisher]: got segment laser_frame
[create-3] [INFO] [1719591346.146646681] [ros_gz_sim]: Waiting messages on topic [robot_description].
[create-3] [INFO] [1719591346.162705533] [ros_gz_sim]: Requested creation of entity.
[create-3] [INFO] [1719591346.162842697] [ros_gz_sim]: OK creation of entity.
[INFO] [create-3]: process has finished cleanly [pid 14074]
[spawner-5] [INFO] [1719591346.731085882] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719591347.001357568] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-5] [INFO] [1719591348.777891435] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719591349.046915740] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-5] [INFO] [1719591350.818908969] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719591351.087235401] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-5] [INFO] [1719591352.862106541] [spawner_joint_broad]: Waiting for '/controller_manager' node to exist
[spawner-4] [INFO] [1719591353.138235461] [spawner_diff_cont]: Waiting for '/controller_manager' node to exist
[spawner-5] [ERROR] [1719591354.706356026] [spawner_joint_broad]: Controller manager not available
[spawner-4] [ERROR] [1719591354.985065227] [spawner_diff_cont]: Controller manager not available
[ERROR] [spawner-5]: process has died [pid 14078, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_broad --ros-args'].
[ERROR] [spawner-4]: process has died [pid 14076, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner diff_cont --ros-args'].

I've been following the Articulated Robotics tutorials, so my files are quite similar and, in fact, I've seen other users report the same problem with no solution: launch_sim.launch.py (the main launch file):

import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription, ExecuteProcess
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node

def generate_launch_description():
    package_name='robot' #<--- CHANGE ME

    rsp = IncludeLaunchDescription(
                PythonLaunchDescriptionSource([os.path.join(
                    get_package_share_directory(package_name),'launch','rsp.launch.py'
                )]), launch_arguments={'use_sim_time': 'true'}.items()
    )

    gazebo = ExecuteProcess(
        cmd=['ign', 'gazebo', 'empty.sdf'],
        output='screen'
    )

    spawn_entity = Node(package='ros_gz_sim', executable='create',
                        arguments=['-topic', 'robot_description',
                                   '-entity', 'robot'],
                        output='screen')
                        
    controller_manager = Node(
        package='controller_manager',
        executable='ros2_control_node',
        parameters=[{'controller_manager.autoactivate': True}],
    )

    diff_drive_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["diff_cont"],
    )

    joint_broad_spawner = Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_broad"],
    )

    return LaunchDescription([
        rsp,
        gazebo,
        spawn_entity,
        diff_drive_spawner,
        joint_broad_spawner
    ])

rsp.launch.py:

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch_ros.actions import Node

import xacro


def generate_launch_description():

    # Check if we're told to use sim time
    use_sim_time = LaunchConfiguration('use_sim_time')

    # Process the URDF file
    pkg_path = os.path.join(get_package_share_directory('robot'))
    xacro_file = os.path.join(pkg_path,'description','robot.urdf.xacro')
    robot_description_config = xacro.process_file(xacro_file)
    
    # Create a robot_state_publisher node
    params = {'robot_description': robot_description_config.toxml(), 'use_sim_time': use_sim_time}
    node_robot_state_publisher = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        output='screen',
        parameters=[params]
    )


    # Launch!
    return LaunchDescription([
        DeclareLaunchArgument(
            'use_sim_time',
            default_value='false',
            description='Use sim time if true'),

        node_robot_state_publisher
    ])

robot.urdf.xacro:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"  name="robot">

    <xacro:include filename="robot_core.xacro" />
    <xacro:include filename="gazebo_control.xacro"/>
    <xacro:include filename="lidar.xacro"/>

</robot>

gazebo_control.xacro:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">

    <gazebo>
        <plugin filename="libignition-gazebo-diff-drive-system.so" name="ignition::gazebo::systems::DiffDrive">

            <num_wheel_pairs>2</num_wheel_pairs>
            <left_joint>FL_wheel_joint</left_joint>
            <left_joint>RL_wheel_joint</left_joint>
            <right_joint>FR_wheel_joint</right_joint>
            <right_joint>RR_wheel_joint</right_joint>
            
            <max_wheel_torque>200</max_wheel_torque>
            <max_wheel_acceleration>200</max_wheel_acceleration>
            
            <odometry_frame>odom</odometry_frame>
            <robot_base_frame>base_link</robot_base_frame>
            
            <publish_odom>true</publish_odom>
            <publish_odom_tf>true</publish_odom_tf>
            <publish_wheel_tf>true</publish_wheel_tf>

        </plugin>
    </gazebo>


</robot>

ros2_control.xacro (currently I've set it to use gazebo_control.xacro, but the same error persists even if I use this one, it's just that I didn't find the Gazebo Fortress equivalent of the gazebo_ros2_control plugin):

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">


    <ros2_control name="GazeboSystem" type="system">
        <hardware>
            <plugin>gazebo_ros2_control/GazeboSystem</plugin>
        </hardware>
        <joint name="FL_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>
        <joint name="FR_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>
        <joint name="RL_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>
        <joint name="RR_wheel_joint">
            <command_interface name="velocity">
                <param name="min">-10</param>
                <param name="max">10</param>
            </command_interface>
            <state_interface name="velocity"/>
            <state_interface name="position"/>
        </joint>
    </ros2_control>
    
    <gazebo>
        <plugin name="gazebo_ros2_control" filename="libgazebo_ros2_control.so">
            <parameters>$(find robot)/config/my_controllers.yaml</parameters>
        </plugin>
    </gazebo>

</robot>

my_controllers.yaml:

controller_manager:
  ros__parameters:
    update_rate: 30.0
    use_sim_time: true

    diff_cont:
      type: diff_drive_controller/DiffDriveController

    joint_broad:
      type: joint_state_broadcaster/JointStateBroadcaster

diff_cont:
  ros__parameters:

    publish_rate: 50.0

    base_frame_id: base_link

    left_wheel_names: ["FL_wheel_joint", "RL_wheel_joint"]
    right_wheel_names: ["FR_wheel_joint", "RR_wheel_joint"]
    wheel_separation: 0.35
    wheel_radius: 0.05

    use_stamped_vel: false

    # open_loop: false    

    wheels_per_side: 2
    # wheel_separation_multiplier: x
    # left_wheel_radius_multiplier: x
    # right_wheel_radius_multiplier: x

    # odom_frame_id: x
    # pose_covariance_diagonal: x
    # twist_covariance_diagonal: x
    # open_loop: x
    # enable_odom_tf: x

    # cmd_vel_timeout: x
    # publish_limited_velocity: x
    # velocity_rolling_window_size: x
    

    # linear.x.has_velocity_limits: false
    # linear.x.has_acceleration_limits: false
    # linear.x.has_jerk_limits: false
    # linear.x.max_velocity: NAN
    # linear.x.min_velocity: NAN
    # linear.x.max_acceleration: NAN
    # linear.x.min_acceleration: NAN
    # linear.x.max_jerk: NAN
    # linear.x.min_jerk: NAN

    # angular.z.has_velocity_limits: false
    # angular.z.has_acceleration_limits: false
    # angular.z.has_jerk_limits: false
    # angular.z.max_velocity: NAN
    # angular.z.min_velocity: NAN
    # angular.z.max_acceleration: NAN
    # angular.z.min_acceleration: NAN
    # angular.z.max_jerk: NAN
    # angular.z.min_jerk: NAN




# joint_broad:
#   ros__parameters:

gaz_ros2_ctl_use_sim.yaml:

controller_manager:
  ros__parameters:
    use_sim_time: true

Please someone help me, I've switched to Humble thinking that this was a Foxy thing and still the same problem. I also asked a question here when I had Foxy and got no answers. Plus, the parsing error isn't there anymore, so I guess it's not really the same question.

$\endgroup$
1
  • $\begingroup$ Closing this as the comment on the other issue says that it persists. Please edit that question to iterate and refine. The information there is lost when jumping to this new question without providing the context. You can edit it to provide that it's not a distro specific change. And if you make the shortest code necessary to reproduce the problem people can likely help you better. $\endgroup$
    – Tully
    Commented Jun 28 at 17:22

1 Answer 1

0
$\begingroup$

I ran into a similar issue when trying to replicate the ros_control_demo_example_2 (Github Repo).

Turns out my issue was with rosdep. i.e. The dependencies werent properly installed during the installation procedure.

I then ran the following commands:( Having rosdep already installed. If not please install rosdep first using sudo apt-get install python3-rosdep & the proceed to the following commands)

sudo rosdep update --rosdistro=$ROS_DISTRO
sudo apt-get update
sudo rosdep install --from-paths ./ -i -y --rosdistro ${ROS_DISTRO}

and proceeded to build the workspace again and it worked.

You might be having the same issue so please try this and let me know how it goes.

PS:

sudo rosdep update --rosdistro=$ROS_DISTRO

The above command according to ROS documentation is rosdep update --rosdistro=$ROS_DISTRO. But it only worked when I ran this command as root user with sudo. Running this command does throw the following warning in terminal:

Warning: running 'rosdep update' as root is not recommended.
You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.

but I just ignored it and it didn't cause me any problems.

$\endgroup$
3
  • $\begingroup$ Thanks for the response. However, I followed all of that and it didn't seem to make any change; the controller_manager is still not available. $\endgroup$ Commented Jun 28 at 18:21
  • $\begingroup$ Can you try sourcing a new terminal from the terminal itself instead of the bash.rc script and then try running these commands? Could you also let me know if you are getting any stderr while building the package? ex:- stderr: controller manager $\endgroup$
    – RawStone
    Commented Jun 28 at 21:32
  • $\begingroup$ No, no stderr errors. I sourced setup.bash manually and ran all those commands and my launch files, but nothing seems to change from the output... $\endgroup$ Commented Jun 29 at 9:54

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