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

    6.5.4无法启动力控制器

    已定时 已固定 已锁定 已移动
    ROS2机器人开发:从入门到实践
    ros2 roscontr
    1
    3
    71
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • C
      Charlie
      最后由 编辑

      求救求救,呜呜呜

      fishbot_ros2_controller.yaml文件内容:

      controller_manager:
        ros__parameters:
          update_rate: 100  # Hz
          use_sim_time: true
          fishbot_joint_state_broadcaster:
            type: joint_state_broadcaster/JointStateBroadcaster
            use_sim_time: true
          fishbot_effort_controller:
            type: effort_controllers/JointGroupEffortController
      
      fishbot_effort_controller:
        ros__parameters:
          joints:
            - left_wheel_joint
            - right_wheel_joint
          command_interfaces:
            - effort
          state_interfaces:
            - position
            - velocity
            - effort
      

      gazebo_sim.launch.py文件内容:

      import launch
      import launch_ros
      from ament_index_python.packages import get_package_share_directory
      import os
      
      def generate_launch_description():
          # 获取功能包的share路径
          urdf_package_path = get_package_share_directory('fishbot_description')
          defualt_xacro_path = os.path.join(urdf_package_path, 'urdf', 'fishbot/fishbot.urdf.xacro')
          defualt_gazebo_world_path = os.path.join(urdf_package_path, 'world', 'custom_room.world')
          # 声明一个urdf目录的参数,方便修改
          action_declare_arg_mode_path = launch.actions.DeclareLaunchArgument(
              name='model', default_value=str(defualt_xacro_path), description='加载的模型文件路径'
          )
          # 通过文件路径,获取内容,并转换成参数值对象,以供传入 robot_state_publisher
          substitutions_command_result = launch.substitutions.Command(['xacro ', launch.substitutions.LaunchConfiguration('model')])
          robot_description_value = launch_ros.parameter_descriptions.ParameterValue(substitutions_command_result, value_type=str)
      
          action_robot_state_publisher = launch_ros.actions.Node(
              package='robot_state_publisher',
              executable='robot_state_publisher',
              parameters=[{'robot_description':robot_description_value}]
          )
      
          action_launch_gazebo = launch.actions.IncludeLaunchDescription(
              launch.launch_description_sources.PythonLaunchDescriptionSource(
                  [get_package_share_directory('gazebo_ros'),'/launch','/gazebo.launch.py']
              ),
              launch_arguments=[('world',defualt_gazebo_world_path),('verbose','true')]
          )
      
          action_spawm_entity = launch_ros.actions.Node(
              package='gazebo_ros',
              executable='spawn_entity.py',
              arguments=['-topic','/robot_description','-entity','fishbot']
          )
      
          action_load_joint_state_controller = launch.actions.ExecuteProcess(
              cmd='ros2 control load_controller fishbot_joint_state_broadcaster --set-state active'.split(' '),
              output='screen'
          )
      
          action_load_effort_controller = launch.actions.ExecuteProcess(
              cmd='ros2 control load_controller fishbot_effort_broadcaster --set-state active'.split(' '),
              output='screen'
          )
      
          return launch.LaunchDescription([
              action_declare_arg_mode_path, 
              action_robot_state_publisher,
              action_launch_gazebo,
              action_spawm_entity,
              launch.actions.RegisterEventHandler(
                  event_handler=launch.event_handlers.OnProcessExit(
                      target_action=action_spawm_entity,
                      on_exit=[action_load_joint_state_controller],
                  )
              ),
              launch.actions.RegisterEventHandler(
                  event_handler=launch.event_handlers.OnProcessExit(
                      target_action=action_load_joint_state_controller,
                      on_exit=[action_load_effort_controller],
                  )
              ),        
          ])
      

      报错内容:

      charlie@charlie-VirtualBox:~/chapt6/chapt6_ws$ ros2 launch fishbot_description gazebo_sim.launch.py 
      [INFO] [launch]: All log files can be found below /home/charlie/.ros/log/2025-08-14-13-26-32-002900-charlie-VirtualBox-14576
      [INFO] [launch]: Default logging verbosity is set to INFO
      [INFO] [robot_state_publisher-1]: process started with pid [14582]
      [INFO] [gzserver-2]: process started with pid [14584]
      [INFO] [gzclient-3]: process started with pid [14586]
      [INFO] [spawn_entity.py-4]: process started with pid [14588]
      [robot_state_publisher-1] [INFO] [1755149192.409618885] [robot_state_publisher]: got segment back_wheel_link
      [robot_state_publisher-1] [INFO] [1755149192.409707476] [robot_state_publisher]: got segment base_footprint
      [robot_state_publisher-1] [INFO] [1755149192.409716020] [robot_state_publisher]: got segment base_link
      [robot_state_publisher-1] [INFO] [1755149192.409720830] [robot_state_publisher]: got segment camera_link
      [robot_state_publisher-1] [INFO] [1755149192.409725466] [robot_state_publisher]: got segment camera_optical_link
      [robot_state_publisher-1] [INFO] [1755149192.409730113] [robot_state_publisher]: got segment front_wheel_link
      [robot_state_publisher-1] [INFO] [1755149192.409734683] [robot_state_publisher]: got segment imu_link
      [robot_state_publisher-1] [INFO] [1755149192.409739214] [robot_state_publisher]: got segment laser_cylinder_link
      [robot_state_publisher-1] [INFO] [1755149192.409743668] [robot_state_publisher]: got segment laser_link
      [robot_state_publisher-1] [INFO] [1755149192.409748291] [robot_state_publisher]: got segment left_wheel_link
      [robot_state_publisher-1] [INFO] [1755149192.409752794] [robot_state_publisher]: got segment right_wheel_link
      [gzclient-3] Gazebo multi-robot simulator, version 11.10.2
      [gzclient-3] Copyright (C) 2012 Open Source Robotics Foundation.
      [gzclient-3] Released under the Apache 2 License.
      [gzclient-3] http://gazebosim.org
      [gzclient-3] 
      [gzserver-2] Gazebo multi-robot simulator, version 11.10.2
      [gzserver-2] Copyright (C) 2012 Open Source Robotics Foundation.
      [gzserver-2] Released under the Apache 2 License.
      [gzserver-2] http://gazebosim.org
      [gzserver-2] 
      [spawn_entity.py-4] [INFO] [1755149192.721795812] [spawn_entity]: Spawn Entity started
      [spawn_entity.py-4] [INFO] [1755149192.722152998] [spawn_entity]: Loading entity published on topic /robot_description
      [spawn_entity.py-4] [INFO] [1755149192.723538076] [spawn_entity]: Waiting for entity xml on /robot_description
      [spawn_entity.py-4] [INFO] [1755149192.737648830] [spawn_entity]: Waiting for service /spawn_entity, timeout = 30
      [spawn_entity.py-4] [INFO] [1755149192.737973586] [spawn_entity]: Waiting for service /spawn_entity
      [gzserver-2] [Wrn] [gazebo_ros_init.cpp:178] 
      [gzserver-2] #     # ####### ####### ###  #####  #######
      [gzserver-2] ##    # #     #    #     #  #     # #
      [gzserver-2] # #   # #     #    #     #  #       #
      [gzserver-2] #  #  # #     #    #     #  #       #####
      [gzserver-2] #   # # #     #    #     #  #       #
      [gzserver-2] #    ## #     #    #     #  #     # #
      [gzserver-2] #     # #######    #    ###  #####  #######
      [gzserver-2] 
      [gzserver-2] This version of Gazebo, now called Gazebo classic, reaches end-of-life
      [gzserver-2] in January 2025. Users are highly encouraged to migrate to the new Gazebo
      [gzserver-2] using our migration guides (https://gazebosim.org/docs/latest/gazebo_classic_migration?utm_source=gazebo_ros_pkgs&utm_medium=cli)
      [gzserver-2] 
      [gzserver-2] 
      [spawn_entity.py-4] [INFO] [1755149193.630002076] [spawn_entity]: Calling service /spawn_entity
      [gzclient-3] [Msg] Waiting for master.
      [gzclient-3] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
      [gzclient-3] [Msg] Publicized address: 10.0.2.15
      [gzclient-3] [Wrn] [GuiIface.cc:120] Could not find the Qt platform plugin "wayland" in ""
      [gzserver-2] [Msg] Waiting for master.
      [gzserver-2] [Msg] Connected to gazebo master @ http://127.0.0.1:11345
      [gzserver-2] [Msg] Publicized address: 10.0.2.15
      [gzserver-2] [Msg] Loading world file [/home/charlie/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/world/custom_room.world]
      [gzserver-2] [Wrn] [Event.cc:61] Warning: Deleting a connection right after creation. Make sure to save the ConnectionPtr from a Connect call
      [gzserver-2] [INFO] [1755149194.040022442] [depth_camera]: Publishing camera info to [/camera_sensor/camera_info]
      [gzserver-2] [INFO] [1755149194.041348511] [depth_camera]: Publishing depth camera info to [/camera_sensor/depth/camera_info]
      [gzserver-2] [INFO] [1755149194.041969718] [depth_camera]: Publishing pointcloud to [/camera_sensor/points]
      [spawn_entity.py-4] [INFO] [1755149194.167642949] [spawn_entity]: Spawn status: SpawnEntity: Successfully spawned entity [fishbot]
      [gzserver-2] [INFO] [1755149194.188820356] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
      [gzserver-2] [INFO] [1755149194.196361687] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /
      [gzserver-2] [INFO] [1755149194.196411774] [gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
      [gzserver-2] [INFO] [1755149194.202945161] [gazebo_ros2_control]: connected to service!! robot_state_publisher
      [gzserver-2] [INFO] [1755149194.204511542] [gazebo_ros2_control]: Received urdf from param server, parsing...
      [gzserver-2] [INFO] [1755149194.204661865] [gazebo_ros2_control]: Loading parameter files /home/charlie/chapt6/chapt6_ws/install/fishbot_description/share/fishbot_description/config/fishbot_ros2_controller.yaml
      [gzserver-2] [INFO] [1755149194.216888925] [gazebo_ros2_control]: Loading joint: left_wheel_joint
      [gzserver-2] [INFO] [1755149194.216973229] [gazebo_ros2_control]:       State:
      [gzserver-2] [INFO] [1755149194.216996699] [gazebo_ros2_control]:                position
      [gzserver-2] [INFO] [1755149194.217017614] [gazebo_ros2_control]:                velocity
      [gzserver-2] [INFO] [1755149194.217035265] [gazebo_ros2_control]:                effort
      [gzserver-2] [INFO] [1755149194.217410237] [gazebo_ros2_control]:       Command:
      [gzserver-2] [INFO] [1755149194.217472195] [gazebo_ros2_control]:                velocity
      [gzserver-2] [INFO] [1755149194.217882558] [gazebo_ros2_control]:                effort
      [gzserver-2] [INFO] [1755149194.217932050] [gazebo_ros2_control]: Loading joint: right_wheel_joint
      [gzserver-2] [INFO] [1755149194.217953011] [gazebo_ros2_control]:       State:
      [gzserver-2] [INFO] [1755149194.217970816] [gazebo_ros2_control]:                position
      [gzserver-2] [INFO] [1755149194.217992609] [gazebo_ros2_control]:                velocity
      [gzserver-2] [INFO] [1755149194.218018592] [gazebo_ros2_control]:                effort
      [gzserver-2] [INFO] [1755149194.218073496] [gazebo_ros2_control]:       Command:
      [gzserver-2] [INFO] [1755149194.218104275] [gazebo_ros2_control]:                velocity
      [gzserver-2] [INFO] [1755149194.218310209] [gazebo_ros2_control]:                effort
      [gzserver-2] [INFO] [1755149194.218444212] [resource_manager]: Initialize hardware 'FishBotGazeboSystem' 
      [gzserver-2] [INFO] [1755149194.218787765] [resource_manager]: Successful initialization of hardware 'FishBotGazeboSystem'
      [gzserver-2] [INFO] [1755149194.219203076] [resource_manager]: 'configure' hardware 'FishBotGazeboSystem' 
      [gzserver-2] [INFO] [1755149194.219228919] [resource_manager]: Successful 'configure' of hardware 'FishBotGazeboSystem'
      [gzserver-2] [INFO] [1755149194.219242935] [resource_manager]: 'activate' hardware 'FishBotGazeboSystem' 
      [gzserver-2] [INFO] [1755149194.219255560] [resource_manager]: Successful 'activate' of hardware 'FishBotGazeboSystem'
      [gzserver-2] [INFO] [1755149194.219508454] [gazebo_ros2_control]: Loading controller_manager
      [gzserver-2] [WARN] [1755149194.240378504] [gazebo_ros2_control]:  Desired controller update period (0.01 s) is slower than the gazebo simulation period (0.001 s).
      [gzserver-2] [INFO] [1755149194.240584522] [gazebo_ros2_control]: Loaded gazebo_ros2_control.
      [INFO] [spawn_entity.py-4]: process has finished cleanly [pid 14588]
      [INFO] [ros2-5]: process started with pid [14745]
      [gzserver-2] [INFO] [1755149195.120629564] [controller_manager]: Loading controller 'fishbot_joint_state_broadcaster'
      [gzserver-2] [INFO] [1755149195.145931071] [controller_manager]: Configuring controller 'fishbot_joint_state_broadcaster'
      [gzserver-2] [INFO] [1755149195.146586668] [fishbot_joint_state_broadcaster]: 'joints' or 'interfaces' parameter is empty. All available state interfaces will be published
      [ros2-5] Successfully loaded controller fishbot_joint_state_broadcaster into state active
      [gzclient-3] context mismatch in svga_surface_destroy
      [gzclient-3] context mismatch in svga_surface_destroy
      [INFO] [ros2-5]: process has finished cleanly [pid 14745]
      [INFO] [ros2-6]: process started with pid [14781]
      [gzserver-2] [ERROR] [1755149196.607657076] [controller_manager]: The 'type' param was not defined for 'fishbot_effort_broadcaster'.
      [ros2-6] Error loading controller, check controller_manager logs
      [ERROR] [ros2-6]: process has died [pid 14781, exit code 1, cmd 'ros2 control load_controller fishbot_effort_broadcaster --set-state active'].
      
      C 1 条回复 最后回复 回复 引用 0
      • C
        Charlie @Charlie
        最后由 编辑

        @Charlie [gzserver-2] [ERROR] [1755149196.607657076] [controller_manager]: The 'type' param was not defined for 'fishbot_effort_broadcaster'.

        C 1 条回复 最后回复 回复 引用 0
        • C
          Charlie @Charlie
          最后由 编辑

          @Charlie 已解决,laucnh文件中

              action_load_effort_controller = launch.actions.ExecuteProcess(
                  cmd='ros2 control load_controller fishbot_effort_broadcaster --set-state active'.split(' '),
                  output='screen'
              )
          

          写错了,应该是fishbot_effort_controller

          1 条回复 最后回复 回复 引用 0
          • 第一个帖子
            最后一个帖子
          皖ICP备16016415号-7
          Powered by NodeBB | 鱼香ROS