Skip to content

Commit 730e627

Browse files
committed
fix: clang-tidy, removes unnecessary time shift of the second trajectory
1 parent a16f9b0 commit 730e627

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

moveit_planners/pilz_industrial_motion_planner/src/trajectory_blender_transition_window.cpp

-27
Original file line numberDiff line numberDiff line change
@@ -134,33 +134,6 @@ bool pilz_industrial_motion_planner::TrajectoryBlenderTransitionWindow::blend(
134134
req.second_trajectory->getWayPointDurationFromPrevious(i));
135135
}
136136

137-
// adjust the time from start of the first second trajectory point to ensure continuity of velocities (this implicitly
138-
// ensures continuity of accelerations)
139-
auto second_start = res.second_trajectory->getFirstWayPointPtr();
140-
auto blend_end = res.blend_trajectory->getLastWayPointPtr();
141-
142-
std::vector<double> blend_end_positions, second_start_positions;
143-
blend_end->copyJointGroupPositions(req.first_trajectory->getGroup()->getName(), blend_end_positions);
144-
second_start->copyJointGroupPositions(req.first_trajectory->getGroup()->getName(), second_start_positions);
145-
std::vector<double> second_start_velocities;
146-
second_start->copyJointGroupVelocities(req.first_trajectory->getGroup()->getName(), second_start_velocities);
147-
double time_from_start = 0.0;
148-
std::size_t non_zero_velocity_count = 0;
149-
for (std::size_t i = 0; i < second_start_velocities.size(); ++i)
150-
{
151-
if (second_start_velocities[i] != 0)
152-
{
153-
time_from_start += (second_start_positions[i] - blend_end_positions[i]) / second_start_velocities[i];
154-
++non_zero_velocity_count;
155-
}
156-
}
157-
if (non_zero_velocity_count > 0)
158-
{
159-
RCLCPP_INFO_STREAM(getLogger(),
160-
"Adjusting time from start of second trajectory to ensure velocity continuity. delta_time: "
161-
<< time_from_start / non_zero_velocity_count);
162-
res.second_trajectory->setWayPointDurationFromPrevious(0, time_from_start / non_zero_velocity_count);
163-
}
164137
res.error_code.val = moveit_msgs::msg::MoveItErrorCodes::SUCCESS;
165138
return true;
166139
}

moveit_planners/pilz_industrial_motion_planner/src/trajectory_functions.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ bool pilz_industrial_motion_planner::generateJointTrajectory(
220220
std::vector<double> time_samples;
221221
int num_samples = std::floor(trajectory.Duration() / sampling_time);
222222
sampling_time = trajectory.Duration() / num_samples;
223+
time_samples.reserve(num_samples);
223224
for (int i = 0; i < num_samples; ++i)
224225
{
225226
time_samples.push_back(i * sampling_time);

0 commit comments

Comments
 (0)