Skip to content

Commit

Permalink
Make sure to wait long enough before releasing the PSTOP
Browse files Browse the repository at this point in the history
  • Loading branch information
urfeex committed Jan 22, 2025
1 parent b7addf9 commit a111409
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/test_instruction_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class InstructionExecutorTest : public ::testing::Test
{
protected:
std::unique_ptr<InstructionExecutor> executor_;
bool is_protective_stopped_ = false;

static void SetUpTestSuite()
{
Expand Down Expand Up @@ -135,13 +136,17 @@ class InstructionExecutorTest : public ::testing::Test
void SetUp() override
{
executor_ = std::make_unique<InstructionExecutor>(g_ur_driver);
// Make sure script is running on the robot
if (g_program_running == false)
if (is_protective_stopped_)
{
// We forced a protective stop above. Some versions require waiting 5 seconds before releasing
// the protective stop.
std::this_thread::sleep_for(std::chrono::seconds(5));
g_dashboard_client->commandCloseSafetyPopup();
std::this_thread::sleep_for(std::chrono::milliseconds(500));
ASSERT_TRUE(g_dashboard_client->commandUnlockProtectiveStop());

}
// Make sure script is running on the robot
if (g_program_running == false)
{
g_ur_driver->sendRobotProgram();
ASSERT_TRUE(waitForProgramRunning(1000));
}
Expand Down Expand Up @@ -293,6 +298,7 @@ TEST_F(InstructionExecutorTest, unfeasible_movej_target_results_in_failure)

// move to an unfeasible pose
ASSERT_FALSE(executor_->moveJ({ -123, 0, 0, 0, 0, 0 }));
is_protective_stopped_ = true;
}

TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
Expand All @@ -302,6 +308,7 @@ TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)

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

TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)
Expand All @@ -312,6 +319,7 @@ TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)

};
ASSERT_FALSE(executor_->executeMotion(motion_sequence));
is_protective_stopped_ = true;
}

TEST_F(InstructionExecutorTest, unfeasible_times_succeeds)
Expand Down

0 comments on commit a111409

Please sign in to comment.