Skip to content

Commit ccc2482

Browse files
committed
Properly handle aborting trajectories due to illegal point types
Otherwise the hardware will send a result that we will never read and this will bleed into next excution.
1 parent 37e20c3 commit ccc2482

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/ur/instruction_executor.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ bool urcl::InstructionExecutor::executeMotion(
8181
}
8282
default:
8383
URCL_LOG_ERROR("Unsupported motion type");
84-
std::unique_lock<std::mutex> lock(trajectory_result_mutex_);
85-
trajectory_result_ = urcl::control::TrajectoryResult::TRAJECTORY_RESULT_FAILURE;
86-
return false;
84+
// The hardware will complain about missing trajectory points and return a failure for
85+
// trajectory execution. Hence, we need to step into the running loop below.
8786
}
8887
}
8988
trajectory_running_ = true;
@@ -93,8 +92,11 @@ bool urcl::InstructionExecutor::executeMotion(
9392
std::this_thread::sleep_for(std::chrono::milliseconds(100));
9493
driver_->writeTrajectoryControlMessage(urcl::control::TrajectoryControlMessage::TRAJECTORY_NOOP);
9594
}
96-
URCL_LOG_INFO("Trajectory done with result %s", control::trajectoryResultToString(trajectory_result_).c_str());
97-
return trajectory_result_ == urcl::control::TrajectoryResult::TRAJECTORY_RESULT_SUCCESS;
95+
{
96+
std::unique_lock<std::mutex> lock(trajectory_result_mutex_);
97+
URCL_LOG_INFO("Trajectory done with result %s", control::trajectoryResultToString(trajectory_result_).c_str());
98+
return trajectory_result_ == urcl::control::TrajectoryResult::TRAJECTORY_RESULT_SUCCESS;
99+
}
98100
}
99101
bool urcl::InstructionExecutor::moveJ(const urcl::vector6d_t& target, const double acceleration, const double velocity,
100102
const double time, const double blend_radius)

0 commit comments

Comments
 (0)