Hi @Blazej_Sowa,
On desktop:
I’ve developed a xacro package called leo_ssom_addons_description
. I’ve tested it and it’s functioning as expected.
On the rover:
When I’m including it in the robot.urdf.xacro
file and restarting the leo service, no error is thrown but the addons aren’t displayed in the RobotModel and the TF aren’t displayed either in RViz.
<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
name="leo">
<xacro:include filename="$(find leo_description)/urdf/macros.xacro"/>
<xacro:leo default_antenna="true"
rockers_fixed="true"
footprint_link="true"
link_prefix=""
joint_prefix=""/>
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/addons.xacro"/>
</robot>
The package is properly installed and listed by rospack without running source ws/devel/setup.bash
.
rospack list | grep leo_
leo_bringup /opt/ros/noetic/share/leo_bringup
leo_description /opt/ros/noetic/share/leo_description
leo_fw /opt/ros/noetic/share/leo_fw
leo_ssom_addons_description /home/pi/Code/leo_ws/src/leo_ssom_addons_description
leo_teleop /opt/ros/noetic/share/leo_teleop
leo_viz /opt/ros/noetic/share/leo_viz
I’m testing on LeoOS 1.0.0beta1 (Ubuntu 20.04.3 LTS 5.4.0-1047-raspi)
at the moment.
I followed the Leo Rover Integrations - PhantomX Pincher tutorial as inspiration for what I need to do.
content of addons.xacro
:
<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/e_stop.xacro" />
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/mounting_plates.xacro" />
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/realsense.xacro" />
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/jetson_nano.xacro" />
</robot>
content of e_stop.xacro
<?xml version="1.0" encoding="utf-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:include filename="$(find leo_ssom_addons_description)/urdf/ssom_common.xacro" />
<xacro:ssom_link link_name="estop_guard_link" link_mesh="EStopGuard" link_origin_xyz="0 0 0" link_origin_rpy="0 ${pi/2} -${pi/2}" has_collision_mesh="true"/>
<xacro:ssom_joint joint_name="estop_guard_joint" type="fixed" parent="base_link" child="estop_guard_link" joint_origin_xyz="-0.178 0 -0.02" joint_origin_rpy="0 0 0" joint_axis_xyz="0 0 0" />
</robot>
content of ssom_common.xacro
:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:xacro="http://www.ros.org/wiki/xacro">
<!-- Adapted from the kinova-ros pkg -->
<xacro:macro name="ssom_link" params="link_name link_mesh link_origin_xyz link_origin_rpy has_collision_mesh:=false">
<link name="${link_name}">
<visual>
<geometry>
<mesh filename="package://leo_ssom_addons_description/meshes/visual/${link_mesh}.dae"/>
</geometry>
<origin xyz="${link_origin_xyz}" rpy="${link_origin_rpy}"/>
</visual>
<collision>
<geometry>
<xacro:if value="${has_collision_mesh}">
<mesh filename="package://leo_ssom_addons_description/meshes/collision/${link_mesh}.stl"/>
</xacro:if>
<xacro:unless value="${has_collision_mesh}">
<mesh filename="package://leo_ssom_addons_description/meshes/visual/${link_mesh}.dae"/>
</xacro:unless>
</geometry>
<origin xyz="${link_origin_xyz}" rpy="${link_origin_rpy}"/>
</collision>
</link>
</xacro:macro>
<xacro:macro name="ssom_joint" params="joint_name type parent child joint_origin_xyz joint_origin_rpy joint_axis_xyz">
<joint name="${joint_name}" type="${type}">
<parent link="${parent}"/>
<child link="${child}"/>
<axis xyz="${joint_axis_xyz}"/>
<origin xyz="${joint_origin_xyz}" rpy="${joint_origin_rpy}"/>
</joint>
</xacro:macro>
<xacro:macro name="virtual_link" params="link_name">
<link name="${link_name}"/>
</xacro:macro>
<xacro:macro name="virtual_joint" params="joint_name type parent child joint_axis_xyz joint_origin_xyz joint_origin_rpy joint_lower_limit joint_upper_limit">
<joint name="${joint_name}" type="${type}">
<parent link="${parent}"/>
<child link="${child}"/>
<axis xyz="${joint_axis_xyz}"/>
<limit effort="2000" velocity="1" lower="${joint_lower_limit}" upper="${joint_upper_limit}"/>
<origin xyz="${joint_origin_xyz}" rpy="${joint_origin_rpy}"/>
</joint>
</xacro:macro>
</root>