WPILibC++ 2023.4.3
BuiltInAccelerometer.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
9
11
12namespace frc {
13
14/**
15 * Built-in accelerometer.
16 *
17 * This class allows access to the roboRIO's internal accelerometer.
18 */
20 public wpi::Sendable,
21 public wpi::SendableHelper<BuiltInAccelerometer> {
22 public:
23 /**
24 * Constructor.
25 *
26 * @param range The range the accelerometer will measure
27 */
29
32
33 // Accelerometer interface
34 /**
35 * Set the measuring range of the accelerometer.
36 *
37 * @param range The maximum acceleration, positive or negative, that the
38 * accelerometer will measure. Not all accelerometers support all
39 * ranges.
40 */
41 void SetRange(Range range) final;
42
43 /**
44 * @return The acceleration of the roboRIO along the X axis in g-forces
45 */
46 double GetX() override;
47
48 /**
49 * @return The acceleration of the roboRIO along the Y axis in g-forces
50 */
51 double GetY() override;
52
53 /**
54 * @return The acceleration of the roboRIO along the Z axis in g-forces
55 */
56 double GetZ() override;
57
58 void InitSendable(wpi::SendableBuilder& builder) override;
59};
60
61} // namespace frc
Interface for 3-axis accelerometers.
Definition: Accelerometer.h:12
Range
Definition: Accelerometer.h:20
@ kRange_8G
Definition: Accelerometer.h:20
Built-in accelerometer.
Definition: BuiltInAccelerometer.h:21
BuiltInAccelerometer(Range range=kRange_8G)
Constructor.
double GetZ() override
BuiltInAccelerometer & operator=(BuiltInAccelerometer &&)=default
double GetY() override
double GetX() override
void SetRange(Range range) final
Set the measuring range of the accelerometer.
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
BuiltInAccelerometer(BuiltInAccelerometer &&)=default
Definition: SendableBuilder.h:18
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Interface for Sendable objects.
Definition: Sendable.h:16
Definition: AprilTagFieldLayout.h:22