今天在导出urdf模型时出现了一个问题,在rviz中显示发现有个joint并非预期的状态
如下图所示,其中joint2发生了错乱:
原始的urdf文件:
<?xml version="1.0" encoding="utf-8"?>
<!-- This URDF was automatically created by SolidWorks to URDF Exporter! Originally created by Stephen Brawner (brawner@gmail.com)
Commit Version: 1.6.0-4-g7f85cfe Build Version: 1.6.7995.38578
For more information, please see http://wiki.ros.org/sw_urdf_exporter -->
<robot
name="se3_description">
<link
name="base_link">
<inertial>
<origin
xyz="0.03371927358229 -0.00693912573462216 0.0104320457667665"
rpy="0 0 0" />
<mass
value="0.0392752456357408" />
<inertia
ixx="3.53570667271846E-05"
ixy="-1.01748508645426E-07"
ixz="-3.26773683852075E-06"
iyy="8.15549885015669E-05"
iyz="-2.3165541587359E-08"
izz="4.66619387588186E-05" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/base_link.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/base_link.STL" />
</geometry>
</collision>
</link>
<link
name="link_1">
<inertial>
<origin
xyz="-0.000126481098028286 0.113860770319563 0.0461074749661343"
rpy="0 0 0" />
<mass
value="0.58138071708807" />
<inertia
ixx="0.00663535213769273"
ixy="3.7342748087488E-05"
ixz="1.76239221832555E-05"
iyy="0.00234801409041878"
iyz="-0.00200710400614651"
izz="0.00518727033246825" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_1.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_1.STL" />
</geometry>
</collision>
</link>
<joint
name="joint_1"
type="revolute">
<origin
xyz="0 -0.027 0"
rpy="1.5708 0 0" />
<parent
link="base_link" />
<child
link="link_1" />
<axis
xyz="0 0 1" />
<limit
lower="-3"
upper="3"
effort="10"
velocity="3" />
</joint>
<link
name="link_2">
<inertial>
<origin
xyz="4.94785167774615E-05 -0.069214178098863 -0.0759822559756005"
rpy="0 0 0" />
<mass
value="0.521067333651935" />
<inertia
ixx="0.00460318945281812"
ixy="-9.93846010494784E-07"
ixz="-7.69240774141828E-07"
iyy="0.00331465631266174"
iyz="-0.00168475685461746"
izz="0.00205663407045774" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_2.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_2.STL" />
</geometry>
</collision>
</link>
<joint
name="joint_2"
type="revolute">
<origin
xyz="0 0.214 0.154"
rpy="1.5708 -1.5708 0" />
<parent
link="link_1" />
<child
link="link_2" />
<axis
xyz="0 0 1" />
<limit
lower="-3"
upper="3"
effort="10"
velocity="3" />
</joint>
<link
name="link_3">
<inertial>
<origin
xyz="-0.000731519171781902 -1.71491504873632E-06 -0.00538666392288201"
rpy="0 0 0" />
<mass
value="0.10045352817017" />
<inertia
ixx="9.34891802432462E-05"
ixy="4.65932230785616E-09"
ixz="-1.39286122821083E-06"
iyy="8.99853824182183E-05"
iyz="9.16498804670062E-09"
izz="0.000125232591895938" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_3.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_3.STL" />
</geometry>
</collision>
</link>
<joint
name="joint_3"
type="revolute">
<origin
xyz="4.6717E-05 -0.1685 -0.214"
rpy="1.5708 1.5708 0" />
<parent
link="link_2" />
<child
link="link_3" />
<axis
xyz="0 0.00027725 1" />
<limit
lower="-3"
upper="3"
effort="10"
velocity="3" />
</joint>
<link
name="link_4">
<inertial>
<origin
xyz="-0.132285786719768 2.73290738104538E-06 0.00978894034881642"
rpy="0 0 0" />
<mass
value="0.640378439560018" />
<inertia
ixx="0.000728261712425884"
ixy="3.35095189027826E-08"
ixz="0.000113448744553883"
iyy="0.00661754544710492"
iyz="1.86280465164432E-07"
izz="0.00728986050460479" />
</inertial>
<visual>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_4.STL" />
</geometry>
<material
name="">
<color
rgba="1 1 1 1" />
</material>
</visual>
<collision>
<origin
xyz="0 0 0"
rpy="0 0 0" />
<geometry>
<mesh
filename="package://se3_description/meshes/link_4.STL" />
</geometry>
</collision>
</link>
<joint
name="joint_4"
type="fixed">
<origin
xyz="0.285 0 0"
rpy="0 0 0" />
<parent
link="link_3" />
<child
link="link_4" />
<axis
xyz="0 0 0" />
</joint>
</robot>
目前这个位姿不是我先前在SW中定义的,下面给出解决方法:
将joint2部分的原始xml代码:
<joint
name="joint_2"
type="revolute">
<origin
xyz="0 0.214 0.154"
rpy="1.5708 -1.5708 0" />
<parent
link="link_1" />
<child
link="link_2" />
<axis
xyz="0 0 1" />
<limit
lower="-3"
upper="3"
effort="10"
velocity="3" />
</joint>
中的origin标签的rpy部分进行改动,我将rpy中的y改为了3.14(原先是0)
<origin
xyz="0 0.214 0.154"
rpy="1.5708 -1.5708 3.14" />
再次启动rviz,发现问题得到了解决:
上图中外骨骼的urdf显示为正常状态