Skip to content

Commit 5d58245

Browse files
committed
Check for protective stop at the beginning
1 parent ccc2482 commit 5d58245

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/test_instruction_executor.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const std::string CALIBRATION_CHECKSUM = "calib_12788084448423163542";
4444
std::string ROBOT_IP = "192.168.56.101";
4545

4646
bool g_program_running;
47-
bool g_is_protective_stopped = false;
4847
std::condition_variable g_program_not_running_cv;
4948
std::mutex g_program_not_running_mutex;
5049
std::condition_variable g_program_running_cv;
@@ -136,7 +135,10 @@ class InstructionExecutorTest : public ::testing::Test
136135
void SetUp() override
137136
{
138137
executor_ = std::make_unique<InstructionExecutor>(g_ur_driver);
139-
if (g_is_protective_stopped)
138+
std::string safety_status;
139+
g_dashboard_client->commandSafetyStatus(safety_status);
140+
bool is_protective_stopped = safety_status.find("PROTECTIVE_STOP") != std::string::npos;
141+
if (is_protective_stopped)
140142
{
141143
// We forced a protective stop above. Some versions require waiting 5 seconds before releasing
142144
// the protective stop.
@@ -298,7 +300,6 @@ TEST_F(InstructionExecutorTest, unfeasible_movej_target_results_in_failure)
298300

299301
// move to an unfeasible pose
300302
ASSERT_FALSE(executor_->moveJ({ -123, 0, 0, 0, 0, 0 }));
301-
g_is_protective_stopped = true;
302303
}
303304

304305
TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
@@ -308,7 +309,6 @@ TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
308309

309310
// move to an unfeasible pose
310311
ASSERT_FALSE(executor_->moveL({ -10.203, 0.263, 0.559, 0.68, -1.083, -2.076 }, 1.4, 1.04, 0.1));
311-
g_is_protective_stopped = true;
312312
}
313313

314314
TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)
@@ -319,7 +319,6 @@ TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)
319319

320320
};
321321
ASSERT_FALSE(executor_->executeMotion(motion_sequence));
322-
g_is_protective_stopped = true;
323322
}
324323

325324
TEST_F(InstructionExecutorTest, unfeasible_times_succeeds)

0 commit comments

Comments
 (0)