Skip to content

Commit c84ed09

Browse files
committed
Check for state interfaces being present before attempting to read from it
1 parent a672e94 commit c84ed09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ur_controllers/src/passthrough_trajectory_controller.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ bool PassthroughTrajectoryController::check_goal_tolerance()
597597
return false;
598598
}
599599

600-
if (!active_joint_traj_.points.back().velocities.empty()) {
600+
if (!active_joint_traj_.points.back().velocities.empty() && !joint_velocity_state_interface_.empty()) {
601601
const auto joint_vel = joint_velocity_state_interface_[i].get().get_optional();
602602
if (!joint_vel.has_value()) {
603603
return false;
@@ -607,7 +607,7 @@ bool PassthroughTrajectoryController::check_goal_tolerance()
607607
return false;
608608
}
609609
}
610-
if (!active_joint_traj_.points.back().accelerations.empty()) {
610+
if (!active_joint_traj_.points.back().accelerations.empty() && !joint_acceleration_state_interface_.empty()) {
611611
const auto joint_acc = joint_acceleration_state_interface_[i].get().get_optional();
612612
if (!joint_acc.has_value()) {
613613
return false;

0 commit comments

Comments
 (0)