Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update capacitor decision logic. #243

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rm_common/include/rm_common/decision/power_limit.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class PowerLimit
ROS_ERROR("power gain no defined (namespace: %s)", nh.getNamespace().c_str());
if (!nh.getParam("buffer_threshold", buffer_threshold_))
ROS_ERROR("buffer threshold no defined (namespace: %s)", nh.getNamespace().c_str());
if (!nh.getParam("is_new_capacitor", is_new_capacitor_))
ROS_ERROR("is_new_capacitor no defined (namespace: %s)", nh.getNamespace().c_str());
}
typedef enum
{
Expand Down Expand Up @@ -124,7 +126,7 @@ class PowerLimit
chassis_cmd.power_limit = burst_power_;
else
{
switch (cap_state_)
switch (is_new_capacitor_ ? expect_state_ : cap_state_)
{
case NORMAL:
normal(chassis_cmd);
Expand Down Expand Up @@ -186,6 +188,7 @@ class PowerLimit
double charge_power_{}, extra_power_{}, burst_power_{};
double buffer_threshold_{};
double power_gain_{};
bool is_new_capacitor_{};
uint8_t expect_state_{}, cap_state_{};

bool referee_is_online_{ false };
Expand Down
Loading