diff --git a/gtsam_unstable/geometry/Event.cpp b/gtsam_unstable/geometry/Event.cpp index 09cedb512..5248241e1 100644 --- a/gtsam_unstable/geometry/Event.cpp +++ b/gtsam_unstable/geometry/Event.cpp @@ -21,7 +21,4 @@ namespace gtsam { -const double Event::Speed = 330; -const Matrix14 Event::JacobianZ = (Matrix14() << 0,0,0,1).finished(); - } //\ namespace gtsam diff --git a/gtsam_unstable/geometry/Event.h b/gtsam_unstable/geometry/Event.h index 3c622924a..dd362c7f4 100644 --- a/gtsam_unstable/geometry/Event.h +++ b/gtsam_unstable/geometry/Event.h @@ -33,10 +33,6 @@ class Event { public: enum { dimension = 4 }; - /// Speed of sound - static const double Speed; - static const Matrix14 JacobianZ; - /// Default Constructor Event() : time_(0) { @@ -57,6 +53,7 @@ public: // TODO we really have to think of a better way to do linear arguments double height(OptionalJacobian<1,4> H = boost::none) const { + static const Matrix14 JacobianZ = (Matrix14() << 0,0,0,1).finished(); if (H) *H = JacobianZ; return location_.z(); } @@ -87,6 +84,7 @@ public: double toa(const Point3& microphone, // OptionalJacobian<1, 4> H1 = boost::none, // OptionalJacobian<1, 3> H2 = boost::none) const { + static const double Speed = 330; Matrix13 D1, D2; double distance = location_.distance(microphone, D1, D2); if (H1) diff --git a/gtsam_unstable/geometry/tests/testEvent.cpp b/gtsam_unstable/geometry/tests/testEvent.cpp index 433ca7e7f..0842e2146 100644 --- a/gtsam_unstable/geometry/tests/testEvent.cpp +++ b/gtsam_unstable/geometry/tests/testEvent.cpp @@ -45,13 +45,13 @@ TEST( Event, Constructor ) { //***************************************************************************** TEST( Event, Toa1 ) { Event event(0, 1, 0, 0); - double expected = 1 / Event::Speed; + double expected = 1. / 330; EXPECT_DOUBLES_EQUAL(expected, event.toa(microphoneAt0), 1e-9); } //***************************************************************************** TEST( Event, Toa2 ) { - double expectedTOA = timeOfEvent + 1 / Event::Speed; + double expectedTOA = timeOfEvent + 1. / 330; EXPECT_DOUBLES_EQUAL(expectedTOA, exampleEvent.toa(microphoneAt0), 1e-9); } @@ -79,7 +79,7 @@ TEST( Event, Expression ) { Values values; values.insert(key, exampleEvent); - double expectedTOA = timeOfEvent + 1 / Event::Speed; + double expectedTOA = timeOfEvent + 1. / 330; EXPECT_DOUBLES_EQUAL(expectedTOA, expression.value(values), 1e-9); }