1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* Copyright (C) Cross The Road Electronics. All rights reserved.
* License information can be found in CTRE_LICENSE.txt
* For support and suggestions contact support@ctr-electronics.com or file
* an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
*/
#pragma once
#include "ctre/phoenix6/controls/ControlRequest.hpp"
#include <units/frequency.h>
#include <units/time.h>
namespace ctre {
namespace phoenix6 {
namespace controls {
/**
* An empty animation, clearing any animation in the specified slot.
*
*
*/
class EmptyAnimation final : public ControlRequest {
ctre::phoenix::StatusCode SendRequest(const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req) const override;
public:
/**
* \brief The slot of this animation, within [0, 7]. Each slot on the CANdle can
* store and run one animation.
*/
int Slot;
/**
* \brief The frequency at which this control will update.
* This is designated in Hertz, with a minimum of 20 Hz
* (every 50 ms) and a maximum of 1000 Hz (every 1 ms).
* Some update frequencies are not supported and will be
* promoted up to the next highest supported frequency.
*
* If this field is set to 0 Hz, the control request will
* be sent immediately as a one-shot frame. This may be useful
* for advanced applications that require outputs to be
* synchronized with data acquisition. In this case, we
* recommend not exceeding 50 ms between control calls.
*/
units::frequency::hertz_t UpdateFreqHz{0_Hz};
/**
* \brief An empty animation, clearing any animation in the specified slot.
*
* \details
*
* \param Slot The slot of this animation, within [0, 7]. Each slot on the
* CANdle can store and run one animation.
*/
constexpr EmptyAnimation(int Slot) : ControlRequest{},
Slot{std::move(Slot)}
{}
constexpr ~EmptyAnimation() override {}
/**
* \brief Gets the name of this control request.
*
* \returns Name of the control request
*/
constexpr std::string_view GetName() const override
{
return "EmptyAnimation";
}
/**
* \brief Modifies this Control Request's Slot parameter and returns itself for
* method-chaining and easier to use request API.
*
* The slot of this animation, within [0, 7]. Each slot on the CANdle can store
* and run one animation.
*
* \param newSlot Parameter to modify
* \returns Itself
*/
constexpr EmptyAnimation &WithSlot(int newSlot)
{
Slot = std::move(newSlot);
return *this;
}
/**
* \brief Sets the frequency at which this control will update.
* This is designated in Hertz, with a minimum of 20 Hz
* (every 50 ms) and a maximum of 1000 Hz (every 1 ms).
* Some update frequencies are not supported and will be
* promoted up to the next highest supported frequency.
*
* If this field is set to 0 Hz, the control request will
* be sent immediately as a one-shot frame. This may be useful
* for advanced applications that require outputs to be
* synchronized with data acquisition. In this case, we
* recommend not exceeding 50 ms between control calls.
*
* \param newUpdateFreqHz Parameter to modify
* \returns Itself
*/
constexpr EmptyAnimation &WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
{
UpdateFreqHz = newUpdateFreqHz;
return *this;
}
/**
* \brief Returns a string representation of the object.
*
* \returns a string representation of the object.
*/
std::string ToString() const override;
/**
* \brief Gets information about this control request.
*
* \returns Map of control parameter names and corresponding applied values
*/
std::map<std::string, std::string> GetControlInfo() const override;
};
}
}
}