<?xml version="1.0"?>
<robot xmlns:xacro="http://ros.org/wiki/xacro">
  <property name="M_PI" value="3.1415926535897931" />

  <xacro:macro name="battery_block" params="name parent x y z mass">

  <joint name="${parent}_${name}_joint" type="fixed">
    <origin xyz="${x} ${y} ${z}" rpy="0 0 0"/>
    <parent link="${parent}"/>
    <child link="${name}"/>
  </joint>
  <link name="${name}">
    <visual name="${name}_visual">
      <origin xyz="0 0 0" rpy="0 0 0"/>
      <geometry name="${name}_geometry">
        <box size="0.151 0.065 0.094"/>
      </geometry>
      <material name="${name}_material">
        <color rgba="0.038 0.038 0.038 1.0"/>
      </material>
    </visual>
    <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>
  </link>
  <gazebo reference="${name}">
    <material value="Gazebo/Black"/>
  </gazebo>

  </xacro:macro>

</robot>