在学习《Learning_ROS_for_Robotics_Programming》一书中,遇到的问题。环境建立在Ubuntu 16.04+ROS kinetic。
利用gazebo官方网站上的教程,进行简单的一个关节机械臂minimal_robot_description与移动机器人mobot进行组合,并在tf转换时,根据之前的代码,出现一些问题。
解决如下:
在example_tf_listener的操作中,
一、运行一下命令检测code时,
1.roslaunch gazebo_ros empty_world.launch
2.roslaunch mobot_urdf mobot_w_arm_and_jnt_pub.launch
会在第二个terminator出现一下warning:
xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
xacro.py is deprecated; please use xacro instead
原launch文件如下所示:
这个时候,需要在两个urdf文件的组合launch文件中进行修改,提示信息为xacro.py中修改为xacro --inorder
以上解决后,发现第一个terminator之前也出现了ERROR和不少的WARN,错误信息如下:
[ERROR] [1542849476.639698396, 107.472000000]: GazeboRosDiffDrive Plugin missing
This setting assumes you have a old package, where the right and left wheel are changed to fix a former code issue
To get rid of this error just set
To fix an old package you have to exchange left wheel by the right wheel.
If you do not want to fix this issue in an old package or your z axis points down instead of the ROS standard defined in REP 103
just set
此步骤,显示主要是“differential_drive_controller”这个差速驱动控制插件的
true
${update_rate}
base_link_right_wheel_joint
base_link_left_wheel_joint
0.5380
0.2410
20
cmd_vel
odom
odom
base_footprint
但是使用如上教程的插件情况,仍会出现该错误,这是根据错误提醒,添加
完成以上error后,再去解决warn问题,出现的情况如下:
[ WARN] [1542849476.606732630, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639636245, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639668608, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639816031, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639845310, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639929621, 107.472000000]: DiffDrive(ns = //): missing
[ WARN] [1542849476.639998766, 107.472000000]: GazeboRosDiffDrive Plugin (ns = ) missing
[ WARN] [1542849476.683199389, 107.472000000]: GazeboRosJointStatePublisher Plugin (ns = //) missing
[ WARN] [1542852800.252579222, 31.303000000]: GazeboRosJointStatePublisher Plugin (ns = //) missing
虽然警告不印象该指令的运行,但是后面使用多了,可能会出现问题,而且总觉得很碍事。于是根据警告提示,最终添加如下:
true
100
true
right_wheel_joint
left_wheel_joint
${track}
${tirediam}
200
cmd_vel
odom
odom
base_link
true
true
na
true
0
5
world
1
二、tf topic携带许多额外的转换信息,包括从link2到link1和link1到base_link的部分
于是执行:
3.rosrun robot_state_publisher robot_state_publisher
出现如下警告:
[ WARN] [1542852115.539893621]: The root link base_link has an inertia specified in the URDF, but KDL does not support a root link with an inertia. As a workaround, you can add an extra dummy link to your URDF.
大致意思是根关节的base_link在urdf中具有惯性参数,但是KDL不支持,建议的解决办法是,增加一个额外的dummy link。
这里解决方法如下:
创建一个'odom'和一个'base_link'。 然后用固定的关节将它们连接起来。注意: 惯性必须放在child link上,在这种情况下为“base_link”,否则会出现错误。
找到link name=“base_link”的部分,将其中的inertial部分,注释掉,就可以了。
三、运行
4.rosrun example_tf_listener example_tf_listener
运行之前检查CMakelist文件中添加了该example_tf_listener.cpp文件没有,否则会出现无法识别该文件。
注意:修改完,编译一下,cd ~/catkin_ws,然后catkin_make,如果想针对某一个包进行编译的话,采用
catkin_make -DCATKIN_WHITELIST_PACKAGES="PACKAGE_NAME"
如果此文对你有用,请右上角点个赞~\(≧▽≦)/~