|
33 | 33 |
|
34 | 34 | using industrial_robot_status_interface::RobotMode; |
35 | 35 | using industrial_robot_status_interface::TriState; |
| 36 | +using namespace ur_driver::rtde_interface; |
36 | 37 |
|
37 | 38 | namespace ur_driver |
38 | 39 | { |
| 40 | +// bitset mask is applied to robot safety status bits in order to determine 'in_error' state |
| 41 | +static const std::bitset<11> in_error_bitset_(1 << toUnderlying(UrRtdeSafetyStatusBits::IS_PROTECTIVE_STOPPED) | |
| 42 | + 1 << toUnderlying(UrRtdeSafetyStatusBits::IS_ROBOT_EMERGENCY_STOPPED) | |
| 43 | + 1 << toUnderlying(UrRtdeSafetyStatusBits::IS_EMERGENCY_STOPPED) | |
| 44 | + 1 << toUnderlying(UrRtdeSafetyStatusBits::IS_VIOLATION) | |
| 45 | + 1 << toUnderlying(UrRtdeSafetyStatusBits::IS_FAULT) | |
| 46 | + 1 << toUnderlying(UrRtdeSafetyStatusBits::IS_STOPPED_DUE_TO_SAFETY)); |
| 47 | + |
39 | 48 | HardwareInterface::HardwareInterface() |
40 | 49 | : joint_position_command_({ 0, 0, 0, 0, 0, 0 }) |
41 | 50 | , joint_velocity_command_({ 0, 0, 0, 0, 0, 0 }) |
@@ -673,12 +682,7 @@ void HardwareInterface::extractRobotStatus() |
673 | 682 | // I found no way to reliably get information if the robot is moving |
674 | 683 | robot_status_resource_.in_motion = TriState::UNKNOWN; |
675 | 684 |
|
676 | | - if (safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_PROTECTIVE_STOPPED)] || |
677 | | - safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_ROBOT_EMERGENCY_STOPPED)] || |
678 | | - safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_EMERGENCY_STOPPED)] || |
679 | | - safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_VIOLATION)] || |
680 | | - safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_FAULT)] || |
681 | | - safety_status_bits_[toUnderlying(UrRtdeSafetyStatusBits::IS_STOPPED_DUE_TO_SAFETY)]) |
| 685 | + if ((safety_status_bits_ | in_error_bitset_).any()) |
682 | 686 | { |
683 | 687 | robot_status_resource_.in_error = TriState::TRUE; |
684 | 688 | } |
|
0 commit comments