0
$\begingroup$

when I run one of my launch files that calls this launch file I got this error:

[spawner-7] [INFO] [1715563423.016316240] [controller_spawner]: Waiting for '/controller_manager' services to be available
[spawner-6] [ERROR] [1715563424.992640859] [controller_spawner]: Controller manager not available
[spawner-7] [ERROR] [1715563425.022922823] [controller_spawner]: Controller manager not available
[ERROR] [spawner-6]: process has died [pid 18581, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_controller --controller-manager /controller_manager --ros-args -r __node:=controller_spawner --params-file /root/ROS2Activities/workspace/challenge3_ws/install/puzzlebot_control/share/puzzlebot_control/config/puzzlebot_joint_states.yaml'].
[ERROR] [spawner-7]: process has died [pid 18583, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner base_controller --controller-manager /controller_manager --ros-args -r __node:=controller_spawner --params-file /root/ROS2Activities/workspace/challenge3_ws/install/puzzlebot_control/share/puzzlebot_control/config/puzzlebot_diff_control.yaml'].

This is my launch file where I put the spawner node:

import os
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
from launch_ros.actions import Node, LoadComposableNodes
from launch_ros.descriptions import ComposableNode
from ament_index_python.packages import get_package_share_directory

def generate_launch_description():
    # Definir los argumentos de lanzamiento
    declare_robot_arg = DeclareLaunchArgument(
        'robot', default_value='puzzlebot',
        description='Name of the robot')

    # config = os.path.join(
    #   get_package_share_directory('puzzlebot_control'),
    #   'config',
    #   'puzzlebot_joint_states.yaml'
    #   )
    # config2 = os.path.join(
    #   get_package_share_directory('puzzlebot_control'),
    #   'config',
    #   'puzzlebot_diff_control.yaml'
    #   )

    controller_manager_node = Node(
        package='controller_manager',
        executable='ros2_control_node',
        output='screen'
    )

    # Spawn controller manager
    controller_spawner_joint_state = Node(
        package='controller_manager',
        executable='spawner',
        name='controller_spawner',
        arguments=['joint_state_controller', '--controller-manager', "/controller_manager"],
        output='screen',
        parameters=[
                PathJoinSubstitution([FindPackageShare('puzzlebot_control'), 'config', 'puzzlebot_joint_states.yaml'])
                ]
    )

    controller_spawner_base_control = Node(
        package='controller_manager',
        executable='spawner',
        name='controller_spawner',
        arguments=["base_controller", "--controller-manager", "/controller_manager"],
        output='screen',
        parameters=[
                PathJoinSubstitution([FindPackageShare('puzzlebot_control'), 'config', 'puzzlebot_diff_control.yaml']),
                ]
    )

    # Puzzlebot wheel velocity node
    wheel_vel_node = Node(
        package='puzzlebot_control',
        executable='wheel_Vel',
        name='wheel_vel'
    )

    # Return the launch description
    return LaunchDescription([
        # declare_robot_arg,
        controller_manager_node,
        controller_spawner_joint_state,
        controller_spawner_base_control,
        wheel_vel_node
    ])

When I run ros2 service list I see the controller_manager services.

If I try to run a demo I got this:

root@39c6352512cd:~/ROS2Activities/workspace/challenge3_ws# ros2 launch gazebo_ros2_control_demos cart_example_position.launch.py 
[INFO] [launch]: All log files can be found below /root/.ros/log/2024-05-13-22-16-53-603921-39c6352512cd-22982
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [gzserver-1]: process started with pid [22983]
[INFO] [gzclient-2]: process started with pid [22985]
[INFO] [robot_state_publisher-3]: process started with pid [22987]
[INFO] [spawn_entity.py-4]: process started with pid [22989]
[robot_state_publisher-3] [INFO] [1715638614.022779669] [robot_state_publisher]: got segment cart
[robot_state_publisher-3] [INFO] [1715638614.022856259] [robot_state_publisher]: got segment slideBar
[robot_state_publisher-3] [INFO] [1715638614.022861125] [robot_state_publisher]: got segment world
[spawn_entity.py-4] [INFO] [1715638614.131374087] [spawn_entity]: Spawn Entity started
[spawn_entity.py-4] [INFO] [1715638614.131624020] [spawn_entity]: Loading entity published on topic robot_description
[spawn_entity.py-4] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead.
[spawn_entity.py-4]   warnings.warn(
[spawn_entity.py-4] [INFO] [1715638614.132626040] [spawn_entity]: Waiting for entity xml on robot_description
[spawn_entity.py-4] [INFO] [1715638614.143451239] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
[spawn_entity.py-4] [INFO] [1715638614.143659700] [spawn_entity]: Waiting for service /spawn_entity
[spawn_entity.py-4] [ERROR] [1715638644.201204370] [spawn_entity]: Service %s/spawn_entity unavailable. Was Gazebo started with GazeboRosFactory?
[spawn_entity.py-4] [ERROR] [1715638644.202224074] [spawn_entity]: Spawn service failed. Exiting.
[ERROR] [spawn_entity.py-4]: process has died [pid 22989, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -topic robot_description -entity cart --ros-args'].
[INFO] [ros2-5]: process started with pid [23392]
[ros2-5] Could not contact service /controller_manager/load_controller
[ERROR] [ros2-5]: process has died [pid 23392, exit code 1, cmd 'ros2 control load_controller --set-state active joint_state_broadcaster'].
[INFO] [ros2-6]: process started with pid [23488]
[ros2-6] Could not contact service /controller_manager/load_controller
[ERROR] [ros2-6]: process has died [pid 23488, exit code 1, cmd 'ros2 control load_controller --set-state active joint_trajectory_controller'].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[robot_state_publisher-3] [INFO] [1715638716.620805412] [rclcpp]: signal_handler(signum=2)
[gzserver-1] [INFO] [1715638716.621410081] [rclcpp]: signal_handler(signum=2)
[ERROR] [gzclient-2]: process has died [pid 22985, exit code -2, cmd 'gzclient'].
[INFO] [robot_state_publisher-3]: process has finished cleanly [pid 22987]
[ERROR] [gzserver-1]: process[gzserver-1] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [gzserver-1]: sending signal 'SIGTERM' to process[gzserver-1]
[gzserver-1] [INFO] [1715638721.635109716] [rclcpp]: signal_handler(signum=15)
[ERROR] [gzserver-1]: process[gzserver-1] failed to terminate '10.0' seconds after receiving 'SIGTERM', escalating to 'SIGKILL'
[INFO] [gzserver-1]: sending signal 'SIGKILL' to process[gzserver-1]
[ERROR] [gzserver-1]: process has died [pid 22983, exit code -9, cmd 'gzserver -slibgazebo_ros_init.so -slibgazebo_ros_factory.so -slibgazebo_ros_force_system.so'].
$\endgroup$
3
  • 1
    $\begingroup$ Can you launch the demos from gazebo_ros2_control_demos successfully? If yes, please post the complete console output. Something went wrong before the spawner reports that it can't find the service. $\endgroup$ Commented May 13 at 10:26
  • $\begingroup$ I tried to run one of the demos but I got an error, I put it in the main question $\endgroup$ Commented May 13 at 22:19
  • $\begingroup$ Here is the link to the project, the launch file I am running is Puzzlebot_gazebo but it calls others launch file, the launch file with the controller is in puzzlebot_control github.com/Antonioleon13/ROS2Activities/tree/main/workspace/… $\endgroup$ Commented May 14 at 1:38

1 Answer 1

0
$\begingroup$

If the demos did not launch then there is no need to have a look at your project.

But there is no need to launch a ros2_control_node if you use gazebo_ros2_control, which starts an instance of controller_manager by itself. See example_9 or any of the gazebo_ros2_control_demos how to do this.

But first you have to get the demos running. Have you installed gazebo_ros2_control correctly? There is not a single output from it in your last console log (please include the command which you have started).

  • Run rosdep
  • see what ros2 pkg xml gazebo_ros2_control -t version gives you
$\endgroup$

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.