WPILibC++ 2024.3.2
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
10namespace frc {
11
12/**
13 * Built-in accelerometer.
14 *
15 * This class allows access to the roboRIO's internal accelerometer.
16 */
18 public wpi::SendableHelper<BuiltInAccelerometer> {
19 public:
20 /**
21 * Accelerometer range.
22 */
23 enum Range {
24 /// 2 Gs max.
26 /// 4 Gs max.
28 /// 8 Gs max.
29 kRange_8G = 2
30 };
31
32 /**
33 * Constructor.
34 *
35 * @param range The range the accelerometer will measure
36 */
38
41
42 /**
43 * Set the measuring range of the accelerometer.
44 *
45 * @param range The maximum acceleration, positive or negative, that the
46 * accelerometer will measure.
47 */
48 void SetRange(Range range);
49
50 /**
51 * @return The acceleration of the roboRIO along the X axis in g-forces
52 */
53 double GetX();
54
55 /**
56 * @return The acceleration of the roboRIO along the Y axis in g-forces
57 */
58 double GetY();
59
60 /**
61 * @return The acceleration of the roboRIO along the Z axis in g-forces
62 */
63 double GetZ();
64
65 void InitSendable(wpi::SendableBuilder& builder) override;
66};
67
68} // namespace frc
Built-in accelerometer.
Definition: BuiltInAccelerometer.h:18
Range
Accelerometer range.
Definition: BuiltInAccelerometer.h:23
@ kRange_2G
2 Gs max.
Definition: BuiltInAccelerometer.h:25
@ kRange_8G
8 Gs max.
Definition: BuiltInAccelerometer.h:29
@ kRange_4G
4 Gs max.
Definition: BuiltInAccelerometer.h:27
void SetRange(Range range)
Set the measuring range of the accelerometer.
BuiltInAccelerometer(Range range=kRange_8G)
Constructor.
BuiltInAccelerometer & operator=(BuiltInAccelerometer &&)=default
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
BuiltInAccelerometer(BuiltInAccelerometer &&)=default
Helper class for building Sendable dashboard representations.
Definition: SendableBuilder.h:21
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: AprilTagPoseEstimator.h:15