文章目录
问题1:rviz及gazebo中的模型呈现未装配状态
rviz及gazebo中的模型处于散架状态、未装配,TF树处于断开状态,如下图所示:
原因:
- 可能1:框架配置有问题,关节状态控制器没配置
- 可能2:xacro中有中文字符
博主属于第2种可能,xacro中为方便查看使用了中文注释,部分代码如下:
<?xml version="1.0" encoding="utf-8"?>
<!-- 声明机器人名称为cobot_model,文件类型解析为xacro -->
<robot name="cobot_ab7" xmlns:xacro="http://ros.org/wiki/xacro">
、、、、、、
<color
rgba="0.75294 0.75294 0.75294 0.2" />
<!-- rgba分别表示RGB值和alpha值,此处RGB值为01制,alpha值在0-1之间,1表示不透明,0表示完全透明 -->
</material>
、、、、、、
<!-- 工具link -->
<link name="tool0"/>
、、、、、、
</joint>
<!-- 为joint添加传动装置,传动比为1 -->
<xacro:macro name="transmission_block" params="joint_name">
、、、、、、
<!-- 添加gazebo控制器插件 -->
<gazebo>
、、、、、、
</gazebo>
</robot>
解决方案:删除xacro中的中文注释,或者将中文注释改为英文即可解决
问题2:运行launch文件报错moveit_rviz.launch有问题
RLException: unused args [config] for include of [/home/miracle/catkin_cobot_control/src/cobot_moveit_config/launch/moveit_rviz.launch] The traceback for the exception was written to the log file原因分析:检查moveit_rviz.launch
文件
<launch>
<arg name="debug" default="false" />
<arg unless="$(arg debug)" name="launch_prefix" value="" />
<arg if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args" />
<arg name="rviz_config" default="" />
<arg if="$(eval rviz_config=='')" name="command_args" value="" />
<arg unless="$(eval rviz_config=='')" name="command_args" value="-d $(arg rviz_config)" />
<node name="$(anon rviz)" launch-prefix="$(arg launch_prefix)" pkg="rviz" type="rviz" respawn="false"
args="$(arg command_args)" output="screen">
<rosparam command="load" file="$(find cobot_moveit_config)/config/kinematics.yaml"/>
</node>
</launch>
解决方案:将moveit_rviz.launch
修改成如下代码
<launch>
<arg name="debug" default="false" />
<arg unless="$(arg debug)" name="launch_prefix" value="" />
<arg if="$(arg debug)" name="launch_prefix" value="gdb --ex run --args" />
<arg name="config" default="false" />
<arg unless="$(arg config)" name="command_args" default="" />
<arg if="$(arg config)" name="command_args" default="-d $(find cobot_moveit_config)/launch/moveit.rviz" />
<node name="$(anon rviz)" launch-prefix="$(arg launch_prefix)" pkg="rviz" type="rviz" respawn="false"
args="$(arg command_args)" output="screen">
<rosparam command="load" file="$(find cobot_moveit_config)/config/kinematics.yaml"/>
</node>
</launch>
问题3:gazebo的反馈数据在rviz中有效,规划完Execute后gazebo中模型无反应,且终端报错,错误信息如下:
[ERROR] [1580371550.113165194, 45.227000000]: Unable to identify any set of controllers that can actuate the specified joints: [ joint_1 joint_2 joint_3 joint_4 joint_5 joint_6 joint_7 ] [ERROR] [1580371550.113240046, 45.227000000]: Known controllers and their joints:原因分析:
从上图可知,反馈有反应说明Joint State Controller配置没问题,gazebo模型不执行轨迹说明轨迹没下发到模型,说明Follow Joint Trajectory和Trajectory Controller可能有问题,查看配置文件夹中的launch文件cobot_ab7_moveit_controller_manager.launch.xml
,发现果然控制器配置有问题,默认为ros_controller
解决方案:查看控制器文件,并将cobot_ab7_moveit_controller_manager.launch.xml
中的控制器替换成指定控制器即可。