鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    ROS2-humble下使用gazebo仿真多个机器人

    已定时 已固定 已锁定 已移动
    ROS 2相关问题
    ur5e controller gazebo
    5
    15
    1.5k
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • 13933998981
      santidad D.A.Y
      最后由 编辑

      我需要仿真两个ur机械臂,区分为right和left,单独一个机械臂在启动时不会发生任何异常,日志及效果均正常。但是我在gazebo中仿真两个机械臂时出现了一下错误,此时我先启动的是gazebo和right机械臂。
      当我启动left机械臂时出现如下报错:

      [gazebo-1] [INFO] [1721305630.545883012] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
      [gazebo-1] [INFO] [1721305630.548942789] [right_ur_ft.left_gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /right_ur_ft
      [gazebo-1] [INFO] [1721305630.548969012] [right_ur_ft.left_gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: left_gazebo_ros2_control
      [gazebo-1] [INFO] [1721305630.551234947] [right_ur_ft.left_gazebo_ros2_control]: connected to service!! robot_state_publisher
      [gazebo-1] [INFO] [1721305630.551447028] [right_ur_ft.left_gazebo_ros2_control]: Received urdf from param server, parsing...
      [gazebo-1] [INFO] [1721305630.551465845] [right_ur_ft.left_gazebo_ros2_control]: Loading parameter files /home/pc/Documents/code/my_project/install/dual_ur_ft_description/share/dual_ur_ft_description/config/left_controllers.yaml
      [gazebo-1] [WARN] [1721305630.553943330] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_shoulder_pan_joint' which is not in the gazebo model.
      [gazebo-1] [WARN] [1721305630.553980206] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_shoulder_lift_joint' which is not in the gazebo model.
      [gazebo-1] [WARN] [1721305630.553987412] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_elbow_joint' which is not in the gazebo model.
      [gazebo-1] [WARN] [1721305630.553993509] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_wrist_1_joint' which is not in the gazebo model.
      [gazebo-1] [WARN] [1721305630.553999327] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_wrist_2_joint' which is not in the gazebo model.
      [gazebo-1] [WARN] [1721305630.554005002] [right_ur_ft.left_gazebo_ros2_control]: Skipping joint in the URDF named 'right_wrist_3_joint' which is not in the gazebo model.
      [gazebo-1] [INFO] [1721305630.554012707] [resource_manager]: Initialize hardware 'right_ur_ft' 
      [gazebo-1] [INFO] [1721305630.554027646] [resource_manager]: Successful initialization of hardware 'right_ur_ft'
      [gazebo-1] [INFO] [1721305630.554034086] [resource_manager]: 'configure' hardware 'right_ur_ft' 
      [gazebo-1] [INFO] [1721305630.554038544] [resource_manager]: Successful 'configure' of hardware 'right_ur_ft'
      [gazebo-1] [INFO] [1721305630.554041070] [resource_manager]: 'activate' hardware 'right_ur_ft' 
      [gazebo-1] [INFO] [1721305630.554044007] [resource_manager]: Successful 'activate' of hardware 'right_ur_ft'
      [gazebo-1] [INFO] [1721305630.554075380] [right_ur_ft.left_gazebo_ros2_control]: Loading controller_manager
      [gazebo-1] [WARN] [1721305630.566282520] [right_ur_ft.left_gazebo_ros2_control]:  Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s).
      [gazebo-1] [INFO] [1721305630.566433146] [right_ur_ft.left_gazebo_ros2_control]: Loaded gazebo_ros2_control.
      [gazebo-1] [INFO] [1721305630.721421170] [left_ur_ft.controller_manager]: Loading controller 'left_ur_arm_controller'
      [gazebo-1] [WARN] [1721305630.727062472] [left_ur_ft.left_ur_arm_controller]: [Deprecated]: "allow_nonzero_velocity_at_trajectory_end" is set to true. The default behavior will change to false.
      [gazebo-1] [INFO] [1721305630.738388252] [left_ur_ft.controller_manager]: Configuring controller 'left_ur_arm_controller'
      [gazebo-1] [INFO] [1721305630.738528990] [left_ur_ft.left_ur_arm_controller]: No specific joint names are used for command interfaces. Using 'joints' parameter.
      [gazebo-1] [INFO] [1721305630.738544047] [left_ur_ft.left_ur_arm_controller]: Command interfaces are [position] and state interfaces are [position velocity].
      [gazebo-1] [INFO] [1721305630.738551237] [left_ur_ft.left_ur_arm_controller]: Using 'splines' interpolation method.
      [gazebo-1] [INFO] [1721305630.738881576] [left_ur_ft.left_ur_arm_controller]: Controller state will be published at 100.00 Hz.
      [gazebo-1] [INFO] [1721305630.739418360] [left_ur_ft.left_ur_arm_controller]: Action status changes will be monitored at 20.00 Hz.
      [gazebo-1] [ERROR] [1721305630.747940453] [resource_manager]: Not acceptable command interfaces combination: 
      [gazebo-1] Start interfaces: 
      [gazebo-1] [
      [gazebo-1]   left_shoulder_pan_joint/position
      [gazebo-1]   left_shoulder_lift_joint/position
      [gazebo-1]   left_elbow_joint/position
      [gazebo-1]   left_wrist_1_joint/position
      [gazebo-1]   left_wrist_2_joint/position
      [gazebo-1]   left_wrist_3_joint/position
      [gazebo-1] ]
      [gazebo-1] Stop interfaces: 
      [gazebo-1] [
      [gazebo-1] ]
      [gazebo-1] Not existing: 
      [gazebo-1] [
      [gazebo-1]  left_shoulder_pan_joint/position
      [gazebo-1]  left_shoulder_lift_joint/position
      [gazebo-1]  left_elbow_joint/position
      [gazebo-1]  left_wrist_1_joint/position
      [gazebo-1]  left_wrist_2_joint/position
      [gazebo-1]  left_wrist_3_joint/position
      [gazebo-1] ]
      [gazebo-1] 
      [gazebo-1] [ERROR] [1721305630.747965277] [left_ur_ft.controller_manager]: Could not switch controllers since prepare command mode switch was rejected.
      [gazebo-1] [INFO] [1721305631.166267831] [left_ur_ft.controller_manager]: Loading controller 'left_joint_state_broadcaster'
      [gazebo-1] [INFO] [1721305631.178641120] [left_ur_ft.controller_manager]: Configuring controller 'left_joint_state_broadcaster'
      [gazebo-1] [INFO] [1721305631.178682137] [left_ur_ft.left_joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
      [gazebo-1] [ERROR] [1721305631.197295835] [left_ur_ft.left_joint_state_broadcaster]: None of requested interfaces exist. Controller will not run.
      [gazebo-1] [WARN] [1721305631.197377359] [left_ur_ft.left_joint_state_broadcaster]: Error occurred while doing error handling.
      [gazebo-1] [ERROR] [1721305631.197411498] [left_ur_ft.controller_manager]: After activation, controller 'left_joint_state_broadcaster' is in state 'unconfigured' (1), expected 'active' (3).
      
      [spawner-3] [INFO] [1721305630.737579996] [spawner_left_ur_arm_controller]: Loaded left_ur_arm_controller
      [spawner-3] [ERROR] [1721305630.748434297] [spawner_left_ur_arm_controller]: Failed to activate controller
      [ERROR] [spawner-3]: process has died [pid 21171, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner left_ur_arm_controller -c /left_ur_ft/controller_manager --ros-args'].
      [spawner-2] [INFO] [1721305631.177883333] [spawner_left_joint_state_broadcaster]: Loaded left_joint_state_broadcaster
      [spawner-2] [INFO] [1721305631.207880602] [spawner_left_joint_state_broadcaster]: Configured and activated left_joint_state_broadcaster
      [INFO] [spawner-2]: process has finished cleanly [pid 21169]
      

      我可以确定的是我的命名空间没有问题,单独启动任意一个都是正常的。但是在启动第二个机械臂(left)出现了使用第一个机械臂(right)命名空间的情况,这个有可能是因为抢占资源引起的,但是我没有办法解决。

      rosgraph.png

      我在github上找到了几个解决方案但是因为对二进制编译和源码编译的不熟悉,我修改后出现了更大的错误。不知道作者有没有找到好的解决方案

      附上我找到的解决方案链接:
      https://github.com/ros-controls/ros2_control/issues/1177
      https://github.com/ros-controls/ros2_control/pull/1391

      我在github上找到了几个解决方案但是因为对二进制编译和源码编译的不熟悉,我修改后出现了更大的错误。希望有大佬能够解答

      PS:我将两个机械臂写在一个models里面是可以进行控制的,但是我目前的需求是在gazebo中有两个models

      附上我找到的解决方案链接:
      https://github.com/ros-controls/ros2_control/issues/1177
      https://github.com/ros-controls/ros2_control/pull/1391

      1 条回复 最后回复 回复 引用 0
      • 小伊小
        机器人小伊
        最后由 编辑

        从您提供的错误信息和上下文来看,您遇到的问题似乎与在ROS 2的Gazebo环境中同时加载和配置两个独立的机器人(在这里是UR机械臂)的控制器有关。问题可能出在以下几个方面:

        1. 命名空间冲突:您已经注意到在启动第二个机械臂(left)时,似乎使用了第一个机械臂(right)的命名空间。这可能是由于在启动或配置第二个机械臂时,命名空间没有被正确设置或传递。确保在启动和配置第二个机械臂时,所有相关的节点、服务、参数和命名空间都是独立和明确的。

        2. 资源冲突:可能有两个或多个控制器试图使用相同的硬件资源(例如,URDF中定义的关节)。在这种情况下,您需要确保每个控制器仅访问其被授权访问的资源。

        3. URDF/SRDF配置:确保每个机械臂的URDF/SRDF文件都是独立的,并且正确描述了各自的关节、链接和控制器接口。

        4. 启动顺序和参数传递:检查您的启动脚本和配置文件,确保在启动每个机械臂时都正确传递了所有必要的参数和命名空间。

        5. 硬件接口:ros2_control使用hardware_interface来定义机器人硬件的接口。确保您的硬件接口配置对于每个机械臂都是唯一的,并且没有重复或冲突的接口。

        6. ROS 2节点命名:ROS 2中的节点名称需要在整个系统中是唯一的。如果两个节点具有相同的名称,它们将无法正确通信。

        针对您的情况,以下是一些可能的解决方案:

        • 确保命名空间和参数文件是独立的:为每个机械臂创建单独的命名空间、URDF/SRDF文件和控制器配置文件。
        • 修改启动脚本:在启动脚本中,为每个机械臂的gazebo_ros2_control插件和控制器管理器指定不同的命名空间。
        • 检查URDF/SRDF文件:确保URDF/SRDF文件中定义的关节和链接名称在两个机械臂之间是唯一的,并且没有重复。
        • 检查硬件接口配置:确保每个机械臂的硬件接口配置都是唯一的,并且没有冲突。
        • 使用不同的节点名称:确保在ROS 2中启动的每个节点都具有唯一的名称。

        最后,如果您对源码编译和二进制编译不熟悉,那么直接修改ros2_control或相关库的源码可能会引入更多的复杂性。在尝试这些高级操作之前,建议先确保您的配置和启动脚本是正确的,并且遵循了ROS 2和ros2_control的最佳实践。如果问题仍然存在,考虑在ROS社区或相关论坛中寻求帮助。


        以上为生成回答,仅供参考~

        我是小伊,已接入ChatGpt,所有回复,仅供参考~

        13933998981 1 条回复 最后回复 回复 引用 0
        • 13933998981
          santidad D.A.Y @小伊
          最后由 编辑

          @小伊 命名空间不存在冲突,左右机械臂都可以单独运行。资源冲突并不是机械臂资源冲突,而是后一个启动的机械臂的gazebo_ros2_control plugin使用了前一个的gazebo_ros2_control plugin的命名空间导致资源冲突

          G 1 条回复 最后回复 回复 引用 0
          • 小伊小
            机器人小伊
            最后由 编辑

            您描述的问题似乎与ROS 2和Gazebo的集成使用中的命名空间冲突有关。当您在Gazebo中模拟两个或更多的机械臂,并且每个机械臂都使用gazebo_ros2_control插件时,确保每个插件都正确配置在它们自己的命名空间中是非常重要的。

            这里有几个步骤和建议,可以帮助您解决资源冲突问题:

            1. 明确命名空间:

              • 确保每个机械臂在URDF或SDF文件中都有唯一的命名空间。
              • 在启动文件中,为每个机械臂的ROS 2节点明确设置命名空间。
            2. 独立启动:

              • 不要在一个启动文件中同时启动两个机械臂,除非您已经明确配置了它们的命名空间。
              • 分别启动每个机械臂,以确保它们不会意外地共享资源或命名空间。
            3. 检查gazebo_ros2_control插件配置:

              • 在Gazebo的插件标签中,为每个gazebo_ros2_control插件指定正确的命名空间。
              • 确保每个插件都加载了正确的参数文件,这些参数文件为控制器、状态发布器等定义了正确的命名空间。
            4. 使用ROS 2的参数服务器:

              • 如果您使用参数服务器来配置控制器,确保每个控制器都在其自己的命名空间中注册参数。
              • 使用ros2 param命令来检查和修改参数,以确保它们位于正确的命名空间中。
            5. 查看ROS 2话题和服务:

              • 使用ros2 topic list和ros2 service list命令来查看正在发布的话题和提供的服务。
              • 验证这些话题和服务是否都在它们应该存在的命名空间中。
            6. 检查日志:

              • 仔细检查ROS 2和Gazebo的日志文件,以查找任何关于命名空间或资源冲突的错误或警告。
            7. 清理和重置:

              • 如果可能的话,在尝试新的配置或修复之前,完全关闭Gazebo和ROS 2,并清理任何可能残留的状态或配置。
            8. 参考文档和示例:

              • 查阅gazebo_ros2_control、ROS 2和Gazebo的官方文档,以了解如何正确配置和使用这些工具。
              • 查找并研究类似的示例或项目,以了解他们如何处理命名空间和多机械臂模拟。
            9. 社区支持:

              • 如果您仍然遇到问题,考虑在ROS 2或Gazebo的社区论坛、GitHub仓库或邮件列表中寻求帮助。

            通过遵循这些步骤和建议,您应该能够解决由命名空间冲突导致的资源冲突问题,并成功地在Gazebo中模拟多个机械臂。


            以上为生成回答,仅供参考~

            我是小伊,已接入ChatGpt,所有回复,仅供参考~

            1 条回复 最后回复 回复 引用 0
            • 13933998981
              santidad D.A.Y
              最后由 编辑

              问题已解决,如需帮助请与我联系

              F G 2 条回复 最后回复 回复 引用 0
              • F
                FantaTerry @1393399898
                最后由 编辑

                @1393399898 您好,请问解决了命名空间后还需要做什么工作才可以正常运行?我现在是在humble的gazebo试图加载三台turtlebot3,下面是日志:

                lab1@lab1-colorful:~/ros2_ws$ ros2 launch rl_turtlebot_launch multi_turtlebot3.launch.py 
                [INFO] [launch]: All log files can be found below /home/lab1/.ros/log/2024-07-19-09-22-44-801730-lab1-colorful-263368
                [INFO] [launch]: Default logging verbosity is set to INFO
                urdf_file_name : turtlebot3_waffle.urdf
                urdf_file_name : turtlebot3_waffle.urdf
                [INFO] [gzserver-1]: process started with pid [263381]
                [INFO] [gzclient-2]: process started with pid [263383]
                [INFO] [robot_state_publisher-3]: process started with pid [263385]
                [INFO] [spawn_entity.py-4]: process started with pid [263387]
                [INFO] [spawn_entity.py-5]: process started with pid [263389]
                [INFO] [spawn_entity.py-6]: process started with pid [263391]
                [spawn_entity.py-5] [INFO] [1721352166.060579777] [spawn_entity]: Spawn Entity started
                [spawn_entity.py-5] [INFO] [1721352166.060771871] [spawn_entity]: Loading entity XML from file /home/lab1/ros2_ws/install/rl_turtlebot_launch/share/rl_turtlebot_launch/urdf/turtlebot3_waffle.urdf
                [spawn_entity.py-5] [INFO] [1721352166.062016813] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
                [spawn_entity.py-5] [INFO] [1721352166.062347773] [spawn_entity]: Waiting for service /spawn_entity
                [spawn_entity.py-6] [INFO] [1721352166.074252112] [spawn_entity]: Spawn Entity started
                [spawn_entity.py-6] [INFO] [1721352166.074442278] [spawn_entity]: Loading entity XML from file /home/lab1/ros2_ws/install/rl_turtlebot_launch/share/rl_turtlebot_launch/urdf/turtlebot3_waffle.urdf
                [spawn_entity.py-4] [INFO] [1721352166.074493023] [spawn_entity]: Spawn Entity started
                [spawn_entity.py-4] [INFO] [1721352166.074674658] [spawn_entity]: Loading entity XML from file /home/lab1/ros2_ws/install/rl_turtlebot_launch/share/rl_turtlebot_launch/urdf/turtlebot3_waffle.urdf
                [spawn_entity.py-6] [INFO] [1721352166.074846235] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
                [spawn_entity.py-6] [INFO] [1721352166.074978259] [spawn_entity]: Waiting for service /spawn_entity
                [spawn_entity.py-4] [INFO] [1721352166.075055066] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
                [spawn_entity.py-4] [INFO] [1721352166.075188369] [spawn_entity]: Waiting for service /spawn_entity
                [robot_state_publisher-3] [INFO] [1721352166.078197592] [robot_state_publisher]: got segment base_footprint
                [robot_state_publisher-3] [INFO] [1721352166.078255204] [robot_state_publisher]: got segment base_link
                [robot_state_publisher-3] [INFO] [1721352166.078259586] [robot_state_publisher]: got segment base_scan
                [robot_state_publisher-3] [INFO] [1721352166.078261874] [robot_state_publisher]: got segment camera_depth_frame
                [robot_state_publisher-3] [INFO] [1721352166.078264109] [robot_state_publisher]: got segment camera_depth_optical_frame
                [robot_state_publisher-3] [INFO] [1721352166.078266519] [robot_state_publisher]: got segment camera_link
                [robot_state_publisher-3] [INFO] [1721352166.078268708] [robot_state_publisher]: got segment camera_rgb_frame
                [robot_state_publisher-3] [INFO] [1721352166.078270838] [robot_state_publisher]: got segment camera_rgb_optical_frame
                [robot_state_publisher-3] [INFO] [1721352166.078273050] [robot_state_publisher]: got segment caster_back_left_link
                [robot_state_publisher-3] [INFO] [1721352166.078275165] [robot_state_publisher]: got segment caster_back_right_link
                [robot_state_publisher-3] [INFO] [1721352166.078277151] [robot_state_publisher]: got segment imu_link
                [robot_state_publisher-3] [INFO] [1721352166.078279245] [robot_state_publisher]: got segment wheel_left_link
                [robot_state_publisher-3] [INFO] [1721352166.078281434] [robot_state_publisher]: got segment wheel_right_link
                [spawn_entity.py-5] [INFO] [1721352166.569728255] [spawn_entity]: Calling service /spawn_entity
                [spawn_entity.py-6] [INFO] [1721352166.577600512] [spawn_entity]: Calling service /spawn_entity
                [spawn_entity.py-4] [INFO] [1721352166.578143401] [spawn_entity]: Calling service /spawn_entity
                [spawn_entity.py-5] [INFO] [1721352166.615479641] [spawn_entity]: Spawn status: Entity pushed to spawn queue, but spawn service timed outwaiting for entity to appear in simulation under the name [turtlebot3_waffle_2]
                [spawn_entity.py-5] [ERROR] [1721352166.615657547] [spawn_entity]: Spawn service failed. Exiting.
                [spawn_entity.py-6] [INFO] [1721352166.694504006] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [turtlebot3_waffle_3]
                [ERROR] [spawn_entity.py-5]: process has died [pid 263389, exit code 1, cmd '/opt/ros/humble/lib/gazebo_ros/spawn_entity.py -entity turtlebot3_waffle_2 -file /home/lab1/ros2_ws/install/rl_turtlebot_launch/share/rl_turtlebot_launch/urdf/turtlebot3_waffle.urdf -x 0.0 -y 0.0 -z 0.01 --ros-args'].
                [INFO] [spawn_entity.py-6]: process has finished cleanly [pid 263391]
                [spawn_entity.py-4] [INFO] [1721352166.920741484] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [turtlebot3_waffle_1]
                [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 263387]
                

                我在的rqt_graph界面没有显示预先规定的命名空间,所以我觉得我的launch文件可能存在一些问题:

                def generate_launch_description():
                    launch_file_dir = os.path.join(get_package_share_directory('rl_turtlebot_launch'), 'launch')
                    pkg_gazebo_ros = get_package_share_directory('gazebo_ros')
                
                    use_sim_time = LaunchConfiguration('use_sim_time', default='true')
                
                    world = os.path.join(
                        get_package_share_directory('rl_turtlebot_launch'),
                        'worlds',
                        'lab.world'
                    )
                
                    gzserver_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(pkg_gazebo_ros, 'launch', 'gzserver.launch.py')
                        ),
                        launch_arguments={'world': world}.items()
                    )
                
                    gzclient_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(pkg_gazebo_ros, 'launch', 'gzclient.launch.py')
                        )
                    )
                
                    robot_state_publisher_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(launch_file_dir, 'robot_state_publisher.launch.py')
                        ),
                        launch_arguments={'use_sim_time': use_sim_time}.items()
                    )
                
                    spawn_turtlebot1_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(launch_file_dir, 'spawn_turtlebot3.launch.py')
                        ),
                        launch_arguments={
                            'x_pose': '-2.0',
                            'y_pose': '-0.5',
                            'robot_name': 'turtlebot3_waffle_1'
                        }.items()
                    )
                
                    spawn_turtlebot2_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(launch_file_dir, 'spawn_turtlebot3.launch.py')
                        ),
                        launch_arguments={
                            'x_pose': '0.0',
                            'y_pose': '0.0',
                            'robot_name': 'turtlebot3_waffle_2'
                        }.items()
                    )
                
                    spawn_turtlebot3_cmd = IncludeLaunchDescription(
                        PythonLaunchDescriptionSource(
                            os.path.join(launch_file_dir, 'spawn_turtlebot3.launch.py')
                        ),
                        launch_arguments={
                            'x_pose': '2.0',
                            'y_pose': '0.5',
                            'robot_name': 'turtlebot3_waffle_3'
                        }.items()
                    )
                
                    ld = LaunchDescription()
                
                    # Add the commands to the launch description
                    ld.add_action(gzserver_cmd)
                    ld.add_action(gzclient_cmd)
                    ld.add_action(robot_state_publisher_cmd)
                    ld.add_action(spawn_turtlebot1_cmd)
                    ld.add_action(spawn_turtlebot2_cmd)
                    ld.add_action(spawn_turtlebot3_cmd)
                
                    return ld```
                13933998981 1 条回复 最后回复 回复 引用 0
                • 13933998981
                  santidad D.A.Y @FantaTerry
                  最后由 编辑

                  @FantaTerry 您好,感谢您的提问

                  我和您的构件思路不同,但是我发现您的robot_state_publisher只启动了一次。我的两个机械臂均有各自的robot_state_publisher用于发布机器人状态,也使用命名空间进行区分,我不确定启动一次是否可以无冲突调用,所以我进行了区分,以下是我的部分launch代码:

                  left_robot_state_publisher_node = Node(
                          package='robot_state_publisher',
                          executable='robot_state_publisher',
                          namespace='/left_ur_ft',
                          output='both',
                          parameters=[{"use_sim_time": True}, left_robot_description],
                      )
                  
                  right_robot_state_publisher_node = Node(
                          package='robot_state_publisher',
                          executable='robot_state_publisher',
                          namespace='/right_ur_ft',
                          output='both',
                          parameters=[{"use_sim_time": True}, right_robot_description],
                      )
                  

                  希望能够帮到您

                  1 条回复 最后回复 回复 引用 0
                  • G
                    guoshanqi @1393399898
                    最后由 编辑

                    @1393399898 您好,我最近也在做多机器人,请问您是怎么解决的

                    1 条回复 最后回复 回复 引用 0
                    • G
                      guoshanqi @1393399898
                      最后由 编辑

                      @1393399898 我也是遇到,第二个机器人的gazebo_ros2_control仍然使用第一个机器人的命名空间,我试过很多办法都没法解决

                      13933998981 1 条回复 最后回复 回复 引用 0
                      • 13933998981
                        santidad D.A.Y @guoshanqi
                        最后由 编辑

                        @guoshanqi 非常抱歉这么久才回复您

                        我使用的方式是在github下载ros2的包重新编译安装,不使用二进制安装,例如:control,controller,control_msgs,control_toolbox,gazebo_ros2_control等一系列包,除此之外,还有ur机械臂的包和realsense相机的包。这些包在几乎每周都在更新版本,而二进制安装的版本还是非常过时。

                        我将这些包直接编译安装在系统下(/opt/ros/humble),没有试过放在项目中,不确定放在项目中是否会成功。因此,这就改变了系统原有的依赖,可能会造成其他项目无法正常执行,因此在这之前请慎重考虑,使用二进制重新安装即可回退。我目前没有其他更好的解决方式

                        希望能够帮助到您

                        W 1 条回复 最后回复 回复 引用 0
                        • W
                          wind2918 @1393399898
                          最后由 编辑

                          @1393399898 你好有具体解决教程吗我也是这个问题控制器明明已经区分空间但节点还是会重复

                          13933998981 1 条回复 最后回复 回复 引用 0
                          • 13933998981
                            santidad D.A.Y @wind2918
                            最后由 编辑

                            @wind2918 在项目代码方面没有什么改动,我是重新编译了ros2下的系统功能包,在之前已经介绍过这种方式的利弊,您可也翻阅一下。

                            造成这个问题的主要原因是:二进制安装(apt install)的ros2系统功能包(主要为controller_manager等)重复使用,这一点目前还无法通过修改自己的项目代码解决。但是在github中这部分已经进行了更新,二进制安装中还没有被更新,所以我们需要下载源码然后编译。我为了方便使用,将编译后的文件添加到了系统文件夹下(https://blog.csdn.net/m0_60346726/article/details/132858862)。

                            希望能够帮助到您

                            W 1 条回复 最后回复 回复 引用 0
                            • W
                              wind2918 @1393399898
                              最后由 编辑

                              @1393399898 可以再发一下这个教程吗,这个显示打不开了,万分感谢

                              13933998981 1 条回复 最后回复 回复 引用 0
                              • 13933998981
                                santidad D.A.Y @wind2918
                                最后由 编辑

                                @wind2918 这个不是完整教程,这个只是将编译文件添加到系统文件夹下。完整操作你需要参考我之前发的回答,评估自己需要重新编译的功能包。以及安装时的注意事项

                                https://blog.csdn.net/m0_60346726/article/details/132858862

                                W 1 条回复 最后回复 回复 引用 0
                                • W
                                  wind2918 @1393399898
                                  最后由 编辑

                                  @1393399898 非常感谢你的帮助我现在已经解决了,这个问题困扰我很久

                                  1 条回复 最后回复 回复 引用 0
                                  • 2 2118561423 在 中 引用了 这个主题
                                  • 第一个帖子
                                    最后一个帖子
                                  皖ICP备16016415号-7
                                  Powered by NodeBB | 鱼香ROS