Skip to content

Commit

Permalink
add SphericalCoordinates test that expects local frame to match ENU f…
Browse files Browse the repository at this point in the history
…rame when no heading offset is provided (it currently fails)
  • Loading branch information
scpeters committed Jul 28, 2016
1 parent c2388aa commit 67dde67
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions gazebo/common/SphericalCoordinates_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,41 @@ TEST_F(SphericalCoordinatesTest, CoordinateTransforms)
common::SphericalCoordinates::SurfaceType st =
common::SphericalCoordinates::EARTH_WGS84;

// Give no heading offset to confirm ENU frame
{
ignition::math::Angle lat(0.3), lon(-1.2), heading(0.0);
double elev = 354.1;
common::SphericalCoordinates sc(st, lat, lon, elev, heading);

// Check GlobalFromLocal with no heading offset
{
// local frame
ignition::math::Vector3d xyz;
// east, north, up
ignition::math::Vector3d enu;

xyz.Set(1, 0, 0);
enu = sc.GlobalFromLocal(xyz);
EXPECT_EQ(xyz, enu);
EXPECT_EQ(xyz, sc.LocalFromGlobal(enu));

xyz.Set(0, 1, 0);
enu = sc.GlobalFromLocal(xyz);
EXPECT_EQ(xyz, enu);
EXPECT_EQ(xyz, sc.LocalFromGlobal(enu));

xyz.Set(1, -1, 0);
enu = sc.GlobalFromLocal(xyz);
EXPECT_EQ(xyz, enu);
EXPECT_EQ(xyz, sc.LocalFromGlobal(enu));

xyz.Set(2243.52334, 556.35, 435.6553);
enu = sc.GlobalFromLocal(xyz);
EXPECT_EQ(xyz, enu);
EXPECT_EQ(xyz, sc.LocalFromGlobal(enu));
}
}

{
// Parameters
ignition::math::Angle lat(0.3), lon(-1.2),
Expand Down

0 comments on commit 67dde67

Please sign in to comment.