道歉很长的帖子。我创建了以下xacro文件,当我使用以下启动文件加载凉亭时,机器人不会直立并跌倒。我为不同的链接尝试了不同的质量值,但没有运气。看起来我错过了什么,有人可以帮忙吗?
<?xml version="1.0" ?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
name="rosbot_v1">
<!--Formula for calculation of mass moment of inertia of a cylinder
is given by the following formula:
Reference: http://www.amesweb.info/SectionalPropertiesTabs/Mass-Moment-of-Inertia-Cylinder.aspx
Mass moment of inertia about x axis Ix Ix= (m/12) * (3r^2+h^2)
Mass moment of inertia about y axis Iy Iy= (m/12) * (3r^2+h^2)
Mass moment of inertia about z axis Iz Iz= (mr2)/2-->
<xacro:macro name="inertial_matrix_cylinder" params="mass arm_radius arm_length">
<inertial>
<mass value="${mass}" />
<inertia ixx="${mass*(3*arm_radius*arm_radius+arm_length*arm_length)/12}"
ixy = "0" ixz = "0"
iyy="${mass*(3*arm_radius*arm_radius+arm_length*arm_length)/12}" iyz = "0"
izz="${mass*arm_radius*arm_radius/2}" />
</inertial>
</xacro:macro>
<!--Physical attributes definition for base box-->
<xacro:property name="base_box_length" value="1" />
<xacro:property name="base_box_width" value="1" />
<xacro:property name="base_box_height" value="0.6" />
<xacro:property name="base_box_mass" value="4" />
<!--Physical attributes definition for the swivel arm-->
<xacro:property name="swivel_arm_length" value="0.2" />
<xacro:property name="swivel_arm_radius" value="0.2" />
<xacro:property name="swivel_arm_mass" value="1" />
<!--Physical attributes definition for the arms-->
<xacro:property name="arm_length" value="1" />
<xacro:property name="arm_radius" value="0.1" />
<xacro:property name="arm_mass" value="0.1" />
<!--Physical attributes definition for gripper box-->
<xacro:property name="gripper_box_length" value="0.5" />
<xacro:property name="gripper_box_width" value="0.4" />
<xacro:property name="gripper_box_height" value="0.2" />
<xacro:property name="gripper_box_mass" value="0.01" />
<!--Physical attributes definition for gripper fingers-->
<xacro:property name="gripper_finger_length" value="0.12" />
<xacro:property name="gripper_finger_width" value="0.4" />
<xacro:property name="gripper_finger_height" value="0.12" />
<xacro:property name="gripper_finger_mass" value="0.001" />
<!--Formula for calculation of mass moment of inertia of a cuboid
is given by the following formula: a=x(length); b=y(width)
Mass moment of inertia about x axis Ix Ix= (M/12) * a^2
Mass moment of inertia about y axis Iy Iy= (M/12) * b^2
Mass moment of inertia about z axis Iz Iz= (1/12)*M*(a^2+b^2)-->
<xacro:macro name="inertial_matrix_cuboid" params="mass box_length box_width">
<inertial>
<mass value="${mass}" />
<inertia ixx="${mass/12*(box_length*box_length)}"
ixy = "0" ixz = "0"
iyy="${mass/12*(box_width*box_width)}" iyz = "0"
izz="${mass/12*(box_length*box_length + box_width*box_width)}" />
</inertial>
</xacro:macro>
<material name="blue">
<color rgba="0 0 0.8 1"/>
</material>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
<material name="green">
<color rgba="0 1 0 1"/>
</material>
<material name="cyan">
<color rgba="0 1 1 1"/>
</material>
<!-- world link -->
<link name="base_link"/>
<link name="rosbot_base">
<xacro:inertial_matrix_cuboid mass="${base_box_mass}" box_length="${base_box_length}" box_width="${base_box_width}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="${base_box_length} ${base_box_width} ${base_box_height}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<box size="${base_box_length} ${base_box_width} ${base_box_height}"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<!-- base_link and its fixed joint -->
<joint name="joint_fix" type="fixed">
<parent link="base_link"/>
<child link="rosbot_base"/>
</joint>
<!-- A swiveling base on which next arm will sit -->
<link name="rosbot_swivel_base">
<xacro:inertial_matrix_cylinder mass="${swivel_arm_mass}" arm_length="${swivel_arm_length}" arm_radius="${swivel_arm_radius}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="0 0 ${swivel_arm_length/2}"/>
<geometry>
<cylinder length="${swivel_arm_length}" radius="${swivel_arm_radius}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="0 0 ${swivel_arm_length/2}"/>
<geometry>
<cylinder length="${swivel_arm_length}" radius="${swivel_arm_radius}"/>
</geometry>
<material name="white"/>
</visual>
</link>
<!-- The joint between swivel and base needs to be flush on the top face of rosbot_base -->
<joint name="rosbot_base_swivel_joint" type="revolute">
<parent link="rosbot_base"/>
<child link="rosbot_swivel_base"/>
<origin rpy="0 0 0" xyz="0 0 ${base_box_height/2}"/>
<axis xyz="0 0 1"/>
<limit effort="100" lower="-1.57" upper="1.57" velocity="100"/>
</joint>
<!-- A moving/manipulating arm1 -->
<link name="rosbot_arm1">
<xacro:inertial_matrix_cylinder mass="${arm_mass}" arm_length="${arm_length}" arm_radius="${arm_radius}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="0 0 ${arm_length/2}"/>
<geometry>
<cylinder length="${arm_length}" radius="${arm_radius}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="0 0 ${arm_length/2}"/>
<geometry>
<cylinder length="${arm_length}" radius="${arm_radius}"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<!-- The joint between swivel and arm1 needs to be at the height of swivel link -->
<joint name="rosbot_swivel_arm1_joint" type="revolute">
<parent link="rosbot_swivel_base"/>
<child link="rosbot_arm1"/>
<origin rpy="0 0 0" xyz="0 0 ${swivel_arm_length}"/>
<axis xyz="1 0 0"/>
<limit effort="100" lower="-1.57" upper="1.57" velocity="100"/>
</joint>
<!-- A moving/manipulating arm2 -->
<link name="rosbot_arm2">
<xacro:inertial_matrix_cylinder mass="${arm_mass}" arm_length="${arm_length}" arm_radius="${arm_radius}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="0 0 ${arm_length/2}"/>
<geometry>
<cylinder length="${arm_length}" radius="${arm_radius}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="0 0 ${arm_length/2}"/>
<geometry>
<cylinder length="${arm_length}" radius="${arm_radius}"/>
</geometry>
<material name="blue"/>
</visual>
</link>
<!-- The joint between arm1 and arm2 needs to be at height of arm1 -->
<joint name="rosbot_arm1_arm2_joint" type="revolute">
<parent link="rosbot_arm1"/>
<child link="rosbot_arm2"/>
<origin rpy="0 0 0" xyz="0 0 ${arm_length}"/>
<axis xyz="1 0 0"/>
<limit effort="100" lower="-1.57" upper="1.57" velocity="100"/>
</joint>
<!-- A gripper box, which holds the gripper joints -->
<link name="rosbot_gripper_box">
<xacro:inertial_matrix_cuboid mass="${gripper_box_mass}" box_length="${gripper_box_length}" box_width="${gripper_box_width}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="0 0 ${gripper_box_height/2}"/>
<geometry>
<box size="${gripper_box_length} ${gripper_box_width} ${gripper_box_height}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="0 0 ${gripper_box_height/2}"/>
<geometry>
<box size="${gripper_box_length} ${gripper_box_width} ${gripper_box_height}"/>
</geometry>
<material name="cyan"/>
</visual>
</link>
<!-- The joint between arm2 and gripper needs to be at height of arm2 -->
<joint name="rosbot_arm2_gripper_joint" type="revolute">
<parent link="rosbot_arm2"/>
<child link="rosbot_gripper_box"/>
<origin rpy="0 0 0" xyz="0 0 ${arm_length}"/>
<axis xyz="0 0 1"/>
<limit effort="100" lower="-1.57" upper="1.57" velocity="100"/>
</joint>
<!-- The left gripper -->
<link name="rosbot_lgripper">
<xacro:inertial_matrix_cuboid mass="${gripper_finger_mass}" box_length="${gripper_finger_length}" box_width="${gripper_finger_width}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="-0.0 0.20 ${gripper_finger_height/2}"/>
<geometry>
<box size="${gripper_finger_length} ${gripper_finger_width} ${gripper_finger_height}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="-0.0 0.20 ${gripper_finger_height/2}"/>
<geometry>
<box size="${gripper_finger_length} ${gripper_finger_width} ${gripper_finger_height}"/>
</geometry>
<material name="green"/>
</visual>
</link>
<!-- The joint between gripper box and gripper needs to be at origin/slightly higher than origin of gripper box -->
<joint name="rosbot_lgripper_joint" type="prismatic">
<parent link="rosbot_gripper_box"/>
<child link="rosbot_lgripper"/>
<origin rpy="0 0 0" xyz="-0.2 0.2 0.02"/>
<axis xyz="1 0 0"/>
<limit effort="100" lower="0" upper="0.14" velocity="100"/>
</joint>
<!-- The right gripper -->
<link name="rosbot_rgripper">
<xacro:inertial_matrix_cuboid mass="${gripper_finger_mass}" box_length="${gripper_finger_length}" box_width="${gripper_finger_width}"/>
<collision name="rosbot_collision">
<origin rpy="0 0 0" xyz="-0.0 0.20 ${gripper_finger_height/2}"/>
<geometry>
<box size="${gripper_finger_length} ${gripper_finger_width} ${gripper_finger_height}"/>
</geometry>
</collision>
<visual name="rosbot_visual">
<origin rpy="0 0 0" xyz="-0.0 0.20 ${gripper_finger_height/2}"/>
<geometry>
<box size="${gripper_finger_length} ${gripper_finger_width} ${gripper_finger_height}"/>
</geometry>
<material name="green"/>
</visual>
</link>
<!-- The joint between gripper box and gripper needs to be at origin or slightly higher than origin of gripper box -->
<joint name="rosbot_rgripper_joint" type="prismatic">
<parent link="rosbot_gripper_box"/>
<child link="rosbot_rgripper"/>
<origin rpy="0 0 0" xyz="0.2 0.2 0.02"/>
<axis xyz="1 0 0"/>
<limit effort="100" lower="-0.14" upper="0" velocity="100"/>
</joint>
</robot>
当我在Gazebo中编辑模型然后切换静态标志时,它似乎是稳定的。
答案 0 :(得分:0)
我可以通过将摩擦和阻尼元素添加到URDF文件来解决此问题。
<xacro:property name="damping_value" value="10" />
<xacro:property name="friction_value" value="0.1" />
关节中属性的示例用法如下:
<!-- The joint between swivel and base needs to be flush on the top face of rosbot_base -->
<joint name="rosbot_base_swivel_joint" type="revolute">
<parent link="rosbot_base"/>
<child link="rosbot_swivel_base"/>
<origin rpy="0 0 0" xyz="0 0 ${base_box_height/2}"/>
<axis xyz="0 0 1"/>
<limit effort="100" lower="-1.57" upper="1.57" velocity="100"/>
<dynamics damping="${damping_value}" friction="${friction_value}"/>
</joint>