aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/gps/gps_helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/gps/gps_helper.cpp')
-rw-r--r--src/drivers/gps/gps_helper.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/drivers/gps/gps_helper.cpp b/src/drivers/gps/gps_helper.cpp
index 9c1fad569..54ac90dab 100644
--- a/src/drivers/gps/gps_helper.cpp
+++ b/src/drivers/gps/gps_helper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
*
- * Copyright (C) 2008-2013 PX4 Development Team. All rights reserved.
+ * Copyright (C) 2012,2013 PX4 Development Team. All rights reserved.
* Author: Thomas Gubler <thomasgubler@student.ethz.ch>
* Julian Oes <joes@student.ethz.ch>
*
@@ -36,9 +36,32 @@
#include <termios.h>
#include <errno.h>
#include <systemlib/err.h>
+#include <drivers/drv_hrt.h>
#include "gps_helper.h"
-/* @file gps_helper.cpp */
+/**
+ * @file gps_helper.cpp
+ */
+
+float
+GPS_Helper::get_position_update_rate()
+{
+ return _rate_count_lat_lon / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f);
+}
+
+float
+GPS_Helper::get_velocity_update_rate()
+{
+ return _rate_count_vel / (((float)(hrt_absolute_time() - _interval_rate_start)) / 1000000.0f);
+}
+
+float
+GPS_Helper::reset_update_rates()
+{
+ _rate_count_vel = 0;
+ _rate_count_lat_lon = 0;
+ _interval_rate_start = hrt_absolute_time();
+}
int
GPS_Helper::set_baudrate(const int &fd, unsigned baud)