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,
])
Originally posted by gurselturkeri on ROS Answers with karma: 25 on 2023-02-22
Post score: 2
Original comments
Comment by Ranjit Kathiriya on 2023-02-22:
Hello,
You need to install controller manager, you can do so by executing below command in your terminal.
sudo apt-get install ros-<Your-Distro>-controller-manager
Comment by gurselturkeri on 2023-02-22:
I have already installed this package.
Comment by Ranjit Kathiriya on 2023-02-22:
Can you please, try running this command and share the output in the comment?
gazebo --verbose -s libgazebo_ros_factory.so
Comment by gurselturkeri on 2023-02-22:
Gazebo multi-robot simulator, version 11.11.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
[Msg] Waiting for master.
Gazebo multi-robot simulator, version 11.11.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org
[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.224
[Msg] Loading world file [/usr/share/gazebo-11/worlds/empty.world]
[INFO] [1677072233.288940555] [gazebo_ros_node]: ROS was initialized without arguments.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.1.224
Comment by gurselturkeri on 2023-02-22:
[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.
Comment by Ranjit Kathiriya on 2023-02-22:
try to install
sudo apt-get install ros--gazebo-ros
Comment by gurselturkeri on 2023-02-22:
already installed.
Comment by Ranjit Kathiriya on 2023-02-23:
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 ).
Comment by Ranjit Kathiriya on 2023-02-23:
please, share urdf and yaml file. and provide as much detail you can so to give proper answer.
Comment by Ranjit Kathiriya on 2023-02-24:\
gazebo --verbose -s libgazebo_ros_factory.so
are you able to open the gazebo?
sudo apt-get install ros-foxy-robot-state-publisher
did you install robot state publisher?
Comment by nihalar on 2023-02-28:
I have this same error, any fix?
Comment by gurselturkeri on 2023-02-28:
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.
Comment by nihalar on 2023-02-28:
Changing what in launch file?
Comment by gurselturkeri on 2023-02-28:
I have updated in question.