Advertisement
Guest User

Untitled

a guest
Mar 4th, 2020
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 5.51 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <robot name="balancing" xmlns:xacro="http://ros.org/wiki/xacro">
  3.  
  4. <!-- Robot shape -->
  5. <xacro:property name="W_weight" value="0.06"/>
  6. <xacro:property name="W_diam" value="0.065"/>
  7.  
  8. <xacro:property name="base_w" value="0.15"/>
  9. <xacro:property name="base_h" value="0.2"/>
  10. <xacro:property name="base_l" value=".04"/>
  11. <xacro:property name="base_weight" value="0.3"/>
  12.  
  13. <xacro:property name="Mot_l" value="0.07"/>
  14. <xacro:property name="Mot_diam" value="0.025"/>
  15. <xacro:property name="Mot_weight" value="0.1"/>
  16.  
  17. <!-- IMU -->
  18. <xacro:property name="noise" value="0.0"/>
  19.  
  20. <!-- DIFFERENTIAL DRIVE -->
  21. <xacro:property name="update_rate" value="20"/>
  22. <xacro:property name="torque" value="0.1"/>
  23.  
  24.  
  25. <!-- WHEEL -->
  26.   <xacro:macro name="wheel" params="side parent x y z">
  27.     <joint name="wheel_${side}_joint" type="continuous">
  28.       <origin xyz="${x} ${y} ${z}" rpy="0 0 0" />
  29.       <parent link="${parent}"/>
  30.       <child link="wheel_${side}_link" />
  31.       <axis xyz="0 1 0"/>
  32.     </joint>
  33.  
  34.     <link name="wheel_${side}_link">
  35.       <inertial>
  36.         <mass value="${W_weight}" />
  37.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  38.         <inertia ixx="0.0" ixy="0.0" ixz="0.0"
  39.          iyy="${W_weight/8.0 * W_diam * W_diam}" iyz="0.0"
  40.          izz="0.0" />
  41.       </inertial>
  42.  
  43.       <visual>
  44.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  45.         <geometry>
  46.              <cylinder length="0.027" radius="${W_diam/2}"/>
  47.         </geometry>
  48.       </visual>
  49.  
  50.       <collision>
  51.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  52.         <geometry>
  53.           <cylinder length="0.027" radius="${W_diam/2}"/>
  54.         </geometry>
  55.       </collision>
  56.     </link>
  57.  
  58.   <gazebo reference="wheel_${side}_link">
  59.     <mu1>0.7</mu1>
  60.     <mu2>0.7</mu2>
  61.     <kp>10000</kp>
  62.     <kd>10000</kd>
  63.     <material>Gazebo/Black</material>
  64.   </gazebo>
  65.   </xacro:macro>
  66.  
  67.  
  68. <!-- MOTOR -->
  69.   <xacro:macro name="motor" params="side parent x y z">
  70.     <joint name="motor_${side}_joint" type="fixed">
  71.       <origin xyz="${x} ${y} ${z}" rpy="0 0 0" />
  72.       <parent link="${parent}"/>
  73.       <child link="motor_${side}_link" />
  74.     </joint>
  75.  
  76.     <link name="motor_${side}_link">
  77.       <inertial>
  78.         <mass value="${Mot_weight}" />
  79.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  80.         <inertia ixx="0.0" ixy="0.0" ixz="0.0"
  81.          iyy="${Mot_weight/8.0 * Mot_diam * Mot_diam}" iyz="0.0"
  82.          izz="0.0" />
  83.       </inertial>
  84.  
  85.       <visual>
  86.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  87.         <geometry>
  88.           <cylinder length="${Mot_l}" radius="${Mot_diam/2}"/>
  89.         </geometry>
  90.       </visual>
  91.  
  92.       <collision>
  93.         <origin xyz="0 0 0" rpy="1.57075 0 0" />
  94.         <geometry>
  95.           <cylinder length="${  Mot_l}" radius="${Mot_diam/2}"/>
  96.         </geometry>
  97.       </collision>
  98.     </link>
  99.  
  100.   <gazebo reference="motor_${side}_link">
  101.     <mu1>0.7</mu1>
  102.     <mu2>0.7</mu2>
  103.     <kp>10000</kp>
  104.     <kd>10000</kd>
  105.     <material>Gazebo/Gray</material>
  106.   </gazebo>
  107.   </xacro:macro>
  108.  
  109.  
  110.  
  111.     <link name="base_link">
  112.       <inertial>
  113.         <mass value="${base_weight}" />
  114.         <origin xyz="0 0 0.0325" />
  115.         <inertia ixx="${(base_w * base_w + base_h * base_h) * base_weight /12.0}" ixy="0.0" ixz="0.0"
  116.          iyy="${(base_h * base_h + base_l * base_l) * base_weight /12.0}" iyz="0.0"
  117.          izz="${(base_w * base_w + base_l * base_l) * base_weight /12.0}" />
  118.       </inertial>
  119.  
  120.       <visual>
  121.         <origin xyz="0 0 0.0325" />
  122.         <geometry>
  123.              <box size="${base_l} ${base_w} ${base_h}"/>
  124.         </geometry>
  125.       </visual>
  126.  
  127.       <collision>
  128.         <origin xyz="0 0 0.0325" />
  129.         <geometry>
  130.              <box size="${base_l} ${base_w} ${base_h}"/>
  131.         </geometry>
  132.       </collision>
  133.     </link>
  134.  
  135.   <gazebo reference="base_link">
  136.     <mu1>0.3</mu1>
  137.     <mu2>0.3</mu2>
  138.     <kp>10000</kp>
  139.     <kd>10000</kd>
  140.     <material>Gazebo/White</material>
  141.   </gazebo>
  142.  
  143.     <xacro:motor parent="base_link" side="dx" x="0" y="0.04" z="-${base_h/2-Mot_diam/2}"/>
  144.     <xacro:motor parent="base_link" side="sx" x="0" y="-0.04" z="-${base_h/2-Mot_diam/2}"/>
  145.     <xacro:wheel parent="motor_dx_link" side="dx" x="0" y="0.05" z="0"/>
  146.     <xacro:wheel parent="motor_sx_link" side="sx" x="0" y="-0.05" z="0"/>
  147.  
  148.  
  149.  
  150. <!--  SENSORS -->
  151.   <gazebo>
  152.     <plugin name="imu_plugin" filename="libgazebo_ros_imu.so">
  153.       <alwaysOn>true</alwaysOn>
  154.       <bodyName>base_link</bodyName>
  155.       <topicName>imu</topicName>
  156.       <serviceName>imu_service</serviceName>
  157.       <gaussianNoise>${noise}</gaussianNoise>
  158.       <updateRate>20.0</updateRate>
  159.     </plugin>
  160.   </gazebo>
  161.  
  162.  
  163. <!-- DIFFERENTIAL DRIVE -->
  164. <gazebo>
  165.   <plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
  166.     <legacyMode>false</legacyMode>
  167.     <alwaysOn>true</alwaysOn>
  168.     <updateRate>${update_rate}</updateRate>
  169.     <leftJoint>wheel_dx_joint</leftJoint>
  170.     <rightJoint>wheel_sx_joint</rightJoint>
  171.     <wheelSeparation>0.2</wheelSeparation>
  172.     <wheelDiameter>${W_diam}</wheelDiameter>
  173.     <torque>${torque}</torque>
  174.     <commandTopic>cmd_vel</commandTopic>
  175.     <odometryTopic>odom</odometryTopic>
  176.     <odometryFrame>odom</odometryFrame>
  177.     <robotBaseFrame>base_linkS</robotBaseFrame>
  178.  
  179.     <wheelTorque>${torque}</wheelTorque>
  180.     <wheelAcceleration>0</wheelAcceleration>
  181.     <publishWheelJointState>true</publishWheelJointState>
  182.     <publishOdomTF>true</publishOdomTF>
  183.     <publishWheelTF>true</publishWheelTF>
  184.  
  185.  
  186.   </plugin>
  187. </gazebo>
  188.  
  189.  
  190. </robot>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement