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

refactor(motion_utils): stop using CAPACITY from Trajectory message #5755

Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 1 addition & 6 deletions common/motion_utils/src/trajectory/tmp_conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ autoware_auto_planning_msgs::msg::Trajectory convertToTrajectory(
const std::vector<autoware_auto_planning_msgs::msg::TrajectoryPoint> & trajectory)
{
autoware_auto_planning_msgs::msg::Trajectory output{};
for (const auto & pt : trajectory) {
output.points.push_back(pt);
if (output.points.size() >= output.CAPACITY) {
break;
}
}
for (const auto & pt : trajectory) output.points.push_back(pt);
return output;
}

Expand Down
11 changes: 0 additions & 11 deletions common/motion_utils/test/src/trajectory/test_trajectory.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 TIER IV, Inc.

Check notice on line 1 in common/motion_utils/test/src/trajectory/test_trajectory.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Lines of Code in a Single File

The lines of code decreases from 4262 to 4254, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -803,17 +803,6 @@
const auto traj = convertToTrajectory(traj_input);
EXPECT_EQ(traj.points.size(), traj_input.size());
}

// Clipping check
{
const auto traj_input = generateTestTrajectoryPointArray(10000, 1.0);
const auto traj = convertToTrajectory(traj_input);
EXPECT_EQ(traj.points.size(), traj.CAPACITY);
// Value check
for (size_t i = 0; i < traj.points.size(); ++i) {
EXPECT_EQ(traj.points.at(i), traj_input.at(i));
}
}
}

TEST(trajectory, convertToTrajectoryPointArray)
Expand Down
Loading