PDA

View Full Version : Basic / Starter URDF for hexapod



r3n33
03-31-2015, 03:15 PM
I am in the process of creating a urdf for the phantomx hexapod and I've seen a couple examples from KevinO and Upgrayd of working quad/hex models. If anyone is willing could you please provide your urdf to give me a jump start on the process?

TIA!

KevinO
03-31-2015, 03:55 PM
My URDF is auto generated from a xacro macro file on launch. Anyway here is an example.




<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro" name="Golem">

<!-- parameters -->
<xacro:property name="pi" value="3.1415926535897931" />
<xacro:property name="body_length_x" value="0.3556" />
<xacro:property name="body_length_y" value="0.165" />
<xacro:property name="coxa_length" value="0.05893" />
<xacro:property name="femur_length" value="0.10798" />
<xacro:property name="tibia_length" value="0.08774" />
<xacro:property name="tarsus_length" value="0.12065" />

<!-- Build the body frame -->
<link name="base_link" />

<joint name="base_joint" type="fixed">
<parent link="base_link" />
<child link="body" />
<origin xyz="0 0 0" rpy="0 0 0" />
</joint>
<link name="body">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hexapod_description/meshes/body.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.7 0.7 0.7 1" />
</material>
</visual>
</link>

<!-- Joint properties -->
<xacro:property name="joint_lower_limit" value="-${3.14}" />
<xacro:property name="joint_upper_limit" value="${3.14}" />
<xacro:property name="joint_effort" value="10000" />
<xacro:property name="joint_velocity" value="100" />

<!-- Leg macro -->
<xacro:macro name="leg" params="side position x y angle axis">

<!-- leg position -->
<joint name="leg_center_joint_${side}${position}" type="fixed">
<origin xyz="${x} ${y} 0" rpy="0 0 0" />
<parent link="body" />
<child link="leg_center_${side}${position}" />
</joint>

<link name="leg_center_${side}${position}" />

<!-- coxa -->
<joint name="coxa_joint_${side}${position}" type="revolute">
<origin xyz="0 0 0" rpy="0 0 ${angle}" />
<parent link="leg_center_${side}${position}" />
<child link="coxa_${side}${position}" />
<axis xyz="0 0 ${axis}" />
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}" />
</joint>
<link name="coxa_${side}${position}">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hexapod_description/meshes/coxa.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.7 0.7 0.7 1" />
</material>
</visual>
</link>

<!-- femur -->
<joint name="femur_joint_${side}${position}" type="revolute">
<origin xyz="${coxa_length} 0 0" rpy="-${pi/2} 0 0" />
<parent link="coxa_${side}${position}" />
<child link="femur_${side}${position}" />
<axis xyz="0 0 ${axis}" />
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}" />
</joint>
<link name="femur_${side}${position}">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hexapod_description/meshes/femur.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.7 0.7 0.7 1" />
</material>
</visual>
</link>

<!-- tibia -->
<joint name="tibia_joint_${side}${position}" type="revolute">
<origin xyz="0 -${femur_length} 0" rpy="${pi} 0 0" />
<parent link="femur_${side}${position}" />
<child link="tibia_${side}${position}" />
<axis xyz="0 0 ${axis}" />
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}" />
</joint>
<link name="tibia_${side}${position}">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hexapod_description/meshes/tibia.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.7 0.7 0.7 1" />
</material>
</visual>
</link>

<!-- tarsus -->
<joint name="tarsus_joint_${side}${position}" type="revolute">
<origin xyz="${tibia_length} 0 0" rpy="0 0 -${pi/2}" />
<parent link="tibia_${side}${position}" />
<child link="tarsus_${side}${position}" />
<axis xyz="0 0 ${axis}" />
<limit lower="${joint_lower_limit}" upper="${joint_upper_limit}" effort="${joint_effort}" velocity="${joint_velocity}" />
</joint>
<link name="tarsus_${side}${position}">
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
<mesh filename="package://hexapod_description/meshes/tarsus.stl" scale="0.001 0.001 0.001"/>
</geometry>
<material name="">
<color rgba="0.7 0.7 0.7 1" />
</material>
</visual>
</link>
</xacro:macro>

<!-- Build robot model -->
<xacro:leg side="R" position="R" x="0.1778" y="-0.0825" angle="-${pi/4}" axis="1" />
<xacro:leg side="R" position="M" x="0.0" y="-0.13335" angle="-${pi/2}" axis="1" />
<xacro:leg side="R" position="F" x="-0.1778" y="-0.0825" angle="-${pi*3/4}" axis="1" />
<xacro:leg side="L" position="R" x="0.1778" y="0.0825" angle="${pi/4}" axis="-1" />
<xacro:leg side="L" position="M" x="0.0" y="0.13335" angle="${pi/2}" axis="-1" />
<xacro:leg side="L" position="F" x="-0.1778" y="0.0825" angle="${pi*3/4}" axis="-1" />

</robot>

r3n33
03-31-2015, 06:07 PM
Ah hah!

That is what I needed to know! Now to abort the text editor and do it the right way =P

Edit: Well it at least gets me on a new track. I was going about it the long hard way and probably would have spent too much time with little result.

Thank you!