EStop logic is improved

This commit is contained in:
Rooholla-KhorramBakht 2024-02-08 22:56:11 -05:00
parent a6ca6f566d
commit 3adf799d6b
1 changed files with 3 additions and 1 deletions

View File

@ -177,12 +177,14 @@ void Custom::lowstate_callback(unitree_go::msg::LowState::SharedPtr data)
} }
pub_joint->publish(joint_state); pub_joint->publish(joint_state);
pub_imu->publish(imu); pub_imu->publish(imu);
// Check for emergency stop
memcpy(&_keyData, &data->wireless_remote[0], 40); memcpy(&_keyData, &data->wireless_remote[0], 40);
if (_keyData.btn.components.R2 == 1 && _keyData.btn.components.L2 == 1) if (_keyData.btn.components.R2 == 1 && _keyData.btn.components.L2 == 1)
{ {
Estop = 1; Estop = 1;
} }
if (_keyData.btn.components.R1 == 1 && _keyData.btn.components.L1 == 1) if ((_keyData.btn.components.R1 == 1 && _keyData.btn.components.L1 == 1)||
(_keyData.btn.components.L2 == 1 && _keyData.btn.components.A == 1))
{ {
Estop = 0; Estop = 0;
} }