12#define USE_POWER_CONTROLLER TRUE
17#define USE_SUPER_CAPACITOR TRUE
19#define USE_REFEREE_SYSTEM_COMM TRUE
21#include "utils/RLS.hpp"
24namespace roboctrl::ctrl
26namespace power_manage{
27 constexpr static float refereeFullBuffSet = 60.0f;
28 constexpr static float refereeBaseBuffSet = 50.0f;
29 constexpr static float capFullBuffSet = 250.0f;
30 constexpr static float capBaseBuffSet = 100.0f;
31 constexpr static float error_powerDistribution_set = 20.0f;
32 constexpr static float prop_powerDistribution_set = 15.0f;
35 constexpr float MAX_CAP_POWER_OUT = 300.0f;
36 constexpr float CAP_OFFLINE_ENERGY_RUNOUT_POWER_THRESHOLD = 43.0f;
37 constexpr float CAP_OFFLINE_ENERGY_TARGET_POWER = 37.0f;
38 constexpr float MAX_POEWR_REFEREE_BUFF = 60.0f;
39 constexpr float REFEREE_GG_COE = 0.95f;
40 constexpr float CAP_REFEREE_BOTH_GG_COE = 0.85f;
53 constexpr static uint8_t maxLevel = 11U;
54 constexpr static uint8_t HeroChassisPowerLimit_HP_FIRST[maxLevel] = { 0, 55U, 60U, 65U,
57 constexpr static uint8_t InfantryChassisPowerLimit_HP_FIRST[maxLevel] = { 0, 45U, 50U, 55U,
60 constexpr static uint8_t SentryChassisPowerLimit = 100U;
80 enum RLSEnabled :
bool
89 RefereeDisConnect = 2U,
101 std::deque<Hardware::DJIMotor> &motors_,
104 const float k1_ = 0.22f,
105 const float k2_ = 1.2f,
106 const float k3_ = 2.78f,
107 const float lambda_ = 0.9999f);
109 std::deque<Hardware::DJIMotor> &motors;
118 float powerUpperLimit;
119 float powerLowerLimit;
120 float refereeMaxPower;
122 float userConfiguredMaxPower;
126 float estimatedPower;
127 float estimatedCapEnergy;
133 size_t lastUpdateTick;
140 std::shared_ptr<Robot::Robot_set> robot_set;
141 std::shared_ptr<Device::Super_Cap> supercap;
142 std::shared_ptr<Device::Dji_referee> referee;
144 void init(
const std::shared_ptr<Robot::Robot_set> &
robot);
145 std::array<float, 4> getControlledOutput(
PowerObj *
objs[4]);
146 void setMaxPowerConfigured(
float maxPower);
151#define POWER_PD_KP 50.0f
152 const typename Pid::PidConfig powerPD_base_pid_config{
153 POWER_PD_KP, 0.0f, 0.2f, MAX_CAP_POWER_OUT, 0.0f,
155 const typename Pid::PidConfig powerPD_full_pid_config{
156 POWER_PD_KP, 0.0f, 0.2f, MAX_CAP_POWER_OUT, 0.0f,
165 float userConfiguredMaxPower;
166 float maxPowerLimited;
167 float sumPowerCmd_before_clamp;
168 float effectivePower;
172 Manager::ErrorFlags error;
178 float getLatestFeedbackJudgePowerLimit();
186 std::array<float, 4> getControlledOutput(
PowerObj *
objs[4]);
200 void setMaxPowerConfigured(
float maxPower);
214 void registerPowerCallbackFunc(
float (*
callback)(
void));
asio::awaitable< T > awaitable
协程任务类型。
Storing the power status of the chassis