问题描述
我创建了一个场景,在其中一个河内塔放置在一个支撑箱的顶部,该支撑箱站在机器人旁边的桌子上。 木板和支撑盒与世界基准具有固定的连接,迫使它们固定在该位置。
稍后应由机械手抓住的磁盘没有这样的固定关节,并在板的顶部生成,向下滑动到合适的位置。 但是,正如您在图像中看到的那样,最低的磁盘沉入了主板,并以某种方式忽略了表的冲突属性(可视化和冲突均基于相同的.stl文件)。另外,如果您将多个标记堆叠在一起,它们会根据其碰撞属性适当堆叠。
我在ubuntu 18.04 LTS上使用gazebo 9.0.0和最新版本的ros-melodic
board.urdf.xacro
<?xml version="1.0"?>
<robot name="edo"
xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- Import Rviz colors -->
<xacro:include filename="$(find hanoi_tower_description)/urdf/materials.xacro" />
<!--Import the edo macro -->
<xacro:include filename="$(find hanoi_tower_description)/urdf/towers_of_hanoi_board.xacro"/>
<xacro:arg name="board_name" default="towers_of_hanoi_board"/>
<xacro:arg name="origin_xyz" default="0 0 0"/>
<xacro:arg name="origin_rpy" default="0 0 0"/>
<!-- Fix to world just for testing -->
<link name="world"/>
<gazebo reference="world">
<static>true</static>
</gazebo>
<xacro:towers_of_hanoi_board board_name="$(arg board_name)" parent="world">
<origin xyz="$(arg origin_xyz)" rpy="$(arg origin_rpy)" />
</xacro:towers_of_hanoi_board>
</robot>
board.xacro
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- <xacro:include filename="$(find edo_description)/urdf/utilities.xacro" /> -->
<xacro:macro name="towers_of_hanoi_board" params="parent board_name *origin">
<!--joint between {parent} and base_link-->
<joint name="${parent}_${board_name}_joint" type="fixed">
<xacro:insert_block name="origin"/>
<parent link="${parent}"/>
<child link="${board_name}_base_link"/>
</joint>
<link name="${board_name}_base_link">
<inertial>
<origin xyz="0 0 0" rpy="0 0 0"/>
<mass value="0.07"/>
<inertia ixx="0" ixy="0" ixz="0" iyy="0" iyz="0" izz="0" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://hanoi_tower_description/meshes/towers_of_hanoi/hanoi-board.stl"/>
</geometry>
<material name="brown"/>
</visual>
<collision>
<origin xyz="0 0 0" rpy="0 0 0"/>
<geometry>
<mesh filename="package://hanoi_tower_description/meshes/towers_of_hanoi/hanoi-board.stl"/>
</geometry>
<material name="brown"/>
</collision>
</link>
<gazebo reference="${board_name}_base_link">
<material>Gazebo/Wood</material>
</gazebo>
</xacro:macro>
</robot>
token.xacro
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:property name="color" value="White" />
<xacro:property name="diameter" value="0.07" />
<xacro:property name="hole_diameter" value="0.012" />
<xacro:property name="height" value="0.015" />
<xacro:property name="name" value="700" />
<!-- mass in KG -->
<xacro:property name="mass" value="0.1" />
<xacro:macro name="hanoi_token" params="name mass height color diameter hole_diameter">
<xacro:property name="Box_width" value="${(diameter - hole_diameter) / 2}" />
<xacro:property name="Box_center" value="${(Box_width + hole_diameter) / 2}" />
<link name="token_d${name}_link">
<inertial>
<origin xyz="0 0 ${height / 2}"/>
<mass value="${ mass }" />
<!-- See https://www.amesweb.info/SectionalPropertiesTabs/Mass-Moment-Inertia-Hollow-Cylinder-Shaft.aspx -->
<inertia ixx="${(mass / 12) * ( 3 * ( (diameter / 2) * (diameter / 2) + (hole_diameter / 2) * (hole_diameter / 2)) + (height * height))}" ixy="0.0" ixz="0.0" iyy="${(mass / 12) * ( 3 * ( (diameter / 2) * (diameter / 2) + (hole_diameter / 2) * (hole_diameter / 2)) + (height * height))}" iyz="0.0" izz="${(mass / 2) * ( (diameter / 2) * (diameter / 2) + (hole_diameter / 2) * (hole_diameter / 2) )}" />
</inertial>
<visual>
<origin rpy="0 0 0" xyz="0 0 0"/>
<geometry>
<mesh filename="package://hanoi_tower_description/meshes/towers_of_hanoi/token-${name}.stl" />
</geometry>
<material name="${color}"/>
</visual>
<collision name="collision_d${name}_b1">
<origin rpy="0 0 0" xyz="0 ${Box_center} ${height / 2}"/>
<geometry>
<Box size="${diameter} ${Box_width} ${height}"/>
</geometry>
</collision>
<collision name="collision_d${name}_b2">
<origin rpy="0 0 0" xyz="0 -${Box_center} ${height / 2}"/>
<geometry>
<Box size="${diameter} ${Box_width} ${height}"/>
</geometry>
</collision>
<collision name="collision_d${name}_b3">
<origin rpy="0 0 0" xyz="-${Box_center} 0 ${height / 2}"/>
<geometry>
<Box size="${Box_width} ${hole_diameter} ${height}"/>
</geometry>
</collision>
<collision name="collision_d${name}_b4">
<origin rpy="0 0 0" xyz="${Box_center} 0 ${height / 2}"/>
<geometry>
<Box size="${Box_width} ${hole_diameter} ${height}"/>
</geometry>
</collision>
</link>
<gazebo reference="token_d${name}_link">
<minDepth>0.001</minDepth>
<maxVel>0.01</maxVel>
<kp>1e8</kp>
<kd>1</kd>
<dampingFactor>0.8</dampingFactor>
<material>Gazebo/${color}</material>
</gazebo>
</xacro:macro>
</robot>
token-d700.urdf.xacro(最低令牌)
<?xml version="1.0"?>
<robot name="token_d700"
xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find hanoi_tower_description)/urdf/materials.xacro" />
<!--Import the hanoi_token macro -->
<xacro:include filename="$(find hanoi_tower_description)/urdf/hanoi_token.xacro"/>
<xacro:hanoi_token name="700" diameter="0.07" hole_diameter="0.012" height="0.015" color="Purple" mass="0.45">
</xacro:hanoi_token>
</robot>
编辑: 我检查了场景中的碰撞对象,看来这是一个视觉错误link to the collision object highlighted image
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)