Skip to content

Commit

Permalink
Merge pull request #62 from LexxPluss/AMRSW-1112-fix-actuator-init-issue
Browse files Browse the repository at this point in the history
AMRSW-1112 send state is emergency state or not
  • Loading branch information
ar90n authored Nov 17, 2024
2 parents 55e6479 + 7f5c692 commit 28921f2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions lexxpluss_apps/src/board_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,13 +1278,13 @@ class state_controller { // Variables Implemented
if (state != POWER_STATE::OFF) {
rtn = esw.is_asserted() ||
bsw.is_asserted() ||
state == POWER_STATE::SUSPEND ||
state == POWER_STATE::RESUME_WAIT ||
mbd.emergency_stop_from_ros() ||
sl.is_asserted();
sl.is_asserted() ||
is_emergency_state();
}
return rtn;
}

private:
static void static_poll_100ms_callback(struct k_timer *timer_id) {
auto* instance = static_cast<state_controller*>(k_timer_user_data_get(timer_id));
Expand Down Expand Up @@ -1759,7 +1759,7 @@ class state_controller { // Variables Implemented
board2ros.auto_charging_status = ac.is_docked();
board2ros.shutdown_reason = static_cast<uint32_t>(shutdown_reason);
board2ros.wait_shutdown_state = state == POWER_STATE::OFF_WAIT || state == POWER_STATE::TIMEROFF;
board2ros.emergency_stop = is_emergency();
board2ros.emergency_state = is_emergency_state();
board2ros.wheel_enable = wsw.is_enabled();

bool v24{false}, v_peripheral{false}, v_wheel_motor_left{false}, v_wheel_motor_right{false};
Expand Down Expand Up @@ -1805,6 +1805,9 @@ class state_controller { // Variables Implemented
bool should_lockdown() const {
return mbd.is_dead() && !esw.is_asserted();
}
bool is_emergency_state() const {
return state == POWER_STATE::SUSPEND || state == POWER_STATE::RESUME_WAIT;
}

power_switch psw;
resume_switch rsw;
Expand Down
2 changes: 1 addition & 1 deletion lexxpluss_apps/src/can_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct msg_board {
bool c_act_pgood, l_act_pgood, r_act_pgood;
bool wheel_enable;
bool charge_temperature_good;
bool emergency_stop;
bool emergency_state;
} __attribute__((aligned(4)));

struct msg_control {
Expand Down
2 changes: 1 addition & 1 deletion lexxpluss_apps/src/zcan_board.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class zcan_board {
if (message.wait_shutdown_state) {
packedData[0] |= 0b00001000;
}
if (message.emergency_stop) {
if (message.emergency_state) {
packedData[0] |= 0b00000100;
}
if (message.safety_lidar_asserted) {
Expand Down

0 comments on commit 28921f2

Please sign in to comment.