<?xml version="1.0" ?>
<robot name="JetBot_sim"  xmlns:xacro="http://ros.org/wiki/xacro">
  <xacro:arg name="camera_visualize" default="true"/>
  <xacro:arg name="laser_visualize"  default="false"/>

  <gazebo reference="left_wheel">
    <mu1>0.1</mu1>
    <mu2>0.1</mu2>
    <kp>500.0</kp>
    <kd>10.0</kd>
    <minDepth>0.001</minDepth>
    <maxVel>0.5</maxVel>
    <fdir1>1 0 0</fdir1>
  </gazebo>

  <gazebo reference="right_wheel">
    <mu1>0.1</mu1>
    <mu2>0.1</mu2>
    <kp>500.0</kp>
    <kd>10.0</kd>
    <minDepth>0.001</minDepth>
    <maxVel>0.5</maxVel>
    <fdir1>1 0 0</fdir1>
  </gazebo>

  <gazebo>
    <plugin name="diff_drive_controller" filename="libgazebo_ros_diff_drive.so">
      <commandTopic>cmd_vel</commandTopic>
      <odometryTopic>odom</odometryTopic>
      <odometryFrame>odom</odometryFrame>
      <odometrySource>encoder</odometrySource>
      <publishOdomTF>true</publishOdomTF>
      <robotBaseFrame>base_footprint</robotBaseFrame>
      <publishWheelTF>false</publishWheelTF>
      <publishTf>true</publishTf>
      <publishWheelJointState>true</publishWheelJointState>
      <legacyMode>false</legacyMode>
      <updateRate>30</updateRate>
      <leftJoint>left_wheel_hinge</leftJoint>
      <rightJoint>right_wheel_hinge</rightJoint>
      <wheelSeparation>0.096</wheelSeparation>
      <wheelDiameter>0.065</wheelDiameter>
      <wheelAcceleration>1</wheelAcceleration>
      <wheelTorque>1</wheelTorque>
      <rosDebugLevel>na</rosDebugLevel>
    </plugin>
  </gazebo>

  <gazebo reference="camera_link">
    <sensor type="camera" name="camera">
      <always_on>true</always_on>
      <visualize>$(arg camera_visualize)</visualize>
      <camera>
          <horizontal_fov>2.79253</horizontal_fov>
          <image>
              <width>1280</width>
              <height>720</height>
              <format>R8G8B8</format>
          </image>
          <clip>
              <near>0.01</near>
              <far>1</far>
          </clip>
          <noise>
            <type>gaussian</type>
            <mean>0.0</mean>
            <stddev>0.01</stddev>
          </noise>
      </camera>
      <plugin name="camera_controller" filename="libgazebo_ros_camera.so">
        <alwaysOn>true</alwaysOn>
        <updateRate>30.0</updateRate>
        <cameraName>camera</cameraName>
        <frameName>camera_link</frameName>
        <imageTopicName>rgb/image_raw</imageTopicName>
        <cameraInfoTopicName>rgb/camera_info</cameraInfoTopicName>
        <hackBaseline>0.07</hackBaseline>
        <distortionK1>0.0</distortionK1>
        <distortionK2>0.0</distortionK2>
        <distortionK3>0.0</distortionK3>
        <distortionT1>0.0</distortionT1>
        <distortionT2>0.0</distortionT2>
      </plugin>
    </sensor>
  </gazebo>

  <gazebo reference="lidar_link">
    <sensor type="ray" name="lds_lfcd_sensor">
      <pose>0 0 0 0 0 0</pose>
      <visualize>$(arg laser_visualize)</visualize>
      <update_rate>5</update_rate>
      <ray>
        <scan>
          <horizontal>
            <samples>428</samples>
            <resolution>0.84</resolution>
            <min_angle>0</min_angle>
            <max_angle>6.28319</max_angle>
          </horizontal>
        </scan>
        <range>
          <min>0.1</min>
          <max>8</max>
          <resolution>0.01</resolution>
        </range>
        <noise>
          <type>gaussian</type>
          <mean>0.0</mean>
          <stddev>0.01</stddev>
        </noise>
      </ray>
      <plugin name="gazebo_ros_lds_lfcd_controller" filename="libgazebo_ros_laser.so">
        <topicName>scan</topicName>
        <frameName>lidar_link</frameName>
      </plugin>
    </sensor>
  </gazebo>

</robot>
