Ubuntu 22.04 on VM in VirtualStudio
ROS2, humble distro with Fortress ign gazebo.
Hi! My project revolves around moving the .stl inside gazebo simulation and capturing it with camera sensor. To move the object I have decided to follow the tutorial that can be found on docs.ros.org . During testing second to minimal example (joint_state_broadcaster) on my own package with own files I’ve encountered a problem to which I could not find helpful information on the internet.
[ros2-5] [INFO] [1737119596.442832526] [_ros2cli_5868]: waiting for service /controller_manager/load_controller to become available...
[ros2-5] [WARN] [1737119606.476400577] [_ros2cli_5868]: Could not contact service /controller_manager/load_controller
So, those to messages loop indifinetly. When following the tutorial step by step, there is no problem to open the launch files provided. Below there is tail of urdf file, launch file and plugins inside sdf file. Any help is appreciated Thanks!
<!-- tail of .urdf file, just before the </robot> tag -->
<joint name="X_joint" type="prismatic">
<origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
<parent link="zero_link"/>
<child link="base_link"/>
<limit lower="0.0" upper="1" effort="1" velocity="99990.0"/>
</joint>
<ros2_control name="GazeboSystem" type="system">
<hardware>
<plugin>gazebo_ros2_control/GazeboSystem</plugin>
</hardware>
<joint name="X_joint" />
</ros2_control>
<gazebo>
<plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
<parameters>$(find robot_display)/config/config.yaml</parameters>
</plugin>
</gazebo>
# launch file (libs included, not pasted for clarity)
def generate_launch_description():
package_name = 'robot_display'
urdf_file = '/home/student149202/ros2_ws/src/robot_display/urdf/robot.urdf.xml'
world_file = '/home/student149202/ros2_ws/src/robot_display/worlds/world.sdf'
# Read the URDF file
urdf_content = Path(urdf_file).read_text()
# Node for robot_state_publisher
rsp_node = Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
parameters=[{'robot_description': urdf_content, "use_sim_time": True}],
output='screen'
)
# Launch Ignition Gazebo
gazebo_process = ExecuteProcess(
cmd=['ign', 'gazebo', world_file],
output='screen'
)
# Spawn the robot into Gazebo
spawn_robot_node = Node(
package='ros_ign_gazebo',
executable='create',
arguments=['-name', 'robot', '-file', urdf_file],
output='screen'
)
# Controller manager node (without direct robot_description parameter)
controller_manager_node = Node(
package='controller_manager',
executable='ros2_control_node',
parameters=['/home/student149202/ros2_ws/src/robot_display/config/config.yaml'],
output='screen'
)
# Load the joint_state_broadcaster controller after the robot is spawned
load_joint_state_broadcaster = ExecuteProcess(
cmd=['ros2', 'control', 'load_controller', '--set-state', 'active', 'joint_state_broadcaster'],
output='screen'
)
# Register event handler to load controller after the robot is spawned
register_event_handler = RegisterEventHandler(
event_handler=OnProcessExit(
target_action=spawn_robot_node,
on_exit=[load_joint_state_broadcaster]
)
)
# Return the launch description
return LaunchDescription([
gazebo_process,
rsp_node,
controller_manager_node,
spawn_robot_node,
register_event_handler
])
<!-- .sdf plugins -->
<plugin name='gz::sim::systems::Physics' filename='ignition-gazebo-physics-system'/>
<plugin name='gz::sim::systems::UserCommands' filename='ignition-gazebo-user-commands-system'/>
<plugin name='gz::sim::systems::SceneBroadcaster' filename='ignition-gazebo-scene-broadcaster-system'/>
<plugin name='gz::sim::systems::Contact' filename='ignition-gazebo-contact-system'/>
<plugin name="gz::sim::systems::Sensors" filename="gz-sim-sensors-system" />