Longitude an latitude values are not updating.

asked 2017-07-06 09:37:20 -0500

ozan192 gravatar image

updated 2017-07-07 03:14:45 -0500

I'm trying to create a GPS model so that I can later add it to a vehicle simulation. I've looked at the gps test_world file to see how I can add GPS to my model, which is just a cube. I'm getting velocity values but my longitude and latitude values are not changing. Can anyone help?

<sdf version="1.5"> <world name="default">

<!-- Global light source -->
<include>
  <uri>model://sun</uri>
</include>-->

<!-- Ground plane -->
<include>
  <uri>model://ground_plane</uri>
</include>

<spherical_coordinates>
  <surface_model>EARTH_WGS84</surface_model>
  <latitude_deg>0</latitude_deg>
  <longitude_deg>-0</longitude_deg>
  <elevation>0.0</elevation>
  <heading_deg>0</heading_deg>
</spherical_coordinates>

<model name="gps_generic">
  <!-- Give the base link a unique name -->
  <link name="body">
    <pose>0 0 0 0 0 0</pose>
    <inertial>
      <mass>1.2</mass>
      <inertia>
    <ixx>1</ixx>
    <iyy>1</iyy>
    <izz>1</izz>
    <ixy>0</ixy>
    <ixz>0</ixz>
    <iyz>0</iyz>
      </inertia>
    </inertial>
    <!-- Default Position -->

    <collision name="body_collision">
      <geometry>
    <box>
      <size>0.05 0.05 0.05</size>
    </box>
      </geometry>
    </collision>

    <!-- Visuals -->
    <visual name="body_visual">
      <geometry>
    <box>
      <size>0.05 0.05 0.05</size>
    </box>
      </geometry>
    </visual>
      <sensor name="gps" type="gps">
      <pose>0 0 0  0 0 0</pose>
      <update_rate>10.0</update_rate>
      <always_on>true</always_on>
      <gps>
        <position_sensing>
          <horizontal>
        <noise type="gaussian_quantized">
          <mean>0</mean>
          <stddev>1</stddev>
          <bias_mean>3</bias_mean>
          <bias_stddev>1</bias_stddev>
          <precision>0.5</precision>
        </noise>
          </horizontal>
          <vertical>
        <noise type="gaussian_quantized">
          <mean>0</mean>
          <stddev>1</stddev>
          <bias_mean>3</bias_mean>
          <bias_stddev>1</bias_stddev>
          <precision>1.0</precision>
        </noise>
          </vertical>
        </position_sensing>
        <velocity_sensing>
          <horizontal>
        <noise type="gaussian_quantized">
          <mean>0</mean>
          <stddev>0.1</stddev>
          <bias_mean>0.1</bias_mean>
          <bias_stddev>0.1</bias_stddev>
          <precision>0.1</precision>
        </noise>
          </horizontal>
          <vertical>
        <noise type="gaussian_quantized">
          <mean>0</mean>
          <stddev>0.2</stddev>
          <bias_mean>0.2</bias_mean>
          <bias_stddev>0.2</bias_stddev>
          <precision>0.2</precision>
        </noise>
          </vertical>
        </velocity_sensing>
      </gps>
    </sensor>
  </link>
</model>

</world> </sdf>

sensor is this case is a child of link

edit retag flag offensive close merge delete

Comments

Which version of Gazebo are you using? I tried your sensor in Gazebo 7.8 and I see variations in latitude and longitude. Can you share your entire .world file to see if I can reproduce the problem?

Carlos Agüero gravatar imageCarlos Agüero ( 2017-07-06 18:10:08 -0500 )edit

I'm using Gazebo7. I've update my code to include all of it.

ozan192 gravatar imageozan192 ( 2017-07-07 03:14:35 -0500 )edit

I tried your code and I see the latitude/longitude changing. I loaded your world, opened the topic visualization window, clicked on /gazebo/default/gps_generic/body/gps topic , and then, changed gravity Y value to 20 to make the change in latitude more evident (click on physics->gravity on the left panel).

Carlos Agüero gravatar imageCarlos Agüero ( 2017-07-07 11:47:45 -0500 )edit

I've reinstalled Gazebo7 and it's started working. Though I'm not sure what was wrong in the first place. It may be due to the fact that the model was often outside the grid which it seems the GPS does not work outside.

ozan192 gravatar imageozan192 ( 2017-07-10 04:36:00 -0500 )edit