From 56b0e9dac3bb0ff99c5a7b06c41b59b620937c69 Mon Sep 17 00:00:00 2001 From: Soo-Hyun Yoo Date: Mon, 9 Feb 2015 23:08:33 -0800 Subject: [PATCH] refs #17 Add thermistor as optional peripheral. --- src/estimator/world_estimator.cpp | 2 +- src/estimator/world_estimator.hpp | 5 +++-- src/system/multirotor_vehicle_system.cpp | 2 +- src/system/multirotor_vehicle_system.hpp | 2 ++ variants/units/helios/unit_data.hpp | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/estimator/world_estimator.cpp b/src/estimator/world_estimator.cpp index 952331c..549b210 100644 --- a/src/estimator/world_estimator.cpp +++ b/src/estimator/world_estimator.cpp @@ -9,7 +9,7 @@ WorldEstimator::WorldEstimator(Communicator& communicator) : worldMessageStream(communicator, 10) { } -WorldEstimate WorldEstimator::update(GPSReading& gpsReading) { +WorldEstimate WorldEstimator::update(const SensorReadingGroup& readings) { // TODO: get GPS data WorldEstimate estimate { diff --git a/src/estimator/world_estimator.hpp b/src/estimator/world_estimator.hpp index 5f8fb57..06ddb5a 100644 --- a/src/estimator/world_estimator.hpp +++ b/src/estimator/world_estimator.hpp @@ -3,10 +3,11 @@ #include "communication/communicator.hpp" #include "communication/rate_limited_stream.hpp" -#include "sensor/gps.hpp" +#include "estimator/attitude_estimator.hpp" struct WorldEstimate { float globe_loc[3]; + float therm; }; class WorldEstimator { @@ -19,7 +20,7 @@ class WorldEstimator { * * TODO(yoos): Consolidate with attitude estimator. */ - virtual WorldEstimate update(GPSReading& gpsReading); + virtual WorldEstimate update(const SensorReadingGroup& readings); private: RateLimitedStream worldMessageStream; diff --git a/src/system/multirotor_vehicle_system.cpp b/src/system/multirotor_vehicle_system.cpp index 73b1d73..6533ae3 100644 --- a/src/system/multirotor_vehicle_system.cpp +++ b/src/system/multirotor_vehicle_system.cpp @@ -45,7 +45,7 @@ void MultirotorVehicleSystem::update() { if (i++ % 100 == 0) { gpsReading = gps.readGPS(); if (thermistor) { - thermReading = (*therm)->readTherm(); + thermReading = (*thermistor)->readTherm(); } } diff --git a/src/system/multirotor_vehicle_system.hpp b/src/system/multirotor_vehicle_system.hpp index 8c2d097..0ada496 100644 --- a/src/system/multirotor_vehicle_system.hpp +++ b/src/system/multirotor_vehicle_system.hpp @@ -36,6 +36,7 @@ class MultirotorVehicleSystem : public VehicleSystem, public MessageListener { Accelerometer& accelerometer, GPS& gps, optional magnetometer, // TODO: Use reference_wrapper? + optional thermistor, WorldEstimator& world, AttitudeEstimator& attitude, InputSource& inputSource, @@ -51,6 +52,7 @@ class MultirotorVehicleSystem : public VehicleSystem, public MessageListener { Accelerometer& accelerometer; GPS& gps; optional magnetometer; + optional thermistor; WorldEstimator& world; AttitudeEstimator& attitude; diff --git a/variants/units/helios/unit_data.hpp b/variants/units/helios/unit_data.hpp index 20061f5..f104d7e 100644 --- a/variants/units/helios/unit_data.hpp +++ b/variants/units/helios/unit_data.hpp @@ -38,7 +38,7 @@ struct UnitData { world(communicator), attitude(communicator), inputSource(communicator), - system(platform.get(), platform.get(), platform.get(), std::experimental::nullopt, world, attitude, inputSource, motorMapper, communicator) { + system(platform.get(), platform.get(), platform.get(), std::experimental::nullopt, std::experimental::nullopt, world, attitude, inputSource, motorMapper, communicator) { } };