Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an error msg if empty message is received #1424

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,13 @@ bool JointTrajectoryController::validate_trajectory_msg(
{
const bool all_empty = points[i].positions.empty() && points[i].velocities.empty() &&
points[i].accelerations.empty();
if (all_empty)
{
RCLCPP_ERROR(
get_node()->get_logger(),
"The given trajectory has no position, velocity, or acceleration points.");
return false;
}
const bool position_error =
!points[i].positions.empty() &&
!validate_trajectory_point_field(joint_count, points[i].positions, "positions", i, false);
Expand All @@ -1469,7 +1476,7 @@ bool JointTrajectoryController::validate_trajectory_msg(
!points[i].accelerations.empty() &&
!validate_trajectory_point_field(
joint_count, points[i].accelerations, "accelerations", i, false);
if (all_empty || position_error || velocity_error || acceleration_error)
if (position_error || velocity_error || acceleration_error)
{
return false;
}
Expand Down
Loading