WPILibC++  unspecified
BuiltInAccelerometer.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2014-2017 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <memory>
11 #include <string>
12 
13 #include "LiveWindow/LiveWindowSendable.h"
14 #include "SensorBase.h"
15 #include "interfaces/Accelerometer.h"
16 #include "networktables/NetworkTableEntry.h"
17 
18 namespace frc {
19 
26  public SensorBase,
27  public LiveWindowSendable {
28  public:
29  explicit BuiltInAccelerometer(Range range = kRange_8G);
30  virtual ~BuiltInAccelerometer() = default;
31 
32  // Accelerometer interface
33  void SetRange(Range range) override;
34  double GetX() override;
35  double GetY() override;
36  double GetZ() override;
37 
38  std::string GetSmartDashboardType() const override;
39  void InitTable(std::shared_ptr<NetworkTable> subtable) override;
40  void UpdateTable() override;
41  void StartLiveWindowMode() override {}
42  void StopLiveWindowMode() override {}
43 
44  private:
45  nt::NetworkTableEntry m_xEntry;
46  nt::NetworkTableEntry m_yEntry;
47  nt::NetworkTableEntry m_zEntry;
48 };
49 
50 } // namespace frc
Definition: Timer.cpp:18
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: BuiltInAccelerometer.cpp:75
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
Base class for all sensors.
Definition: SensorBase.h:20
double GetZ() override
Definition: BuiltInAccelerometer.cpp:55
BuiltInAccelerometer(Range range=kRange_8G)
Constructor.
Definition: BuiltInAccelerometer.cpp:23
Built-in accelerometer.
Definition: BuiltInAccelerometer.h:25
void SetRange(Range range) override
Common interface for setting the measuring range of an accelerometer.
Definition: BuiltInAccelerometer.cpp:31
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: BuiltInAccelerometer.h:41
std::string GetSmartDashboardType() const override
Definition: BuiltInAccelerometer.cpp:57
double GetX() override
Definition: BuiltInAccelerometer.cpp:45
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
Interface for 3-axis accelerometers.
Definition: Accelerometer.h:15
double GetY() override
Definition: BuiltInAccelerometer.cpp:50
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: BuiltInAccelerometer.h:42