Do SIFT and send out the results
Don't yet have the math for calculating poses based on these results.
Change-Id: I6494dbf1d3a7c13db902cf00b7c362a2a956691b
diff --git a/aos/time/time.cc b/aos/time/time.cc
index a0423ea..03fe45b 100644
--- a/aos/time/time.cc
+++ b/aos/time/time.cc
@@ -115,6 +115,12 @@
struct timespec to_timespec(const ::aos::monotonic_clock::time_point time) {
return to_timespec(time.time_since_epoch());
}
+
+::aos::monotonic_clock::time_point from_timeval(struct timeval t) {
+ return monotonic_clock::epoch() + std::chrono::seconds(t.tv_sec) +
+ std::chrono::microseconds(t.tv_usec);
+}
+
} // namespace time
constexpr monotonic_clock::time_point monotonic_clock::min_time;
diff --git a/aos/time/time.h b/aos/time/time.h
index 27e4c70..e31de5c 100644
--- a/aos/time/time.h
+++ b/aos/time/time.h
@@ -99,6 +99,9 @@
// epoch.
struct timespec to_timespec(::aos::monotonic_clock::time_point time);
+// Converts a timeval object to a monotonic_clock::time_point.
+::aos::monotonic_clock::time_point from_timeval(struct timeval t);
+
namespace time_internal {
template <class T>
diff --git a/aos/time/time_test.cc b/aos/time/time_test.cc
index 8edaf9b..c5eb634 100644
--- a/aos/time/time_test.cc
+++ b/aos/time/time_test.cc
@@ -49,6 +49,21 @@
EXPECT_EQ(neg_time.tv_nsec, 0);
}
+// Tests from_timeval.
+TEST(TimeTest, TimevalToTimePoint) {
+ struct timeval pos_time;
+ pos_time.tv_sec = 1432423;
+ pos_time.tv_usec = 0;
+ EXPECT_EQ(::aos::monotonic_clock::epoch() + chrono::seconds(1432423),
+ from_timeval(pos_time));
+
+ struct timeval neg_time;
+ neg_time.tv_sec = -1432423;
+ neg_time.tv_usec = 0;
+ EXPECT_EQ(::aos::monotonic_clock::epoch() - chrono::seconds(1432423),
+ from_timeval(neg_time));
+}
+
// Test that << works with numbers with leading 0's.
TEST(TimeTest, OperatorStream) {
const monotonic_clock::time_point t = monotonic_clock::epoch() +