RaidZeroLib
Coroutine robot framework for VEX V5
Toggle main menu visibility
Loading...
Searching...
No Matches
InertialSensor.hpp
1
#pragma once
2
#include "RaidZeroLib/api/Geometry/Rotation.hpp"
3
#include "RaidZeroLib/api/Hardware/Device.hpp"
4
#include "RaidZeroLib/api/Hardware/Sensor.hpp"
5
#include "RaidZeroLib/api/Units/Units.hpp"
6
7
namespace
rz
{
8
17
class
InertialSensor
final :
public
Device
,
public
Sensor
<Rotation> {
18
public
:
19
explicit
InertialSensor
(std::uint8_t
port
);
20
21
[[nodiscard]]
bool
connected
()
const override
;
22
[[nodiscard]]
bool
calibrating
()
const
;
23
24
protected
:
25
[[nodiscard]]
Rotation
raw
()
const override
;
26
[[nodiscard]] std::uint32_t
epoch
()
const override
{
return
deviceEpoch
(); }
27
28
private
:
29
bool
poll
()
override
;
30
void
onConnect
()
override
;
31
32
Angle
heading{};
33
bool
isCalibrating =
false
;
34
};
35
36
}
// namespace rz
rz::Device::onConnect
virtual void onConnect()
Applies configuration. Called when the device first connects and after every reconnect.
Definition
Device.hpp:40
rz::Device::port
std::uint8_t port() const noexcept
Definition
Device.hpp:20
rz::Device::deviceEpoch
std::uint32_t deviceEpoch() const noexcept
Increments on every (re)connection.
Definition
Device.hpp:26
rz::Device::Device
Device(std::uint8_t port, std::string_view kind)
rz::Device::poll
virtual bool poll()=0
Reads the hardware into cached members. Returns false if the read failed (keep old values).
rz::InertialSensor::raw
Rotation raw() const override
This tick's reading from the source; the last good value while disconnected. May restart after a reco...
rz::InertialSensor::InertialSensor
InertialSensor(std::uint8_t port)
rz::InertialSensor::calibrating
bool calibrating() const
rz::InertialSensor::connected
bool connected() const override
rz::InertialSensor::epoch
std::uint32_t epoch() const override
Increments every time the source reconnects. Readings across a reconnect are not comparable.
Definition
InertialSensor.hpp:26
rz::Rotation
Immutable planar rotation about the Z axis.
Definition
Rotation.hpp:16
rz::Sensor< Rotation >::Sensor
Sensor()=default
rz::Angle
au::QuantityD< au::Radians > Angle
Definition
Units.hpp:13
rz
Definition
DriverControl.hpp:11
RaidZeroLib
impl
Pros
Hardware
InertialSensor.hpp
Generated by
1.18.0