Skip to content

Commit dafaedf

Browse files
authored
instruction_executor: fix movel test (#280)
The unfeasible target for `movel` with the instruction executor seems to be flaky. Since with `movel` we cannot request a motion running outside the reachable volume without running into a singularity, we'll have to check for a protective stop, instead.
1 parent caf8529 commit dafaedf

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/test_instruction_executor.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,25 @@ TEST_F(InstructionExecutorTest, unfeasible_movej_target_results_in_failure)
222222
TEST_F(InstructionExecutorTest, unfeasible_movel_target_results_in_failure)
223223
{
224224
// move to a feasible starting pose
225-
ASSERT_TRUE(executor_->moveJ({ -1.57, -1.6, 1.6, -0.7, 0.7, 0.2 }));
225+
ASSERT_TRUE(executor_->moveJ({ -1.59, -1.72, -2.2, -0.8, 1.6, 0.2 }, 2.0, 2.0));
226226

227227
// move to an unfeasible pose
228-
ASSERT_FALSE(executor_->moveL({ -10.203, 0.263, 0.559, 0.68, -1.083, -2.076 }, 1.4, 1.04, 0.1));
228+
std::thread move_thread([this]() { executor_->moveL({ -10.203, 0.263, 0.559, 0.68, -1.083, -2.076 }, 1.5, 1.5); });
229+
230+
std::string safety_status;
231+
bool is_protective_stopped = false;
232+
std::chrono::steady_clock::time_point start = std::chrono::steady_clock::now();
233+
while (!is_protective_stopped || std::chrono::steady_clock::now() > start + std::chrono::seconds(5))
234+
{
235+
g_my_robot->dashboard_client_->commandSafetyStatus(safety_status);
236+
is_protective_stopped = safety_status.find("PROTECTIVE_STOP") != std::string::npos;
237+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
238+
}
239+
ASSERT_TRUE(is_protective_stopped);
240+
ASSERT_TRUE(g_my_robot->clearProtectiveStop());
241+
ASSERT_TRUE(g_my_robot->dashboard_client_->commandStop());
242+
243+
move_thread.join();
229244
}
230245

231246
TEST_F(InstructionExecutorTest, unfeasible_sequence_targets_results_in_failure)

0 commit comments

Comments
 (0)