小鱼 ROS 2 新书上线!点击链接查看, 新书配套视频点击链接查看。
提问前必看的发帖注意事项—— 提问前必看!不符合要求的问题拒绝回答!!
社区使用指南—如何添加标签修改密码
gazebo中的机械臂不能运动
-
[ WARN] [1732267437.771779960, 5.001000000]: Waiting for arm_controller/follow_joint_trajectory to come up...
[ INFO] [1732267441.211594986, 8.428000000]: Failed to call service get_planning_scene, have you launched move_group or called psm.providePlanningSceneService()?
[ INFO] [1732267441.211974507, 8.428000000]: Constructing new MoveGroup connection for group 'kr5_planning_group' in namespace ''
[ WARN] [1732267442.789623770, 10.001000000]: Waiting for arm_controller/follow_joint_trajectory to come up...
[ERROR] [1732267447.803488813, 15.001000000]: Action client not connected: arm_controller/follow_joint_trajectory
会报以上的错误,应该要怎么解决 -
您在使用 Gazebo 和 ROS(Robot Operating System)进行机械臂仿真时遇到的错误提示表明有几个关键问题需要解决。这些错误通常与控制器配置、服务连接和动作客户端的连接有关。以下是一些解决这些问题的步骤:
-
确保控制器已正确启动:
- 错误
[WARN] Waiting for arm_controller/follow_joint_trajectory to come up...
和[ERROR] Action client not connected: arm_controller/follow_joint_trajectory
表明arm_controller
没有正确运行或者没有成功连接到 Gazebo。 - 确保您的
robot_description
参数中包含了正确的控制器配置。这通常在 URDF 或 XACRO 文件中定义。 - 检查您的启动文件中是否包含了启动控制器的命令,如
rosrun robot_state_publisher robot_state_publisher
和相应的控制器管理器启动命令(如rosrun controller_manager controller_manager
)。
- 错误
-
启动 Move Group:
- 错误
[INFO] Failed to call service get_planning_scene, have you launched move_group or called psm.providePlanningSceneService()?
表明 Move Group 没有运行或者get_planning_scene
服务没有可用。 - 确保您已经启动了 Move Group 节点。这通常通过
roslaunch your_robot_name_moveit_config demo.launch
或类似的命令来完成。 - 确保 Move Group 配置文件中指定的规划组(如
kr5_planning_group
)与您的机器人 URDF 中的关节组相匹配。
- 错误
-
检查网络和服务连接:
- 确保 ROS 主节点(通常是通过
roscore
启动的)正在运行,并且所有相关的节点和服务都能连接到这个主节点。 - 使用
rostopic list
和rosservice list
来检查follow_joint_trajectory
动作服务器和其他相关服务是否已启动和可用。
- 确保 ROS 主节点(通常是通过
-
查看日志和调试信息:
- 使用
roslaunch
或rosrun
命令时加上--screen
选项,以便在终端中直接看到输出和错误信息,这有助于诊断问题。 - 查看
.log
文件中的详细信息,这些文件通常位于~/.ros/
目录下。
- 使用
-
确保所有依赖都已正确安装:
- 确保所有必要的 ROS 包都已安装,特别是与 MoveIt!、控制器管理器和您的特定机器人相关的包。
通过上述步骤,您应该能够诊断并解决机械臂在 Gazebo 中无法运动的问题。如果问题仍然存在,可能需要更详细地检查您的机器人描述文件、启动脚本和 ROS 配置文件。
以上为生成回答,仅供参考~
-
-
@小伊 !!
-
看起来您发送的信息似乎不完整或者只是一个感叹号组合,没有具体的上下文或内容让我进行回答或分析。如果您有关于某个主题的具体问题或需要信息,请提供更多的细节,这样我才能给出一个准确和有用的回答。
以上为生成回答,仅供参考~
-
@小伊 # Simulation settings for using moveit_sim_controllers
moveit_sim_hw_interface:
joint_model_group: kr5_planning_group
joint_model_group_pose: all_zeroSettings for ros_control_boilerplate control loop
generic_hw_control_loop:
loop_hz: 300
cycle_time_error_threshold: 0.01Settings for ros_control hardware interface
hardware_interface:
joints:
- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
sim_control_mode: 0 # 0: position, 1: velocityPublish all joint states
Creates the /joint_states topic necessary in ROS
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50controller_list:
- name: arm_controller
action_ns: follow_joint_trajectory
default: true
type: FollowJointTrajectory
joints:- joint_a1
- joint_a2
- joint_a3
- joint_a4
- joint_a5
- joint_a6
这是arm_controller的yaml配置文件
- name: arm_controller
-
这个YAML配置文件是用于配置MoveIt的仿真控制器(
moveit_sim_controllers
)和ROS控制框架(ros_control
)的设置。它主要用于在仿真环境中控制一个六轴机械臂(例如KR5系列的机器人)。以下是对该配置文件的详细解释:MoveIt仿真硬件接口设置
moveit_sim_hw_interface
: 这是MoveIt仿真硬件接口的配置部分。joint_model_group
: 指定要控制的关节模型组,这里是kr5_planning_group
,它应该包含了机械臂的所有关节。joint_model_group_pose
: 初始化关节模型组的姿态,这里设置为all_zero
,意味着所有关节的初始位置都设为0。
ROS控制框架控制循环设置
generic_hw_control_loop
: 这是ROS控制框架中通用硬件控制循环的配置。loop_hz
: 控制循环的频率,这里是300Hz,意味着每秒钟执行300次控制循环。cycle_time_error_threshold
: 循环时间误差阈值,这里是0.01秒,用于控制循环的精度。
ROS控制硬件接口设置
hardware_interface
: 定义了与硬件交互的接口。joints
: 列出了需要控制的关节,这里是KR5机械臂的六个关节(joint_a1
到joint_a6
)。sim_control_mode
: 仿真控制模式,0表示位置控制,1表示速度控制,这里设置为0,即位置控制。
关节状态控制器
joint_state_controller
: 用于发布所有关节的状态。type
: 控制器类型,这里是joint_state_controller/JointStateController
。publish_rate
: 发布频率,这里是50Hz,意味着每秒钟发布50次关节状态。
控制器列表
controller_list
: 列出了所有配置的控制器。name
: 控制器的名称,这里是arm_controller
。action_ns
: 动作命名空间,这里是follow_joint_trajectory
,用于通过动作服务器接口控制机械臂的运动。default
: 是否为默认控制器,这里设置为true
。type
: 控制器的类型,这里是FollowJointTrajectory
,用于执行关节轨迹跟踪。joints
: 控制器控制的关节列表,同样包含了KR5机械臂的六个关节。
这个配置文件为在ROS中使用MoveIt和ROS控制框架对KR5系列的机械臂进行仿真控制提供了必要的设置。通过配置这些参数,你可以实现机械臂的精确控制,并监控其关节状态。
以上为生成回答,仅供参考~
-
@小伊 <?xml version="1.0"?>
<robot xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:interface="http://ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:xacro="http://ros.org/wiki/xacro"><xacro:include filename="$(find kr5_description)/urdf/kr.transmission.xacro" />
<xacro:include filename="$(find kr5_description)/urdf/kr.gazebo.xacro" /><!-- effort values can be found here: https://github.com/ros-industrial/universal_robot/issues/32-->
<!-- plate Properties -->
<!-- a plate with 40x40x1 (cm) -->
<xacro:property name="plate_mass" value="0.5175" />
<xacro:property name="plate_width" value="0.4" /><!-- Kinematic model -->
<xacro:macro name="kr5_robot" params="prefix"><!-- links: --> <link name="${prefix}base_link" > <inertial> <origin xyz="-0.017519394031846 8.11394768450848E-07 0.0975924044854325" rpy="0 0 0" /> <mass value="7.58585707666653" /> <!-- changed mass! 7000? --> <inertia ixx="0.0441803207364147" ixy="5.37433593375545E-07" ixz="0.004045564920652" iyy="0.0584309411563095" iyz="-4.8990117845347E-07" izz="0.0514875586171667" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/base_link.dae" /> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/base_link.dae" /> </geometry> </collision> </link> <link name="${prefix}link_1"> <inertial> <origin xyz="0.0359968408135882 0.00783796591813503 -0.0864969937502713" rpy="0 0 0" /> <mass value="5.77242340173648" /> <inertia ixx="0.0327019582662897" ixy="-0.00189987845379704" ixz="0.00937014136132958" iyy="0.0373787564144547" iyz="-0.00197023031658988" izz="0.0348614383349291" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/link_1.dae" /> </geometry> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_1.stl" /> </geometry> </collision> </link> <link name="${prefix}link_2"> <inertial> <origin xyz="0.00610231661046294 0.0401115026555897 -0.11531122862673" rpy="0 0 0" /> <mass value="4.64974639735464" /> <inertia ixx="0.0663459530931455" ixy="0.000173652478770081" ixz="0.000586191290902105" iyy="0.070407913174161" iyz="-0.00203071071007864" izz="0.0102816377550493" /> </inertial> <visual> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/link_2.dae" /> </geometry> </visual> <collision> <origin xyz="0 0 0" rpy="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_2.stl" /> </geometry> </collision> </link> <link name="${prefix}link_3"> <inertial> <origin xyz="0.0755031858462784 -0.046481517407519 -0.00506472105904233" rpy="0 0 0" /> <mass value="4.3593398708568" /> <inertia ixx="0.0202008069207718" ixy="5.72394748332304E-05" ixz="0.000556621203065716" iyy="0.0246796752429931" iyz="0.000697020296811431" izz="0.0178067561136726" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/link_3.dae" /> </geometry> <material name="LightGrey"> <color rgba="0.7 0.7 0.7 1.0"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_3.stl" /> </geometry> </collision> </link> <!-- wrist links: --> <link name="${prefix}link_4"> <inertial> <origin xyz="0.0857493724873204 -0.00149370513017266 -0.00271609825446984" rpy="0 0 0" /> <mass value="2.06809715541017" /> <inertia ixx="0.00444943757623485" ixy="-0.000424915429214687" ixz="-0.000117340671961173" iyy="0.00882693069799353" iyz="0.000136971152627904" izz="0.0101131228921778" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/link_4.dae" /> </geometry> <material name="LightGrey"> <color rgba="0.7 0.7 0.7 1.0"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_4.stl" /> </geometry> </collision> </link> <link name="${prefix}link_5"> <inertial> <origin xyz="0 0 0" rpy="0 0 0" /> <mass value="0.328309098974388" /> <inertia ixx="0.000221789219477276" ixy="-9.59628913869705E-07" ixz="1.40395663663479E-20" iyy="0.000321152451627032" iyz="-4.44973606670705E-20" izz="0.000275966419870925" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_5.stl" /> </geometry> <material name="LightGrey"> <color rgba="0.7 0.7 0.7 1.0"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_5.stl" /> </geometry> </collision> </link> <link name="${prefix}link_6"> <inertial> <origin xyz="0.00983949894991115 -2.78372724487979E-05 -1.11022302462516E-15" rpy="0 0 0" /> <mass value="0.0789494717998531" /> <inertia ixx="3.53285039019399E-05" ixy="-3.23299732456798E-08" ixz="-6.9643163510009E-19" iyy="2.30177957763861E-05" iyz="-9.26550270485857E-19" izz="2.28539400944714E-05" /> </inertial> <visual> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/visual/link_6.dae" /> </geometry> <material name="LightGrey"> <color rgba="0.7 0.7 0.7 1.0"/> </material> </visual> <collision> <origin rpy="0 0 0" xyz="0 0 0" /> <geometry> <mesh filename="package://kr5_description/meshes/collision/link_6.stl" /> </geometry> </collision> </link>
<!-- tool link -->
<!-- This frame corresponds to the $FLANGE coordinate system in KUKA KRC controllers. --><link name="${prefix}ee_link"> <inertial> <origin xyz="0 -.01 0.17275327" rpy="0 0 0" /> <mass value="0.085" /> <inertia ixx="0.002858" ixy="0" ixz="0" iyy="0.002987" iyz="0" izz="0.0001420" /> <!-- ${0.08333333333*plate_mass*plate_width}--> </inertial> <visual> <origin xyz="0.075 -0.012 0.06" rpy="0 ${pi} 0" /> <geometry> <mesh filename="package://kr5_description/meshes/tools/paddle.stl" scale="0.001 0.001 0.001" /> <!-- plate is 20x20x1cm if scale is 0.01 --> </geometry> </visual> <collision> <origin xyz="0.075 -0.012 0.06" rpy="0 ${pi} 0" /> <geometry> <mesh filename="package://kr5_description/meshes/tools/paddle.stl" scale="0.001 0.001 0.001" /> <!-- plate is 20x20x1 m --> </geometry> <surface> <bounce restitution_coefficient="0.1" threshold="0.01"/> </surface> </collision> </link> <gazebo reference="${prefix}ee_link"> <mu1 value="100.0" /> <mu2 value="0.1" /> <maxVel value="10.0"/> <kp value="1000.0" /> <kd value="1.0" /> <fdir1 value="1 0 0" /> <material>Gazebo/Grey</material> <turnGravityOff>false</turnGravityOff> </gazebo> <!-- joints: --> <joint name="${prefix}joint_a1" type="revolute"> <origin xyz="0 0 0.4" rpy="${pi} 0 0" /> <parent link="${prefix}base_link" /> <child link = "${prefix}link_1" /> <axis xyz="0 0 1" /> <limit effort="150" lower="${radians(-155)}" upper="${radians(155)}" velocity="${radians(15400)}" /> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}joint_a2" type="revolute"> <origin xyz="0.18 0 0" rpy="${pi/2} 0.0 0" /> <parent link="${prefix}link_1" /> <child link = "${prefix}link_2" /> <axis xyz="0 0 1" /> <limit lower="${radians(-180)}" upper="${radians(65)}" effort="150.0" velocity="${radians(15400)}"/> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}joint_a3" type="revolute"> <parent link="${prefix}link_2" /> <child link = "${prefix}link_3" /> <origin xyz="0.6 0 0" rpy="0 0 0" /> <axis xyz="0 0 1" /> <limit lower="${radians(-15)}" upper="${radians(158)}" effort="150.0" velocity="315"/> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}joint_a4" type="revolute"> <parent link="${prefix}link_3" /> <child link = "${prefix}link_4" /> <origin xyz="0 -0.12 0" rpy="0 ${-pi/2} 0" /> <axis xyz="0 0 1" /> <limit lower="${radians(-350)}" upper="${radians(350)}" effort="60.0" velocity="320"/> <!-- max should be 28 --> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}joint_a5" type="revolute"> <parent link="${prefix}link_4" /> <child link = "${prefix}link_5" /> <origin xyz="0 0 -0.62" rpy="0 ${pi/2} 0" /> <axis xyz="0 0 1" /> <limit lower="${radians(-130)}" upper="${radians(130)}" effort="60.0" velocity="320"/> <!-- max should be 28 --> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}joint_a6" type="revolute"> <parent link="${prefix}link_5" /> <child link = "${prefix}link_6" /> <origin xyz="0 0 0" rpy="0 ${-pi/2} 0" /> <axis xyz="0 0 1" /> <limit lower="${radians(-350)}" upper="${radians(350)}" effort="28.0" velocity="320"/> <dynamics damping="0.0" friction="0.0"/> </joint> <joint name="${prefix}ee_fixed_joint" type="fixed"> <parent link="${prefix}link_6" /> <child link = "${prefix}ee_link" /> <origin xyz="0 0 -.308" rpy="0 ${-pi} ${-pi/2}" /> </joint>
<!-- -.368 is 0 visual offset -->
<xacro:kr_arm_transmission prefix="${prefix}" /> <xacro:kr_arm_gazebo prefix="${prefix}" /> <!-- ROS base_link to UR 'Base' Coordinates transform --> <!-- NOTE: this rotation is only needed as long as base_link itself is not corrected wrt the real robot (ie: rotated over 180 degrees) --> <!-- <link name="${prefix}base"/> <joint name="${prefix}base_link-base_fixed_joint" type="fixed"> <origin xyz="0 0 0" rpy="0 0 ${-pi}"/> <parent link="${prefix}base_link"/> <child link="${prefix}base"/> </joint> --> <!-- Frame coincident with all-zeros TCP on UR controller --> <!-- <link name="${prefix}tool0"/> <joint name="${prefix}wrist_3_link-tool0_fixed_joint" type="fixed"> <origin xyz="0 0.115 0" rpy="${pi/-2.0} 0 0"/> <parent link="${prefix}link_6"/> <child link="${prefix}tool0"/> </joint> -->
</xacro:macro>
</robot>
这个是xacro文件