Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" ?>
- <robot name="r2d2" xmlns:xacro="http://ros.org/wiki/xacro">
- <xacro:property name="torso_m" value="10.0"/>
- <xacro:property name="torso_len" value="0.6"/>
- <xacro:property name="torso_rad" value="0.2"/>
- <xacro:property name="leg_m" value="5"/>
- <xacro:property name="leg_x" value="0.6"/>
- <xacro:property name="leg_y" value="0.1"/>
- <xacro:property name="leg_z" value="0.2"/>
- <xacro:property name="base_m" value="2"/>
- <xacro:property name="base_x" value="0.4"/>
- <xacro:property name="base_y" value="0.1"/>
- <xacro:property name="base_z" value="0.1"/>
- <xacro:property name="wheel_m" value="0.4"/>
- <xacro:property name="wheel_rad" value="0.035"/>
- <xacro:property name="wheel_len" value="0.1"/>
- <xacro:property name="head_m" value="2"/>
- <xacro:property name="head_rad" value="0.2"/>
- <xacro:property name="box_m" value="1"/>
- <xacro:property name="box_l" value="0.08"/>
- <xacro:property name="mu1" value="0.9"/>
- <xacro:property name="mu2" value="0.9"/>
- <xacro:property name="kp" value="10000000.0"/>
- <xacro:property name="kd" value="1.0"/>
- <xacro:macro name="sphere_inertial" params="radius mass">
- <inertial>
- <mass value="${mass}" />
- <origin xyz="0 0 0" />
- <inertia ixx="${0.4 * mass * radius * radius}" ixy="0.0" ixz="0.0"
- iyy="${0.4 * mass * radius * radius}" iyz="0.0"
- izz="${0.4 * mass * radius * radius}" />
- </inertial>
- </xacro:macro>
- <xacro:macro name="cylinder_inertial" params="radius length mass">
- <inertial>
- <mass value="${mass}" />
- <origin xyz="0 0 0" />
- <inertia ixx="${0.0833333 * mass * (3 * radius * radius + length * length)}" ixy="0.0" ixz="0.0"
- iyy="${0.0833333 * mass * (3 * radius * radius + length * length)}" iyz="0.0"
- izz="${0.5 * mass * radius * radius}" />
- </inertial>
- </xacro:macro>
- <xacro:macro name="box_inertial" params="x y z mass">
- <inertial>
- <mass value="${mass}" />
- <origin xyz="0 0 0" />
- <inertia ixx="${0.0833333 * mass * (y*y + z*z)}" ixy="0.0" ixz="0.0"
- iyy="${0.0833333 * mass * (x*x + z*z)}" iyz="0.0"
- izz="${0.0833333 * mass * (x*x + y*y)}" />
- </inertial>
- </xacro:macro>
- <material name="blue">
- <color rgba="0 0 0.8 1"/>
- </material>
- <material name="black">
- <color rgba="0 0 0 1"/>
- </material>
- <material name="white">
- <color rgba="1 1 1 1"/>
- </material>
- <link name="base_link">
- <visual>
- <geometry>
- <cylinder length="${torso_len}" radius="${torso_rad}"/>
- </geometry>
- <material name="blue"/>
- </visual>
- <collision>
- <geometry>
- <cylinder length="${torso_len}" radius="${torso_rad}"/>
- </geometry>
- </collision>
- <xacro:cylinder_inertial radius="${torso_rad}" length="${torso_len}" mass="${torso_m}"/>
- </link>
- <link name="right_leg">
- <visual>
- <geometry>
- <box size="${leg_x} ${leg_y} ${leg_z}"/>
- </geometry>
- <origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
- <material name="white"/>
- </visual>
- <collision>
- <geometry>
- <box size="${leg_x} ${leg_y} ${leg_z}"/>
- </geometry>
- <origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
- </collision>
- <xacro:box_inertial x="${leg_x}" y="${leg_y}" z="${leg_z}" mass="${leg_m}"/>
- </link>
- <joint name="base_to_right_leg" type="fixed">
- <parent link="base_link"/>
- <child link="right_leg"/>
- <origin xyz="0 -0.22 0.25"/>
- </joint>
- <link name="right_base">
- <visual>
- <geometry>
- <box size="${base_x} ${base_y} ${base_z}"/>
- </geometry>
- <material name="white"/>
- </visual>
- <collision>
- <geometry>
- <box size="${base_x} ${base_y} ${base_z}"/>
- </geometry>
- </collision>
- <xacro:box_inertial x="${base_x}" y="${base_y}" z="${base_z}" mass="${base_m}"/>
- </link>
- <joint name="right_base_joint" type="fixed">
- <parent link="right_leg"/>
- <child link="right_base"/>
- <origin xyz="0 0 -0.6"/>
- </joint>
- <link name="right_front_wheel">
- <visual>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- <material name="black"/>
- </visual>
- <collision>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- </collision>
- <xacro:cylinder_inertial radius="${wheel_rad}" length="${wheel_len}" mass="${wheel_m}" />
- </link>
- <joint name="right_front_wheel_joint" type="continuous">
- <axis rpy="0 0 0" xyz="0 1 0"/>
- <parent link="right_base"/>
- <child link="right_front_wheel"/>
- <origin rpy="0 0 0" xyz="0.133333333333 0 -0.085"/>
- </joint>
- <!-- This block provides the simulator (Gazebo) with information on a few additional
- physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
- <gazebo reference="right_front_wheel">
- <mu1 value="${mu1}"/>
- <mu2 value="${mu2}"/>
- <kp value="${kp}"/>
- <kd value="${kd}"/>
- <fdir1>0 1 0</fdir1>
- <material>Gazebo/Grey</material>
- </gazebo>
- <!-- This block connects the wheel joint to an actuator (motor), which informs both
- simulation and visualization of the robot -->
- <transmission name="right_front_wheel_trans">
- <type>transmission_interface/SimpleTransmission</type>
- <actuator name="right_front_wheel_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- <joint name="right_front_wheel_joint">
- <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
- </joint>
- </transmission>
- <link name="right_back_wheel">
- <visual>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- <material name="black"/>
- </visual>
- <collision>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- </collision>
- <xacro:cylinder_inertial radius="${wheel_rad}" length="${wheel_len}" mass="${wheel_m}" />
- </link>
- <joint name="right_back_wheel_joint" type="continuous">
- <axis rpy="0 0 0" xyz="0 1 0"/>
- <parent link="right_base"/>
- <child link="right_back_wheel"/>
- <origin rpy="0 0 0" xyz="-0.133333333333 0 -0.085"/>
- </joint>
- <!-- This block provides the simulator (Gazebo) with information on a few additional
- physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
- <gazebo reference="right_back_wheel">
- <mu1 value="${mu1}"/>
- <mu2 value="${mu2}"/>
- <kp value="${kp}"/>
- <kd value="${kd}"/>
- <fdir1>0 1 0</fdir1>
- <material>Gazebo/Grey</material>
- </gazebo>
- <!-- This block connects the wheel joint to an actuator (motor), which informs both
- simulation and visualization of the robot -->
- <transmission name="right_back_wheel_trans">
- <type>transmission_interface/SimpleTransmission</type>
- <actuator name="right_back_wheel_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- <joint name="right_back_wheel_joint">
- <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
- </joint>
- </transmission>
- <link name="left_leg">
- <visual>
- <geometry>
- <box size="${leg_x} ${leg_y} ${leg_z}"/>
- </geometry>
- <origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
- <material name="white"/>
- </visual>
- <collision>
- <geometry>
- <box size="${leg_x} ${leg_y} ${leg_z}"/>
- </geometry>
- <origin rpy="0 1.57075 0" xyz="0 0 -0.3"/>
- </collision>
- <xacro:box_inertial x="${leg_x}" y="${leg_y}" z="${leg_z}" mass="${leg_m}"/>
- </link>
- <joint name="base_to_left_leg" type="fixed">
- <parent link="base_link"/>
- <child link="left_leg"/>
- <origin xyz="0 0.22 0.25"/>
- </joint>
- <link name="left_base">
- <visual>
- <geometry>
- <box size="${base_x} ${base_y} ${base_z}"/>
- </geometry>
- <material name="white"/>
- </visual>
- <collision>
- <geometry>
- <box size="${base_x} ${base_y} ${base_z}"/>
- </geometry>
- </collision>
- <xacro:box_inertial x="${base_x}" y="${base_y}" z="${base_z}" mass="${base_m}"/>
- </link>
- <joint name="left_base_joint" type="fixed">
- <parent link="left_leg"/>
- <child link="left_base"/>
- <origin xyz="0 0 -0.6"/>
- </joint>
- <link name="left_front_wheel">
- <visual>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- <material name="black"/>
- </visual>
- <collision>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- </collision>
- <xacro:cylinder_inertial radius="${wheel_rad}" length="${wheel_len}" mass="${wheel_m}" />
- </link>
- <joint name="left_front_wheel_joint" type="continuous">
- <axis rpy="0 0 0" xyz="0 1 0"/>
- <parent link="left_base"/>
- <child link="left_front_wheel"/>
- <origin rpy="0 0 0" xyz="0.133333333333 0 -0.085"/>
- </joint>
- <!-- This block provides the simulator (Gazebo) with information on a few additional
- physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
- <gazebo reference="left_front_wheel">
- <mu1 value="${mu1}"/>
- <mu2 value="${mu2}"/>
- <kp value="${kp}"/>
- <kd value="${kd}"/>
- <fdir1>0 1 0</fdir1>
- <material>Gazebo/Grey</material>
- </gazebo>
- <!-- This block connects the wheel joint to an actuator (motor), which informs both
- simulation and visualization of the robot -->
- <transmission name="left_front_wheel_trans">
- <type>transmission_interface/SimpleTransmission</type>
- <actuator name="left_front_wheel_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- <joint name="left_front_wheel_joint">
- <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
- </joint>
- </transmission>
- <link name="left_back_wheel">
- <visual>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- <material name="black"/>
- </visual>
- <collision>
- <origin rpy="1.57075 0 0" xyz="0 0 0"/>
- <geometry>
- <cylinder length="${wheel_len}" radius="${wheel_rad}"/>
- </geometry>
- </collision>
- <xacro:cylinder_inertial radius="${wheel_rad}" length="${wheel_len}" mass="${wheel_m}" />
- </link>
- <joint name="left_back_wheel_joint" type="continuous">
- <axis rpy="0 0 0" xyz="0 1 0"/>
- <parent link="left_base"/>
- <child link="left_back_wheel"/>
- <origin rpy="0 0 0" xyz="-0.133333333333 0 -0.085"/>
- </joint>
- <!-- This block provides the simulator (Gazebo) with information on a few additional
- physical properties. See http://gazebosim.org/tutorials/?tut=ros_urdf for more-->
- <gazebo reference="left_back_wheel">
- <mu1 value="${mu1}"/>
- <mu2 value="${mu2}"/>
- <kp value="${kp}"/>
- <kd value="${kd}"/>
- <fdir1>0 1 0</fdir1>
- <material>Gazebo/Grey</material>
- </gazebo>
- <!-- This block connects the wheel joint to an actuator (motor), which informs both
- simulation and visualization of the robot -->
- <transmission name="left_back_wheel_trans">
- <type>transmission_interface/SimpleTransmission</type>
- <actuator name="left_back_wheel_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- <joint name="left_back_wheel_joint">
- <hardwareInterface>hardware_interface/VelocityJointInterface</hardwareInterface>
- </joint>
- </transmission>
- <link name="head">
- <visual>
- <geometry>
- <sphere radius="${head_rad}"/>
- </geometry>
- <material name="white"/>
- </visual>
- <collision>
- <geometry>
- <sphere radius="${head_rad}"/>
- </geometry>
- </collision>
- <xacro:sphere_inertial radius="${head_rad}" mass="${head_m}"/>
- </link>
- <joint name="head_swivel" type="continuous">
- <parent link="base_link"/>
- <child link="head"/>
- <axis xyz="0 0 1"/>
- <origin xyz="0 0 0.3"/>
- <limit effort="30" velocity="1.0"/>
- <dynamics damping="0.0" friction="0.0"/>
- </joint>
- <!-- This block connects the head_swivel joint to an actuator (motor), which informs both
- simulation and visualization of the robot -->
- <transmission name="head_swivel_trans">
- <type>transmission_interface/SimpleTransmission</type>
- <actuator name="$head_swivel_motor">
- <mechanicalReduction>1</mechanicalReduction>
- </actuator>
- <joint name="head_swivel">
- <hardwareInterface>hardware_interface/PositionJointInterface</hardwareInterface>
- </joint>
- </transmission>
- <link name="box">
- <visual>
- <geometry>
- <box size="${box_l} ${box_l} ${box_l}"/>
- </geometry>
- <material name="blue"/>
- <origin xyz="-0.04 0 0"/>
- </visual>
- <collision>
- <geometry>
- <box size="${box_l} ${box_l} ${box_l}"/>
- </geometry>
- </collision>
- <xacro:box_inertial x="${box_l}" y="${box_l}" z="${box_l}" mass="${box_m}"/>
- </link>
- <joint name="tobox" type="fixed">
- <parent link="head"/>
- <child link="box"/>
- <origin xyz="0.1814 0 0.1414"/>
- </joint>
- <!-- Gazebo plugin for ROS Control -->
- <gazebo>
- <plugin filename="libgazebo_ros_control.so" name="gazebo_ros_control">
- <robotNamespace>/</robotNamespace>
- </plugin>
- </gazebo>
- </robot>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement