Loading [MathJax]/extensions/tex2jax.js
CTRE Phoenix 6 C++ 25.4.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CANdleSimState.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
11#include <units/current.h>
12#include <units/temperature.h>
13#include <units/voltage.h>
14
15namespace ctre {
16namespace phoenix6 {
17
18namespace hardware {
19namespace core {
20 /* forward proto */
21 class CoreCANdle;
22}
23}
24
25namespace sim {
26
27 /**
28 * \brief Class to control the state of a simulated hardware#CANdle.
29 */
31 {
32 private:
33 int _id;
34
35 public:
36 /**
37 * \brief Creates an object to control the state of the given hardware#CANdle.
38 *
39 * \details Note the recommended method of accessing simulation features is to
40 * use hardware#CANdle#GetSimState.
41 *
42 * \param device Device to which this simulation state is attached
43 */
45 /* disallow copy, allow move */
46 CANdleSimState(CANdleSimState const &) = delete;
50
51 /**
52 * \brief Gets the last status code generated by a simulation function.
53 *
54 * \details Not all functions return a status code but can potentially report errors.
55 * This function can be used to retrieve those status codes.
56 *
57 * \returns Last status code generated by a simulation function
58 */
60
61 /**
62 * \brief Gets the simulated VBat modulated output of the CANdle.
63 *
64 * \returns VBat modulation duty cycle
65 */
66 units::dimensionless::scalar_t GetVBatModulation() const;
67
68 /**
69 * \brief Sets the simulated supply voltage of the CANdle.
70 *
71 * \details The minimum allowed supply voltage is 4 V - values below this
72 * will be promoted to 4 V.
73 *
74 * \param volts The supply voltage in Volts
75 * \returns Status code
76 */
77 ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts);
78
79 /**
80 * \brief Sets the simulated 5V rail voltage of the CANdle.
81 *
82 * \param volts The 5V rail voltage in Volts
83 * \returns Status code
84 */
85 ctre::phoenix::StatusCode SetFiveVRailVoltage(units::voltage::volt_t volts);
86
87 /**
88 * \brief Sets the simulated output current of the CANdle.
89 *
90 * \param amps The output current in Amps
91 * \returns Status code
92 */
93 ctre::phoenix::StatusCode SetOutputCurrent(units::current::ampere_t amps);
94
95 /**
96 * \brief Sets the simulated temperature of the CANdle.
97 *
98 * \param temperature The device temperature in ℃
99 * \returns Status code
100 */
101 ctre::phoenix::StatusCode SetDeviceTemp(units::temperature::celsius_t temperature);
102 };
103}
104
105}
106}
Class for CTR Electronics' CANdle® branded device, a device that controls LEDs over the CAN bus.
Definition CoreCANdle.hpp:921
Class to control the state of a simulated hardware::CANdle.
Definition CANdleSimState.hpp:31
CANdleSimState & operator=(CANdleSimState &&)=default
ctre::phoenix::StatusCode SetDeviceTemp(units::temperature::celsius_t temperature)
Sets the simulated temperature of the CANdle.
ctre::phoenix::StatusCode GetLastStatusCode() const
Gets the last status code generated by a simulation function.
CANdleSimState(CANdleSimState const &)=delete
ctre::phoenix::StatusCode SetSupplyVoltage(units::voltage::volt_t volts)
Sets the simulated supply voltage of the CANdle.
ctre::phoenix::StatusCode SetOutputCurrent(units::current::ampere_t amps)
Sets the simulated output current of the CANdle.
CANdleSimState(CANdleSimState &&)=default
CANdleSimState(hardware::core::CoreCANdle const &device)
Creates an object to control the state of the given hardware::CANdle.
CANdleSimState & operator=(CANdleSimState const &)=delete
ctre::phoenix::StatusCode SetFiveVRailVoltage(units::voltage::volt_t volts)
Sets the simulated 5V rail voltage of the CANdle.
units::dimensionless::scalar_t GetVBatModulation() const
Gets the simulated VBat modulated output of the CANdle.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
Definition Diff_PositionDutyCycle_Position.hpp:15