Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter 'hold_joints' has already been declared, parameter 'hold_joints' has already been declared #304

Open
dogukanyilmazerkba opened this issue Apr 15, 2024 · 6 comments

Comments

@dogukanyilmazerkba
Copy link

Hello, I am trying to export myy RVIZ work to Gazebo. However, whenever I use gezebo_ros2_control packages to control my robot's joints I get these two errors:

[gazebo-5] [ERROR] [1713176577.993734591] [gazebo_ros2_control]: Parameter 'hold_joints' has already been declared, parameter 'hold_joints' has already been declared

and

[gazebo-5] [ERROR] [1713176577.948738083] [control]: No parameter file provided. Configuration might be wrong [gazebo-5] [ERROR] [1713176577.949836711] [control]: failed to parse input yaml file(s)

I dont declare the parameter called hold_joints in my workspace anywhere. How can I solve this?

Terminal Output:

[move_group-4] 
[rviz2-1] [INFO] [1713176577.218711846] [rviz2]: Stereo is NOT SUPPORTED
[rviz2-1] [INFO] [1713176577.218882573] [rviz2]: OpenGl version: 4.1 (GLSL 4.1)
[rviz2-1] [INFO] [1713176577.259423956] [rviz2]: Stereo is NOT SUPPORTED
[gazebo-5] [Msg] Waiting for master.
[gazebo-5] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
[gazebo-5] [Wrn] [GuiIface.cc:120] QStandardPaths: wrong permissions on runtime directory /run/user/1000/, 0755 instead of 0700
[rviz2-1] [WARN] [1713176577.380153789] [rcl.logging_rosout]: Publisher already registered for provided node name. If this is due to multiple nodes with the same name then all logs for that logger name will go out over the existing publisher. As soon as any node with that name is destructed it will unregister the publisher, preventing any further logs for that name from being published on the rosout topic.
[rviz2-1] [INFO] [1713176577.394253318] [rviz2.moveit.ros.rdf_loader]: Loaded robot model in 0.00332607 seconds
[rviz2-1] [INFO] [1713176577.394400337] [rviz2.moveit.core.robot_model]: Loading robot model 'octobot'...
[rviz2-1] [WARN] [1713176577.431329263] [rviz2.moveit.core.robot_model]: Could not identify parent group for end-effector 'end_effector'
[gazebo-5] [INFO] [1713176577.614928610] [gazebo_ros_node]: ROS was initialized without arguments.
[spawn_entity.py-7] [INFO] [1713176577.828025528] [spawn_entity]: Calling service /spawn_entity
[spawn_entity.py-7] [INFO] [1713176577.878388476] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [octobot]
[gazebo-5] 
[gazebo-5] libcurl: (6) Could not resolve host: fuel.ignitionrobotics.org
[gazebo-5] [INFO] [1713176577.931005000] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gazebo-5] [INFO] [1713176577.939734339] [control]: Starting gazebo_ros2_control plugin in namespace: /
[gazebo-5] [INFO] [1713176577.939941110] [control]: Starting gazebo_ros2_control plugin in ros 2 node: control
[gazebo-5] [INFO] [1713176577.948035034] [control]: connected to service!! robot_state_publisher
[gazebo-5] [INFO] [1713176577.948665056] [control]: Received urdf from param server, parsing...
[gazebo-5] [ERROR] [1713176577.948738083] [control]: No parameter file provided. Configuration might be wrong
[gazebo-5] [ERROR] [1713176577.949836711] [control]: failed to parse input yaml file(s)
[gazebo-5] [INFO] [1713176577.950036430] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[rviz2-1] [INFO] [1713176577.961894412] [rviz2.moveit.ros.rdf_loader]: Loaded robot model in 0.00324901 seconds
[rviz2-1] [INFO] [1713176577.961998145] [rviz2.moveit.core.robot_model]: Loading robot model 'octobot'...
[gazebo-5] [INFO] [1713176577.967275068] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
[gazebo-5] [INFO] [1713176577.967376450] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gazebo-5] [INFO] [1713176577.974487079] [gazebo_ros2_control]: connected to service!! robot_state_publisher
[gazebo-5] [INFO] [1713176577.975041491] [gazebo_ros2_control]: Received urdf from param server, parsing...
[gazebo-5] [INFO] [1713176577.975182125] [gazebo_ros2_control]: Loading parameter files /home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/ros2_controllers.yaml
[gazebo-5] [INFO] [1713176577.991654040] [gazebo_ros2_control]: Loading joint: doner12
[gazebo-5] [INFO] [1713176577.991792057] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.991803456] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.991824073] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.991880299] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.991959255] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992599254] [gazebo_ros2_control]: Loading joint: doner23
[gazebo-5] [INFO] [1713176577.992642085] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.992647574] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992653467] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.992658071] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.992662795] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992678406] [gazebo_ros2_control]: Loading joint: doner34
[gazebo-5] [INFO] [1713176577.992682726] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.992687571] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992692370] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.992696363] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.992700629] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992708464] [gazebo_ros2_control]: Loading joint: doner45
[gazebo-5] [INFO] [1713176577.992716219] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.992721980] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992729550] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.992737798] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.992746085] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992758375] [gazebo_ros2_control]: Loading joint: doner56
[gazebo-5] [INFO] [1713176577.992765623] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.992772569] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992851021] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.992863831] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.992869366] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992882431] [gazebo_ros2_control]: Loading joint: doner67
[gazebo-5] [INFO] [1713176577.992888358] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.992892864] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.992897152] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.992901433] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.992905423] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.993029470] [resource_manager]: Initialize hardware 'GazeboSimSystem' 
[gazebo-5] [INFO] [1713176577.993361138] [resource_manager]: Successful initialization of hardware 'GazeboSimSystem'
[gazebo-5] [INFO] [1713176577.993575586] [resource_manager]: 'configure' hardware 'GazeboSimSystem' 
[gazebo-5] [INFO] [1713176577.993589787] [resource_manager]: Successful 'configure' of hardware 'GazeboSimSystem'
[gazebo-5] [INFO] [1713176577.993599730] [resource_manager]: 'activate' hardware 'GazeboSimSystem' 
[gazebo-5] [INFO] [1713176577.993603357] [resource_manager]: Successful 'activate' of hardware 'GazeboSimSystem'
[gazebo-5] [ERROR] [1713176577.993734591] [gazebo_ros2_control]: Parameter 'hold_joints' has already been declared, parameter 'hold_joints' has already been declared
[gazebo-5] [INFO] [1713176577.993828330] [gazebo_ros2_control]: Loading joint: doner12
[gazebo-5] [INFO] [1713176577.993838342] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.993846229] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.993918914] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.993935906] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.993941441] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.993946614] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.993987847] [gazebo_ros2_control]: Loading joint: doner23
[gazebo-5] [INFO] [1713176577.993993374] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.993997672] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994003092] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.994008728] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.994014419] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.994019405] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994030042] [gazebo_ros2_control]: Loading joint: doner34
[gazebo-5] [INFO] [1713176577.994034286] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.994038774] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994045488] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.994052099] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.994056745] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.994062145] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994073688] [gazebo_ros2_control]: Loading joint: doner45
[gazebo-5] [INFO] [1713176577.994078664] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.994084218] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994090000] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.994095354] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.994100242] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.994106344] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994114286] [gazebo_ros2_control]: Loading joint: doner56
[gazebo-5] [INFO] [1713176577.994119308] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.994123997] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994135301] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.994140533] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.994145617] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.994150786] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994158543] [gazebo_ros2_control]: Loading joint: doner67
[gazebo-5] [INFO] [1713176577.994164087] [gazebo_ros2_control]:         State:
[gazebo-5] [INFO] [1713176577.994168212] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994173571] [gazebo_ros2_control]:                          found initial value: 0.000000
[gazebo-5] [INFO] [1713176577.994178871] [gazebo_ros2_control]:                  velocity
[gazebo-5] [INFO] [1713176577.994183431] [gazebo_ros2_control]:         Command:
[gazebo-5] [INFO] [1713176577.994188626] [gazebo_ros2_control]:                  position
[gazebo-5] [INFO] [1713176577.994198955] [resource_manager]: Initialize hardware 'GazeboSimSystem' 
[gazebo-5] [INFO] [1713176577.994212859] [resource_manager]: Successful initialization of hardware 'GazeboSimSystem'
[gazebo-5] [INFO] [1713176577.994399174] [gazebo_ros2_control]: Loading controller_manager
[rviz2-1] [WARN] [1713176578.002588758] [rviz2.moveit.core.robot_model]: Could not identify parent group for end-effector 'end_effector'
[rviz2-1] [INFO] [1713176578.015226795] [rviz2.moveit.kinematics.kdl_kinematics_plugin]: Joint weights for group 'arm': 1 1 1 1 1 1
[INFO] [spawn_entity.py-7]: process has finished cleanly [pid 49996]
[INFO] [ros2-8]: process started with pid [50423]
[gazebo-5] [INFO] [1713176578.052203716] [controller_manager]: Subscribing to '/controller_manager/robot_description' topic for robot description.
[gazebo-5] [WARN] [1713176578.052512698] [gazebo_ros2_control]:  Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s).
[gazebo-5] [INFO] [1713176578.052878275] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
[gazebo-5] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
[rviz2-1] [INFO] [1713176578.186458326] [rviz2.moveit.ros.planning_scene_monitor]: Starting planning scene monitor
[rviz2-1] [INFO] [1713176578.189956257] [rviz2.moveit.ros.planning_scene_monitor]: Listening to '/monitored_planning_scene'
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::base_link::base_link_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::base_link::base_link_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor2Gv_1::Motor2Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor2Gv_1::Motor2Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor3Gv_1::Motor3Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor3Gv_1::Motor3Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor4Gv_1::Motor4Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor4Gv_1::Motor4Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor5Gv_1::Motor5Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor5Gv_1::Motor5Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor6Gv_1::Motor6Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor6Gv_1::Motor6Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor7Gv_1::Motor7Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor7Gv_1::Motor7Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::base_link::base_link_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::base_link::base_link_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor2Gv_1::Motor2Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor3Gv_1::Motor3Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor4Gv_1::Motor4Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor5Gv_1::Motor5Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor6Gv_1::Motor6Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor7Gv_1::Motor7Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor2Gv_1::Motor2Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor3Gv_1::Motor3Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor4Gv_1::Motor4Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor5Gv_1::Motor5Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor6Gv_1::Motor6Gv_1_visual. Object will appear white
[gazebo-5] [Wrn] [Visual.cc:1056] Unable to get Material[Gazebo/Silver] for Geometry[octobot::Motor7Gv_1::Motor7Gv_1_visual. Object will appear white
[gazebo-5] [INFO] [1713176579.604446193] [controller_manager]: Loading controller 'joint_state_broadcaster'
[gazebo-5] [INFO] [1713176579.646506575] [controller_manager]: Configuring controller 'joint_state_broadcaster'
[gazebo-5] [INFO] [1713176579.646888172] [joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
[ros2-8] Successfully loaded controller joint_state_broadcaster into state active
[INFO] [ros2-8]: process has finished cleanly [pid 50423]
[INFO] [ros2-9]: process started with pid [50507]
[gazebo-5] [INFO] [1713176580.785087231] [controller_manager]: Loading controller 'arm_controller'
[gazebo-5] [INFO] [1713176580.844175531] [controller_manager]: Configuring controller 'arm_controller'
[gazebo-5] [INFO] [1713176580.844424041] [arm_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
[gazebo-5] [INFO] [1713176580.844523688] [arm_controller]: Command interfaces are [position] and state interfaces are [position velocity].
[gazebo-5] [INFO] [1713176580.844552419] [arm_controller]: Using 'splines' interpolation method.
[gazebo-5] [INFO] [1713176580.850164078] [arm_controller]: Action status changes will be monitored at 20.00 Hz.
[ros2-9] Successfully loaded controller arm_controller into state active

control.xacro file:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
    <xacro:macro name="octobot_ros2_control" params="name initial_positions_file">
        <xacro:property name="initial_positions" value="${load_yaml(initial_positions_file)['initial_positions']}"/>

        <ros2_control name="GazeboSimSystem" type="system">
            <hardware>
                <!-- By default, set up controllers for simulation. This won't work on real hardware -->
                <plugin>gazebo_ros2_control/GazeboSystem</plugin>
            </hardware>
            <joint name="doner12">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner12']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>
            <joint name="doner23">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner23']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>
            <joint name="doner34">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner34']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>
            <joint name="doner45">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner45']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>
            <joint name="doner56">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner56']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>
            <joint name="doner67">
                <command_interface name="position"/>
                <state_interface name="position">
                  <param name="initial_value">${initial_positions['doner67']}</param>
                </state_interface>
                <state_interface name="velocity"/>
            </joint>

        </ros2_control>
    </xacro:macro>
</robot>

My launch file:

    import os
    from launch import LaunchDescription
    from launch.actions import ExecuteProcess
    from launch.actions import IncludeLaunchDescription
    from launch.actions import RegisterEventHandler
    from launch.event_handlers import OnProcessExit
    from launch.launch_description_sources import PythonLaunchDescriptionSource
    from launch.conditions import IfCondition
    from launch.substitutions import LaunchConfiguration
    from launch_ros.actions import Node
    from ament_index_python.packages import get_package_share_directory
    from moveit_configs_utils import MoveItConfigsBuilder

    def generate_launch_description():
        # planning_context
        moveit_config = (
            MoveItConfigsBuilder("octobot", package_name="octobot_config")
            .robot_description(file_path="/home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/octobot.urdf.xacro")
            .trajectory_execution(file_path="/home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/moveit_controllers.yaml")
            .robot_description_kinematics(file_path="/home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/kinematics.yaml")
            .planning_pipelines(
                pipelines=["ompl", "chomp", "pilz_industrial_motion_planner"]
            )
            .to_moveit_configs()
        )
    
        # Load  ExecuteTaskSolutionCapability so we can execute found solutions in simulation
        move_group_capabilities = {
            "capabilities": "move_group/ExecuteTaskSolutionCapability"
        }
    
        # Start the actual move_group node/action server
        use_sim_time = {"use_sim_time": True}
        configs_dict = moveit_config.to_dict()
        configs_dict.update(use_sim_time)
        run_move_group_node = Node(
            package="moveit_ros_move_group",
            executable="move_group",
            output="screen",
            parameters=[
                configs_dict,
                move_group_capabilities,
            ],
        )
    
        
    
        # RViz
        rviz_config_file = ("/home/dogukanyilmaz/ws_octobot/src/cores/mtc_tutorial/config/mtc.rviz")
        rviz_node = Node(
            package="rviz2",
            executable="rviz2",
            name="rviz2",
            output="log",
            arguments=["-d", rviz_config_file],
            parameters=[
                moveit_config.robot_description,
                moveit_config.robot_description_semantic,
                moveit_config.robot_description_kinematics,
            ],
        )
    
        # Static TF
        static_tf = Node(
            package="tf2_ros",
            executable="static_transform_publisher",
            name="static_transform_publisher",
            output="log",
            arguments=["--frame-id", "world", "--child-frame-id", "dummy"],
        )
    
        # Publish TF
        robot_state_publisher = Node(
            package="robot_state_publisher",
            executable="robot_state_publisher",
            name="robot_state_publisher",
            output="both",
            parameters=[
                moveit_config.robot_description,
            ],
        )
    
        #ros2_control using FakeSystem as hardware
        ros2_controllers_path = os.path.join("/home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/ros2_controllers.yaml")
        ros2_control_node = Node(
            package="controller_manager",
            executable="ros2_control_node",
            parameters=[ros2_controllers_path],
            remappings=[
                ("/controller_manager/robot_description", "/robot_description"),
            ],
            output="both",
        )
        
        use_simulator = LaunchConfiguration('use_simulator')
        gazebo = IncludeLaunchDescription(
            PythonLaunchDescriptionSource([os.path.join(get_package_share_directory('gazebo_ros'),'launch'),'/gazebo.launch.py']),
        )
        start_gazebo_server_cmd = ExecuteProcess( cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'], output='screen')
        load_joint_state_controller = ExecuteProcess(cmd=['ros2','control','load_controller','--set-state','active','joint_state_broadcaster'], output='screen')
        load_arm_controller = ExecuteProcess(cmd=['ros2','control','load_controller','--set-state','active','arm_controller'], output='screen')
        spawn_entity = Node(package="gazebo_ros", executable = "spawn_entity.py", arguments=['-topic','/robot_description','-entity','octobot'], output='screen')
    
        return LaunchDescription(
            [
                rviz_node,
                static_tf,
                robot_state_publisher,
                run_move_group_node,
                start_gazebo_server_cmd,
                ros2_control_node,
                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_arm_controller],)),
                spawn_entity,
            ]
        )

ros2_controller.yaml file:

# This config file is used by ros2_control
controller_manager:
  ros__parameters:
    update_rate: 100  # Hz

    arm_controller:
      type: joint_trajectory_controller/JointTrajectoryController


    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

arm_controller:
  ros__parameters:
    joints:
      - doner12
      - doner23
      - doner34
      - doner45
      - doner56
      - doner67
    command_interfaces:
      - position
    state_interfaces:
      - position
      - velocity
    allow_nonzero_velocity_at_trajectory_end: true

My urdf file:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from octobot.xacro                  | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="octobot">
  <material name="silver">
    <color rgba="0.700 0.700 0.700 1.000"/>
  </material>
  <transmission name="doner12_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner12">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner12_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <transmission name="doner23_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner23">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner23_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <transmission name="doner34_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner34">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner34_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <transmission name="doner45_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner45">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner45_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <transmission name="doner56_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner56">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner56_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <transmission name="doner67_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="doner67">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="doner67_actr">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>10</mechanicalReduction>
    </actuator>
  </transmission>
  <gazebo>
    <plugin filename="libgazebo_ros2_control.so" name="control">
    <legacyModeNS>true</legacyModeNS>
    </plugin>
  </gazebo>
  <gazebo reference="base_link">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
    <gravity>true</gravity>
  </gazebo>
  <gazebo reference="Motor2Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <gazebo reference="Motor3Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <gazebo reference="Motor4Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <gazebo reference="Motor5Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <gazebo reference="Motor6Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <gazebo reference="Motor7Gv_1">
    <material>Gazebo/Silver</material>
    <mu1>0.2</mu1>
    <mu2>0.2</mu2>
    <self_collide>true</self_collide>
  </gazebo>
  <link name="base_link">
    <inertial>
      <origin rpy="0 0 0" xyz="0.01104339129651807 -5.25334719245186e-08 0.09293988490750445"/>
      <mass value="17.613743236958385"/>
      <inertia ixx="0.087346" ixy="-0.0" ixz="0.000413" iyy="0.099484" iyz="0.0" izz="0.061677"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/base_link.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0 0 0"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/base_link.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor2Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="0.0073547207227992635 -5.7183835097550754e-08 0.13244866550568501"/>
      <mass value="14.13180132167806"/>
      <inertia ixx="0.05358" ixy="-0.0" ixz="-0.002639" iyy="0.052304" iyz="0.0" izz="0.029049"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="-0.0 -0.0 -0.174"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor2Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="-0.0 -0.0 -0.174"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor2Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor3Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="-0.040302427728824475 -3.1776755710503087e-08 0.14852969258891868"/>
      <mass value="9.34356309497989"/>
      <inertia ixx="0.04708" ixy="0.0" ixz="0.012293" iyy="0.053199" iyz="-0.0" izz="0.020547"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="-0.059 0.0 -0.326"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor3Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="-0.059 0.0 -0.326"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor3Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor4Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="-0.0030612425184283498 -3.0946477218760627e-06 0.1067843579424047"/>
      <mass value="8.873874448445003"/>
      <inertia ixx="0.023613" ixy="0.0" ixz="0.000801" iyy="0.023432" iyz="1e-06" izz="0.012203"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0.0 0.0 -0.5455"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor4Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0.0 0.0 -0.5455"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor4Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor5Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="0.02928590541122761 2.9599701849593294e-05 0.14797355123897027"/>
      <mass value="9.684238619334375"/>
      <inertia ixx="0.049575" ixy="-7e-06" ixz="-0.012451" iyy="0.056529" iyz="-1.3e-05" izz="0.021122"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0.0495 5e-05 -0.6725"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor5Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0.0495 5e-05 -0.6725"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor5Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor6Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="0.0011632770512901751 1.17570137097191e-06 0.09112293887057576"/>
      <mass value="6.164349978605796"/>
      <inertia ixx="0.013483" ixy="-1e-06" ixz="-0.000289" iyy="0.013993" iyz="-0.0" izz="0.00637"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="0.0 -0.0 -0.8933"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor6Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="0.0 -0.0 -0.8933"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor6Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="Motor7Gv_1">
    <inertial>
      <origin rpy="0 0 0" xyz="-0.02716716791682726 -2.753113110725478e-05 0.09747913986651802"/>
      <mass value="5.870034266249876"/>
      <inertia ixx="0.014009" ixy="-3e-06" ixz="0.003344" iyy="0.016521" iyz="3e-06" izz="0.008501"/>
    </inertial>
    <visual>
      <origin rpy="0 0 0" xyz="-0.0435 -4.4e-05 -1.0093"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor7Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
      <material name="silver"/>
    </visual>
    <collision>
      <origin rpy="0 0 0" xyz="-0.0435 -4.4e-05 -1.0093"/>
      <geometry>
        <mesh filename="file:///home/dogukanyilmaz/ws_octobot/src/cores/octobot_description/meshes/Motor7Gv_1.stl" scale="0.001 0.001 0.001"/>
      </geometry>
    </collision>
  </link>
  <link name="world"></link>
  <joint name="fixed" type="fixed">
    <parent link="world"/>
    <child link="base_link"/>
  </joint>
  <joint name="doner12" type="continuous">
    <origin rpy="0 0 0" xyz="0.0 0.0 0.174"/>
    <parent link="base_link"/>
    <child link="Motor2Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="0.0 -0.0 -1.0"/>
  </joint>
  <joint name="doner23" type="continuous">
    <origin rpy="0 0 0" xyz="0.059 -0.0 0.152"/>
    <parent link="Motor2Gv_1"/>
    <child link="Motor3Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="-1.0 0.0 0.0"/>
  </joint>
  <joint name="doner34" type="continuous">
    <origin rpy="0 0 0" xyz="-0.059 0.0 0.2195"/>
    <parent link="Motor3Gv_1"/>
    <child link="Motor4Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="0.0 0.0 -1.0"/>
  </joint>
  <joint name="doner45" type="continuous">
    <origin rpy="0 0 0" xyz="-0.0495 -5e-05 0.127"/>
    <parent link="Motor4Gv_1"/>
    <child link="Motor5Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="0.999999 0.001011 0.0"/>
  </joint>
  <joint name="doner56" type="continuous">
    <origin rpy="0 0 0" xyz="0.0495 5e-05 0.2208"/>
    <parent link="Motor5Gv_1"/>
    <child link="Motor6Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="0.0 -0.0 -1.0"/>
  </joint>
  <joint name="doner67" type="continuous">
    <origin rpy="0 0 0" xyz="0.0435 4.4e-05 0.116"/>
    <parent link="Motor6Gv_1"/>
    <child link="Motor7Gv_1"/>
    <dynamics damping="10.0" friction="1.0"/>
    <axis xyz="-0.999999 -0.001011 0.0"/>
  </joint>
  <ros2_control name="GazeboSimSystem" type="system">
    <hardware>
      <plugin>gazebo_ros2_control/GazeboSystem</plugin>
    </hardware>
    <joint name="doner12">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
    <joint name="doner23">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
    <joint name="doner34">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
    <joint name="doner45">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
    <joint name="doner56">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
    <joint name="doner67">
      <command_interface name="position"/>
      <state_interface name="position">
        <param name="initial value">0.0</param>
      </state_interface>
      <state_interface name="velocity"/>
    </joint>
  </ros2_control>
  <gazebo>
    <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
      <parameters>/home/dogukanyilmaz/ws_octobot/src/cores/octobot_config/config/ros2_controllers.yaml</parameters>
    </plugin>
  </gazebo>
</robot>
@mbed92
Copy link

mbed92 commented Oct 25, 2024

We have the same problem after a recent update. Maybe it is connected with the parsing description, like in one of the previous issues: #295. Investigation in progress.

@tomaszkapron
Copy link

Having a very similar issue on ROS Humble with version 0.4.10.

[gazebo_ros2_control]: Parameter 'hold_joints' has already been declared

No problem with 0.4.9

@christophfroehlich
Copy link
Contributor

Hello, I am trying to export myy RVIZ work to Gazebo. However, whenever I use gezebo_ros2_control packages to control my robot's joints I get these two errors:

[gazebo-5] [ERROR] [1713176577.993734591] [gazebo_ros2_control]: Parameter 'hold_joints' has already been declared, parameter 'hold_joints' has already been declared

and

[gazebo-5] [ERROR] [1713176577.948738083] [control]: No parameter file provided. Configuration might be wrong [gazebo-5] [ERROR] [1713176577.949836711] [control]: failed to parse input yaml file(s)

@dogukanyilmazerkba were you able to resolve your issue? I expect the problem is in your config that you run a ros2_control_node: This does not work with gazebo_ros2_control, because the plugin itself loads its controller_manager.

@christophfroehlich
Copy link
Contributor

We have the same problem after a recent update. Maybe it is connected with the parsing description, like in one of the previous issues: #295. Investigation in progress.

Having a very similar issue on ROS Humble with version 0.4.10.

[gazebo_ros2_control]: Parameter 'hold_joints' has already been declared

No problem with 0.4.9

@mbed92 @tomaszkapron Do you have a similar setup like above, with using a superfluous ros2_control_node?

The demos work for me on humble.
If your setup is similar to the demos, you could compile this package from source (see the humble branch) and use git bisect to see which commit introduced the behavior change for your setup.

Otherwise, could you provide a MWE resulting in this error, without using moveit in the config?

@tomaszkapron
Copy link

tomaszkapron commented Oct 29, 2024

I think I found the source of the problem. In the file describing ros2_control interface I had my interface split among more than one GazeboSystem plugin. Do I understand it is not the right approach? Now I only have one and it seems to work without mentioned errors.

I had the following configuration

<ros2_control name="<interface_A>" type="system">
        <hardware>
                <plugin>gazebo_ros2_control/GazeboSystem</plugin>
        </hardware>

        <joint name="joint_A">
        ...
        <joint name="joint_N">
</ros2_control>

<ros2_control name="<interface_B>" type="system">
        <hardware>
                <plugin>gazebo_ros2_control/GazeboSystem</plugin>
        </hardware>

        <joint name="joint_A">
        ...
        <joint name="joint_N">
</ros2_control>

<gazebo>
        <plugin filename="libgazebo_ros2_control.so" name="gazebo_ros2_control">
</gazebo>

I reduced it to having a single general interface.

@saikishor
Copy link
Member

Yes, it should be under one system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants