r/ROS • • May 29 '26

Question Position controller not loading in ROS 2 lyrical

I'm new to ros and I've been trying to do a gripper type thing in Ros2 lyrical version and trying to visualize it in gazebo.

I've made an URDF, yaml, launch file and everything. and ran "colcon build" and set source and ran the launch file. and the bot is loading properly in gazebo, but when i tried running the command "ros2 control list_controllers" it's only showing the "joint_state_broadcaster" and not showing the "position_controller". even when i try loading it manually its failing to load. I'm stuck in a loop for a while with this chat gpt T.T .

can someone tell what can be the issue, these are the files

URDF file,

<?xml version="1.0"?>




<robot name="gripper1">


    <gazebo>
        <plugin
            filename="/opt/ros/lyrical/lib/libgz_ros2_control-system.so"
            name="gz_ros2_control::GazeboSimROS2ControlPlugin">


            <parameters>
                /home/.../Desktop/ros2p/clg/src/clg/config/controllers.yaml
            </parameters>


        </plugin>
    </gazebo>


    <ros2_control name="GazeboSimSystem" type="system">


        <hardware>
            <plugin>gz_ros2_control/GazeboSimSystem</plugin>
        </hardware>


        <joint name="jointb1">


            <command_interface name="position"/>


            <state_interface name="position"/>
            <state_interface name="velocity"/>


        </joint>


    </ros2_control>

 <-- joints and links here -->


</robot>

.yaml file,

controller_manager:
  ros__parameters:
    update_rate: 100


    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster


    position_controller:
      type: forward_command_controller/ForwardCommandController


position_controller:
  ros__parameters:
    joints:
      - jointb1


    interface_names:
      - position

setup file,

from setuptools import find_packages, setup
from glob import glob


package_name = 'clg'


setup(
    name=package_name,
    version='0.0.0',
    packages=find_packages(exclude=['test']),
    data_files=[
        ('share/clg/launch', glob('launch/*.py')),
        ('share/clg/model', glob('model/*')),
        ('share/clg/config', glob('config/*')),
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
    ],
    package_data={'': ['py.typed']},
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer='kkb007x',
    maintainer_email='kkb007x@todo.todo',
    description='TODO: Package description',
    license='TODO: License declaration',
    extras_require={
        'test': [
            'pytest',
        ],
    },
    entry_points={
        'console_scripts': [
        ],
    },
)

launch file,

from launch import LaunchDescription


from launch.actions import ExecuteProcess


from launch_ros.actions import Node


from launch.substitutions import Command


from ament_index_python.packages import get_package_share_directory


from launch.actions import TimerAction


import os




def generate_launch_description():


    pkg_path = get_package_share_directory('clg')


    urdf_path = os.path.join(pkg_path, 'model', 'clg.urdf')


    controller_path = os.path.join(pkg_path, 'config', 'controllers.yaml')




    robot_description = Command(['cat ', urdf_path])




    robot_state_publisher = Node(
        package='robot_state_publisher',
        executable='robot_state_publisher',
        parameters=[{
            'robot_description': robot_description
        }]
    )




    gazebo = ExecuteProcess(
        cmd=['gz', 'sim', '-r'],
        output='screen'
    )




    spawn_robot = Node(
        package='ros_gz_sim',
        executable='create',
        arguments=[
            '-topic', 'robot_description',
            '-name', 'gripper1'
        ],
        output='screen'
    )



    joint_state_broadcaster = TimerAction(
        period=5.0,
        actions=[
            ExecuteProcess(
                cmd=[
                    'ros2', 'control', 'load_controller',
                    '--set-state', 'active',
                    'joint_state_broadcaster'
                ],
                output='screen'
            )
        ]
    )


    position_controller = TimerAction(
        period=8.0,
        actions=[
            ExecuteProcess(
                cmd=[
                    'ros2', 'control', 'load_controller',
                    '--set-state', 'active',
                    'position_controller'
                ],
                output='screen'
            )
        ]
    )



    return LaunchDescription([
        robot_state_publisher,
        gazebo,
        spawn_robot,
        joint_state_broadcaster,
        position_controller
    ])
1 Upvotes

6 comments sorted by

2

u/HoffnungPrevails May 31 '26

If you're a beginner, use jazzy. Lyrical was just released, there are many packages for it still missing including MoveIt and nav2.

2

u/Ok_Memory3663 Jun 11 '26

yeah, thats what i did, it's working fine here.

1

u/Rob0tSheep May 29 '26

As far as I know, there isn't a corresponding Gazebo version of ROS 2 lyrical yet, but it will be released soon.

1

u/Ok_Memory3663 May 29 '26

Oh I see, do u have know when it'll be released?

1

u/Rob0tSheep May 29 '26

Sorry, I don't know either, but someone is indeed working on software adaptation

2

u/Ok_Memory3663 May 29 '26

But here in this page they've mentioned that Gazebo sim 10(jetty) is compatible with ros 2 lyrical. jetty