Skip to content

Commit a111409

Browse files
committed
Make sure to wait long enough before releasing the PSTOP
1 parent b7addf9 commit a111409

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/test_instruction_executor.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class InstructionExecutorTest : public ::testing::Test
9797
{
9898
protected:
9999
std::unique_ptr<InstructionExecutor> executor_;
100+
bool is_protective_stopped_ = false;
100101

101102
static void SetUpTestSuite()
102103
{
@@ -135,13 +136,17 @@ class InstructionExecutorTest : public ::testing::Test
135136
void SetUp() override
136137
{
137138
executor_ = std::make_unique<InstructionExecutor>(g_ur_driver);
138-
// Make sure script is running on the robot
139-
if (g_program_running == false)
139+
if (is_protective_stopped_)
140140
{
141+
// We forced a protective stop above. Some versions require waiting 5 seconds before releasing
142+
// the protective stop.
143+
std::this_thread::sleep_for(std::chrono::seconds(5));
141144
g_dashboard_client->commandCloseSafetyPopup();
142-
std::this_thread::sleep_for(std::chrono::milliseconds(500));
143145
ASSERT_TRUE(g_dashboard_client->commandUnlockProtectiveStop());
144-
146+
}
147+
// Make sure script is running on the robot
148+
if (g_program_running == false)
149+
{
145150
g_ur_driver->sendRobotProgram();
146151
ASSERT_TRUE(waitForProgramRunning(1000));
147152
}
@@ -293,6 +298,7 @@ TEST_F(InstructionExecutorTest, unfeasible_movej_target_results_in_failure)
293298

294299
// move to an unfeasible pose
295300
ASSERT_FALSE(executor_->moveJ({ -123, 0, 0, 0, 0, 0 }));
301+
is_protective_stopped_ = true;
296302
}
297303

298304
TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
@@ -302,6 +308,7 @@ TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
302308

303309
// move to an unfeasible pose
304310
ASSERT_FALSE(executor_->moveL({ -10.203, 0.263, 0.559, 0.68, -1.083, -2.076 }, 1.4, 1.04, 0.1));
311+
is_protective_stopped_ = true;
305312
}
306313

307314
TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)
@@ -312,6 +319,7 @@ TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)
312319

313320
};
314321
ASSERT_FALSE(executor_->executeMotion(motion_sequence));
322+
is_protective_stopped_ = true;
315323
}
316324

317325
TEST_F(InstructionExecutorTest, unfeasible_times_succeeds)

0 commit comments

Comments
 (0)