Ocean
Loading...
Searching...
No Matches
AccelerationSensor3DOF.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_DEVICES_ACCELERATION_SENSOR_3DOF_H
9#define META_OCEAN_DEVICES_ACCELERATION_SENSOR_3DOF_H
10
14
17
18#include "ocean/math/Vector3.h"
19
20namespace Ocean
21{
22
23namespace Devices
24{
25
26// Forward declaration.
28
29/**
30 * Definition of a smart object reference for a 3DOF acceleration sensor.
31 * @see AccelerationSensor3DOF.
32 * @ingroup devices
33 */
35
36/**
37 * This class is the base class for all 3DOF acceleration sensors.
38 * @ingroup devices
39 */
40class OCEAN_DEVICES_EXPORT AccelerationSensor3DOF : virtual public Sensor
41{
42 public:
43
44 /**
45 * Definition of a sample holding acceleration sensor 3DOF measurements.
46 * Each acceleration measurement value is defined in [m / s^2]
47 */
48 class OCEAN_DEVICES_EXPORT Acceleration3DOFSample : virtual public Measurement::Sample
49 {
50 public:
51
52 /**
53 * Definition of a vector holding acceleration measurements.
54 * One measurement holds three different acceleration values for three separated axis.
55 */
57
58 public:
59
60 /**
61 * Creates a new acceleration sensor 3DOF sample.
62 * @param timestamp Sample timestamp
63 * @param objectIds Measurement unit object ids each id corresponds to a different acceleration measurement
64 * @param measurements Sample measurements
65 * @param metadata Optional metadata of the new sample
66 */
68
69 /**
70 * Creates a new acceleration sensor 3DOF sample.
71 * @param timestamp Sample timestamp
72 * @param objectIds Measurement unit object ids each id corresponds to a different acceleration measurement
73 * @param measurements Sample measurements
74 * @param metadata Optional metadata of the new sample
75 */
77
78 /**
79 * Returns all measurement values, each acceleration value in [m / s^2]
80 * @return Measurement values
81 */
82 inline const Measurements& measurements() const;
83
84 protected:
85
86 /// Measurement values.
88 };
89
90 /**
91 * Definition of a smart object reference for 3DOF acceleration sensor samples.
92 */
94
95 public:
96
97 /**
98 * Returns this device type.
99 * @param sensorType The type of the sensor (the subtype of the device), can be SENSOR_ACCELERATION_3DOF or SENSOR_LINEAR_ACCELERATION_3DOF
100 * @return Device type
101 */
102 static inline DeviceType deviceTypeAccelerationSensor3DOF(const SensorType sensorType);
103
104 protected:
105
106 /**
107 * Creates a new 3DOF acceleration sensor device.
108 * @param name The name of the acceleration sensor, must be valid
109 * @param sensorType The type of the sensor (the subtype of the device), can be SENSOR_ACCELERATION_3DOF or SENSOR_LINEAR_ACCELERATION_3DOF
110 */
111 AccelerationSensor3DOF(const std::string& name, const SensorType sensorType);
112
113 /**
114 * Destructs a 3DOF acceleration sensor device.
115 */
117
118 /**
119 * Interpolates between two 3DOF acceleration sensor samples.
120 * @see Measurement::interpolateSamples().
121 */
122 SampleRef interpolateSamples(const SampleRef& lowerSample, const SampleRef& upperSample, const double interpolationFactor, const Timestamp& interpolatedTimestamp) const override;
123};
124
131
136
137}
138
139}
140
141#endif // META_OCEAN_DEVICES_ACCELERATION_SENSOR_3DOF_H
const Measurements & measurements() const
Returns all measurement values, each acceleration value in [m / s^2].
Definition AccelerationSensor3DOF.h:132
Acceleration3DOFSample(const Timestamp &timestamp, const ObjectIds &objectIds, const Measurements &measurements, const Metadata &metadata=Metadata())
Creates a new acceleration sensor 3DOF sample.
Acceleration3DOFSample(const Timestamp &timestamp, ObjectIds &&objectIds, Measurements &&measurements, Metadata &&metadata=Metadata())
Creates a new acceleration sensor 3DOF sample.
StackHeapVector< Vector3, 1 > Measurements
Definition of a vector holding acceleration measurements.
Definition AccelerationSensor3DOF.h:56
Measurements measurements_
Measurement values.
Definition AccelerationSensor3DOF.h:87
This class is the base class for all 3DOF acceleration sensors.
Definition AccelerationSensor3DOF.h:41
SampleRef interpolateSamples(const SampleRef &lowerSample, const SampleRef &upperSample, const double interpolationFactor, const Timestamp &interpolatedTimestamp) const override
Interpolates between two 3DOF acceleration sensor samples.
SmartObjectRef< Acceleration3DOFSample, Sample > Acceleration3DOFSampleRef
Definition of a smart object reference for 3DOF acceleration sensor samples.
Definition AccelerationSensor3DOF.h:93
AccelerationSensor3DOF(const std::string &name, const SensorType sensorType)
Creates a new 3DOF acceleration sensor device.
static DeviceType deviceTypeAccelerationSensor3DOF(const SensorType sensorType)
Returns this device type.
Definition AccelerationSensor3DOF.h:125
~AccelerationSensor3DOF() override
Destructs a 3DOF acceleration sensor device.
Definition of a class holding the major and minor device type.
Definition devices/Device.h:62
@ DEVICE_SENSOR
Sensor device.
Definition devices/Device.h:44
const std::string & name() const
Returns the name of this device.
Definition devices/Device.h:340
Definition of a sample holding a measurement.
Definition Measurement.h:68
const ObjectIds & objectIds() const
Returns the sample object ids specifying possible different measurement units.
Definition Measurement.h:519
const Metadata & metadata() const
Returns the metadata of this sample.
Definition Measurement.h:524
const Timestamp & timestamp() const
Returns the sample timestamp.
Definition Measurement.h:509
ObjectRef< Sample > SampleRef
Definition of an object reference for samples.
Definition Measurement.h:144
std::unordered_map< std::string, Value > Metadata
Definition of an unordered map mapping keys to values.
Definition Measurement.h:62
StackHeapVector< ObjectId, 1 > ObjectIds
Definition of a vector holding object ids.
Definition Measurement.h:52
Sensor(const std::string &name, const DeviceType type)
Creates a new sensor object.
SensorType
Definition of different sensor types.
Definition Sensor.h:43
@ SENSOR_ACCELERATION_3DOF
3DOF acceleration sensor.
Definition Sensor.h:47
@ SENSOR_LINEAR_ACCELERATION_3DOF
3DOF linear acceleration sensor (excluding gravity).
Definition Sensor.h:49
This class implements a smart device reference.
Definition DeviceRef.h:36
This template class implements a smart object reference which is a specialization of an ObjectRef obj...
Definition SmartObjectRef.h:90
Vector like data structure combining stack and heap memory.
Definition StackHeapVector.h:27
This class implements a timestamp.
Definition Timestamp.h:64
SmartDeviceRef< AccelerationSensor3DOF > AccelerationSensor3DOFRef
Definition of a smart object reference for a 3DOF acceleration sensor.
Definition AccelerationSensor3DOF.h:34
Namespace of the Devices library.
Definition AccelerationSensor3DOF.h:24
The namespace covering the entire Ocean framework.
Definition Accessor.h:15