Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
unjam_command.hpp
Go to the documentation of this file.
1/*****************************************************************************/
2/********** !!! WARNING: CODE GENERATED BY TAPROOT. DO NOT EDIT !!! **********/
3/*****************************************************************************/
4
5/*
6 * Copyright (c) 2020-2021 Advanced Robotics at the University of Washington <robomstr@uw.edu>
7 *
8 * This file is part of Taproot.
9 *
10 * Taproot is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Taproot is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Taproot. If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef TAPROOT_UNJAM_COMMAND_HPP_
25#define TAPROOT_UNJAM_COMMAND_HPP_
26
27#include <cstdint>
28
32
33namespace tap
34{
35namespace control
36{
37namespace setpoint
38{
39// Forward declarations
40class SetpointSubsystem;
41
66{
67public:
83 SetpointSubsystem* setpointSubsystem,
84 float unjamDisplacement,
85 float unjamThreshold,
86 uint32_t maxWaitTime,
87 uint_fast16_t targetCycleCount);
88
89 bool isReady() override;
90
91 void initialize() override;
92
93 void execute() override;
94
95 void end(bool interrupted) override;
96
97 bool isFinished() const override;
98
99 const char* getName() const override { return "agitator unjam"; }
100
101private:
102 enum UnjamState
103 {
104 UNJAM_BACKWARD,
105 UNJAM_FORWARD,
106 JAM_CLEARED
107 };
108
109 void beginUnjamForwards();
110
111 void beginUnjamBackwards();
112
116 tap::arch::MilliTimeout unjamRotateTimeout;
117
122 const uint32_t maxWaitTime;
123
124 SetpointSubsystem* setpointSubsystem;
125
129 float unjamDisplacement;
130
135 float unjamThreshold;
136
140 const uint_fast16_t targetCycleCount;
141
145 uint_fast16_t backwardsCount;
146
147 UnjamState currUnjamState;
148
149 float setpointBeforeUnjam;
150
151 float valueBeforeUnjam;
152
153 bool backwardsCleared;
154
155 bool forwardsCleared;
156}; // class UnjamCommand
157
158} // namespace setpoint
159
160} // namespace control
161
162} // namespace tap
163
164#endif // TAPROOT_UNJAM_COMMAND_HPP_
Definition timeout.hpp:44
Definition command.hpp:44
Definition setpoint_subsystem.hpp:48
Definition unjam_command.hpp:66
bool isReady() override
Definition unjam_command.cpp:56
bool isFinished() const override
Definition unjam_command.cpp:135
void initialize() override
Definition unjam_command.cpp:58
void end(bool interrupted) override
Definition unjam_command.cpp:123
void execute() override
Definition unjam_command.cpp:75
const char * getName() const override
Definition unjam_command.hpp:99
Definition ballistics.cpp:29