1 |
|
|
/** |
2 |
|
|
* @file analog_sensors.cpp |
3 |
|
|
* @author Manuel Wuthrich (manuel.wuthrich@gmail.com) |
4 |
|
|
* @author Maximilien Naveau (maximilien.naveau@gmail.com) |
5 |
|
|
* @brief This file defines a class to get access to analogue sensors. |
6 |
|
|
* @version 0.1 |
7 |
|
|
* @date 2018-11-23 |
8 |
|
|
* |
9 |
|
|
* @copyright Copyright (c) 2018 |
10 |
|
|
* |
11 |
|
|
*/ |
12 |
|
|
|
13 |
|
|
#include <blmc_drivers/devices/analog_sensor.hpp> |
14 |
|
|
|
15 |
|
|
namespace blmc_drivers |
16 |
|
|
{ |
17 |
|
|
|
18 |
|
|
AnalogSensor::AnalogSensor( |
19 |
|
|
std::shared_ptr<MotorBoardInterface> board, |
20 |
|
|
bool sensor_id): |
21 |
|
|
board_(board), |
22 |
|
|
sensor_id_(sensor_id) |
23 |
|
|
{ } |
24 |
|
|
|
25 |
|
|
std::shared_ptr <const AnalogSensorInterface::ScalarTimeseries> |
26 |
|
|
AnalogSensor::get_measurement() const |
27 |
|
|
{ |
28 |
|
|
if(sensor_id_ == 0) |
29 |
|
|
{ |
30 |
|
|
return board_->get_measurement(MotorBoardInterface::analog_0); |
31 |
|
|
} |
32 |
|
|
else |
33 |
|
|
{ |
34 |
|
|
return board_->get_measurement(MotorBoardInterface::analog_1); |
35 |
|
|
} |
36 |
|
|
} |
37 |
|
|
|
38 |
✓✗✓✗
|
3 |
} |