Controller manager not available in ROS2
I can visualize my robot on gazebo but I get an error when launch file is starting like below. How can I fix that?
Error:
[spawn_entity.py-2] [INFO] [1677146674.436718834] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-2] [INFO] [1677146674.546574796] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [robotic_arm]
[spawn_entity.py-2] [INFO] [1677146674.546986992] [spawn_entity]: Waiting for shutdown to delete entity [robotic_arm]
[spawner.py-5] [INFO] [1677146675.487867687] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-6] [INFO] [1677146675.520714798] [spawner_joint_trajectory_controller]: Waiting for /controller_manager services
[spawner.py-5] [INFO] [1677146677.503342629] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-6] [INFO] [1677146677.535238788] [spawner_joint_trajectory_controller]: Waiting for /controller_manager services
[spawner.py-5] [INFO] [1677146679.521864875] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-6] [INFO] [1677146679.554316012] [spawner_joint_trajectory_controller]: Waiting for /controller_manager services
[spawner.py-5] [INFO] [1677146681.537992430] [spawner_joint_state_broadcaster]: Waiting for /controller_manager services
[spawner.py-6] [INFO] [1677146681.572181275] [spawner_joint_trajectory_controller]: Waiting for /controller_manager services
[spawner.py-5] [ERROR] [1677146683.557500368] [spawner_joint_state_broadcaster]: Controller manager not available
[spawner.py-6] [ERROR] [1677146683.591099846] [spawner_joint_trajectory_controller]: Controller manager not available
[ERROR] [spawner.py-5]: process has died [pid 18233, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_state_broadcaster --controller-manager /controller_manager --ros-args'].
[ERROR] [spawner.py-6]: process has died [pid 18235, exit code 1, cmd '/opt/ros/foxy/lib/controller_manager/spawner.py joint_trajectory_controller -c /controller_manager --ros-args'].
SOLVED: The problem was ROS2 version and changing in launch file. It works with Ubuntu 22.04 Humble and you should install all control package such as joint_trajectory_controller, joint_state_broadcaster, controller_manager, joint-state-publisher-gui then edit your launch file.
New Launch File:
from launch import LaunchDescription
from launch.actions import ExecuteProcess, IncludeLaunchDescription, RegisterEventHandler
from launch.event_handlers import OnProcessExit
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import Command, FindExecutable, PathJoinSubstitution
from launch_ros.actions import Node
from launch_ros.substitutions import FindPackageShare
def generate_launch_description():
robot_description_content = Command(
[
PathJoinSubstitution([FindExecutable(name='xacro')]),
' ',
PathJoinSubstitution(
[FindPackageShare(
'robotic_arm'),
'urdf',
'robotic_arm.urdf']
),
]
)
robot_description = {'robot_description': robot_description_content}
node_robot_state_publisher = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
output='screen',
parameters=[robot_description]
)
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[FindPackageShare('gazebo_ros'), '/launch', '/gazebo.launch.py']
),
)
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'joints'],
output='screen')
load_joint_state_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_state_broadcaster'],
output='screen'
)
load_trajectory_controller = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active',
'joint_trajectory_controller'],
output='screen'
)
return LaunchDescription([
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_entity,
on_exit=[load_joint_state_controller],
)
),
RegisterEventHandler(
event_handler=OnProcessExit(
target_action=load_joint_state_controller,
on_exit=[load_trajectory_controller],
)
),
gazebo,
node_robot_state_publisher,
spawn_entity,
])
Hello,
You need to install controller manager, you can do so by executing below command in your terminal.
I have already installed this package.
Can you please, try running this command and share the output in the comment?
Gazebo multi-robot simulator, version 11.11.0 Copyright (C) 2012 Open Source Robotics Foundation. Released under the Apache 2 License. http://gazebosim.org
[Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/gursel/autoware/install/velodyne_description/share/ament_index" [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/gursel/autoware/install/velodyne_description/share/colcon-core" [Err] [InsertModelWidget.cc:403] Missing model.config for model "/home/gursel/autoware/install/velodyne_description/share/velodyne_description" [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call [Wrn] [Publisher.cc:135] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.
try to install
already installed.
That missing model config has no effect on the simulation. Its just saying that some models on the .gazebo folder dont ave that config file ( sometimes because they are packages instead of modl folders ).