REVLib - C++
Loading...
Searching...
No Matches
DetachedEncoderLowLevel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025-2026 REV Robotics
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of REV Robotics nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#pragma once
30
31#include <stdint.h>
32
33#include <wpi/hardware/bus/CANPort.hpp>
34
35#include "rev/REVLibError.h"
36#include "rev/util/Signal.h"
37
38namespace rev::detached {
39
41public:
46
53 wpi::CANPort GetCanPort() const;
54
61 int GetDeviceId() const;
62
63 enum class EncoderModel {
64 kUnknown = 0,
66 };
67
75
84
91
95
103
117
125
127 float rawAngle;
128 float angle;
129 uint64_t timestamp;
130 };
131
139
141 float position;
142 uint64_t timestamp;
143 };
144
152
154 float velocity;
155 uint64_t timestamp;
156 };
157
165
170
171protected:
172 DetachedEncoderLowLevel(wpi::CANPort canPort, int deviceID,
173 EncoderModel model);
174
175 // Opaque pointer to underlying driver.
177
178private:
179 int m_busID;
180 int m_deviceID;
181};
182
183} // namespace rev::detached
Definition DetachedEncoderLowLevel.h:40
rev::util::Signal< PeriodicStatus2 > GetPeriodicStatus2() const
Definition DetachedEncoderLowLevel.cpp:150
void * m_detachedEncoderHandle
Definition DetachedEncoderLowLevel.h:176
rev::util::Signal< PeriodicStatus1 > GetPeriodicStatus1() const
Definition DetachedEncoderLowLevel.cpp:128
EncoderModel GetEncoderModel() const
Definition DetachedEncoderLowLevel.cpp:90
DetachedEncoderLowLevel(wpi::CANPort canPort, int deviceID, EncoderModel model)
Definition DetachedEncoderLowLevel.cpp:41
PeriodicStatus0 GetPeriodicStatus0() const
Definition DetachedEncoderLowLevel.cpp:116
EncoderModel
Definition DetachedEncoderLowLevel.h:63
void CreateSimFaultManager()
Definition DetachedEncoderLowLevel.cpp:189
FirmwareVersion GetFirmwareVersion() const
Definition DetachedEncoderLowLevel.cpp:99
rev::util::Signal< PeriodicStatus4 > GetPeriodicStatus4() const
Definition DetachedEncoderLowLevel.cpp:177
int GetDeviceId() const
Definition DetachedEncoderLowLevel.cpp:88
virtual ~DetachedEncoderLowLevel()
Definition DetachedEncoderLowLevel.cpp:79
wpi::CANPort GetCanPort() const
Definition DetachedEncoderLowLevel.cpp:84
rev::util::Signal< PeriodicStatus3 > GetPeriodicStatus3() const
Definition DetachedEncoderLowLevel.cpp:164
Definition Signal.h:42
Definition ClosedLoopConfig.h:38
Definition DetachedEncoderLowLevel.h:76
int hardwareMinor
Definition DetachedEncoderLowLevel.h:82
int year
Definition DetachedEncoderLowLevel.h:77
int fix
Definition DetachedEncoderLowLevel.h:79
int hardwareMajor
Definition DetachedEncoderLowLevel.h:81
int minor
Definition DetachedEncoderLowLevel.h:78
int prerelease
Definition DetachedEncoderLowLevel.h:80
Definition DetachedEncoderLowLevel.h:92
EncoderModel model
Definition DetachedEncoderLowLevel.h:93
Definition DetachedEncoderLowLevel.h:104
bool canTxFault
Definition DetachedEncoderLowLevel.h:107
bool stickyHasResetFault
Definition DetachedEncoderLowLevel.h:111
bool stickyUnexpectedFault
Definition DetachedEncoderLowLevel.h:110
uint64_t timestamp
Definition DetachedEncoderLowLevel.h:115
bool hasResetFault
Definition DetachedEncoderLowLevel.h:106
bool stickyCanRxFault
Definition DetachedEncoderLowLevel.h:113
bool unexpectedFault
Definition DetachedEncoderLowLevel.h:105
bool canRxFault
Definition DetachedEncoderLowLevel.h:108
bool stickyEepromFault
Definition DetachedEncoderLowLevel.h:114
bool eepromFault
Definition DetachedEncoderLowLevel.h:109
bool stickyCanTxFault
Definition DetachedEncoderLowLevel.h:112
Definition DetachedEncoderLowLevel.h:126
float rawAngle
Definition DetachedEncoderLowLevel.h:127
uint64_t timestamp
Definition DetachedEncoderLowLevel.h:129
float angle
Definition DetachedEncoderLowLevel.h:128
Definition DetachedEncoderLowLevel.h:140
float position
Definition DetachedEncoderLowLevel.h:141
uint64_t timestamp
Definition DetachedEncoderLowLevel.h:142
Definition DetachedEncoderLowLevel.h:153
float velocity
Definition DetachedEncoderLowLevel.h:154
uint64_t timestamp
Definition DetachedEncoderLowLevel.h:155