CTRE Phoenix C++ 5.33.1
CANCoderSimCollection.h
Go to the documentation of this file.
1/* Copyright (C) Cross The Road Electronics 2024 */
2#pragma once
3
6
7/* forward proto's */
8namespace ctre {
9 namespace phoenix {
10 namespace sensors {
11 class CANCoder;
12 }
13 }
14}
15
16namespace ctre {
17 namespace phoenix {
18 namespace sensors {
19 /**
20 * Collection of simulation functions available to a CANCoder.
21 *
22 * Use the getSimCollection() function in your CANCoder object to create the respective sim collection.
23 *
24 * @deprecated This device's Phoenix 5 API is deprecated for removal in the
25 * 2025 season. Users should update to Phoenix 6 firmware and migrate to the
26 * Phoenix 6 API. A migration guide is available at
27 * https://v6.docs.ctr-electronics.com/en/stable/docs/migration/migration-guide/index.html.
28 *
29 * If the Phoenix 5 API must be used for this device, the device must have 22.X
30 * firmware. This firmware is available in Tuner X after selecting Phoenix 5 in
31 * the firmware year dropdown.
32 */
34 public:
35 /**
36 * Constructor for CANCoderSimCollection
37 *
38 * @param canCoder CANCoder to connect Collection to
39 */
41
42 /**
43 * Sets the simulated bus voltage of the CANCoder.
44 *
45 * The minimum allowed bus voltage is 4 V - values
46 * below this will be promoted to 4 V.
47 *
48 * @param vbat the bus voltage in volts
49 *
50 * @return error code
51 */
53
54 /**
55 * Sets the simulated raw position of the CANCoder.
56 *
57 * The CANCoder integrates this to calculate the true reported position.
58 *
59 * When using the WPI Sim GUI, you will notice a readonly 'position' and
60 * settable 'rawPositionInput'. The readonly signal is the emulated position
61 * which will match self-test in Tuner and the hardware API. Changes to
62 * 'rawPositionInput' will be integrated into the emulated position. This way
63 * a simulator can modify the position without overriding your
64 * hardware API calls for home-ing your sensor.
65 *
66 * Inputs to this function over time should be continuous, as user calls
67 * of setPosition() will be accounted for in the calculation.
68 *
69 * @param newPos the new raw position in native units
70 *
71 * @return error code
72 */
74
75 /**
76 * Adds to the simulated position of the CANCoder.
77 *
78 * @param dPos the change in position in native units
79 *
80 * @return error code
81 */
83
84 /**
85 * Sets the simulated velocity of the CANCoder.
86 *
87 * @param newVel the new velocity in native units per 100ms
88 *
89 * @return error code
90 */
92
93 private:
94 int _id;
95 ctre::phoenix::platform::DeviceType _type;
96 };
97 }
98 }
99}
CTRE CANCoder.
Definition: CANCoder.h:233
Collection of simulation functions available to a CANCoder.
Definition: CANCoderSimCollection.h:33
ErrorCode SetVelocity(int newVel)
Sets the simulated velocity of the CANCoder.
ErrorCode SetBusVoltage(double vbat)
Sets the simulated bus voltage of the CANCoder.
ErrorCode AddPosition(int dPos)
Adds to the simulated position of the CANCoder.
ErrorCode SetRawPosition(int newPos)
Sets the simulated raw position of the CANCoder.
CANCoderSimCollection(ctre::phoenix::sensors::CANCoder &canCoder)
Constructor for CANCoderSimCollection.
ErrorCode
Definition: ErrorCode.h:13
namespace ctre
Definition: paramEnum.h:5