Skip to content

Commit

Permalink
add msg -> sdf conversion for navsat
Browse files Browse the repository at this point in the history
  • Loading branch information
ashBabu committed Sep 27, 2023
1 parent 326cef2 commit 63a90d0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/Conversions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,37 @@ sdf::Sensor gazebo::convert(const msgs::Sensor &_in)

out.SetCameraSensor(sensor);
}

else if (out.Type() == sdf::SensorType::GPS ||
out.Type() == sdf::SensorType::NAVSAT)
{
sdf::NavSat sensor;
if (_in.has_gps())
{
if (_in.gps().position().has_horizontal_noise())
{
sensor.SetHorizontalPositionNoise(gazebo::convert<sdf::Noise>(_in.gps().position().horizontal_noise()));
}
if (_in.gps().position().has_vertical_noise())
{
sensor.SetVerticalPositionNoise(gazebo::convert<sdf::Noise>(_in.gps().position().vertical_noise()));
}
if (_in.gps().velocity().has_horizontal_noise())
{
sensor.SetHorizontalVelocityNoise(gazebo::convert<sdf::Noise>(_in.gps().velocity().horizontal_noise()));
}
if (_in.gps().velocity().has_vertical_noise())
{
sensor.SetVerticalVelocityNoise(gazebo::convert<sdf::Noise>(_in.gps().velocity().vertical_noise()));
}
}
else
{
ignerr << "Attempting to convert an navsat sensor message, but the "
<< "message does not have a navsat nested message.\n";
}
}

else if (out.Type() == sdf::SensorType::ALTIMETER)
{
sdf::Altimeter sensor;
Expand Down

0 comments on commit 63a90d0

Please sign in to comment.