Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
unjam_integral_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) 2022 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_INTEGRAL_COMMAND_HPP_
25#define TAPROOT_UNJAM_INTEGRAL_COMMAND_HPP_
26
27#include <cstdint>
28
31
32#include "../interfaces/integrable_setpoint_subsystem.hpp"
33
35
37{
54{
55public:
57 struct Config
58 {
83 uint32_t maxWaitTime;
91 };
92
97 IntegrableSetpointSubsystem& integrableSetpointSubsystem,
98 const Config& config);
99
100 bool isReady() override;
101
102 void initialize() override;
103
104 void execute() override;
105
106 void end(bool interrupted) override;
107
108 bool isFinished() const override;
109
110 const char* getName() const override { return "unjam move integral"; }
111
112private:
113 enum UnjamState
114 {
115 UNJAM_BACKWARD,
116 UNJAM_FORWARD,
117 JAM_CLEARED,
118 };
119
120 IntegrableSetpointSubsystem& integrableSetpointSubsystem;
121
123
127 arch::MilliTimeout unjamRotateTimeout;
128
132 uint16_t backwardsCount;
133
134 UnjamState currUnjamState;
135
136 float positionBeforeUnjam;
137
138 bool backwardsCleared;
139
140 bool forwardsCleared;
141
142 void beginUnjamForwards();
143
144 void beginUnjamBackwards();
145};
146
147} // namespace tap::control::setpoint
148
149#endif // TAPROOT_UNJAM_INTEGRAL_COMMAND_HPP_
Definition timeout.hpp:44
Definition integrable_setpoint_subsystem.hpp:43
Definition unjam_command_interface.hpp:40
Definition unjam_integral_command.hpp:54
bool isReady() override
Definition unjam_integral_command.cpp:55
void initialize() override
Definition unjam_integral_command.cpp:57
bool isFinished() const override
Definition unjam_integral_command.cpp:118
const char * getName() const override
Definition unjam_integral_command.hpp:110
void execute() override
Definition unjam_integral_command.cpp:70
void end(bool interrupted) override
Definition unjam_integral_command.cpp:109
Config(double p, double i, double d, double maxIntegralAccumulation, double maxOutput, double errorDerivativeFloor, double errorDeadzone=0.0, double tQDerivativeKalman=1.0, double tRDerivativeKalman=0.0, tRProportionalKalman=1.0)
Definition dimensional_smooth_pid.hpp:16
Definition pwm_info.hpp:4
Definition setpoint_continuous_jam_checker.hpp:36
Config struct that the user passes into the UnjamIntegralCommand's constructor.
Definition unjam_integral_command.hpp:58
float targetUnjamIntegralChange
Definition unjam_integral_command.hpp:66
float unjamSetpoint
Definition unjam_integral_command.hpp:73
uint32_t maxWaitTime
Definition unjam_integral_command.hpp:83
uint16_t targetCycleCount
Definition unjam_integral_command.hpp:90