42 const char*
LOGGER_NAME =
"trajectory_processing.cartesian_speed";
47 const std::string& link_name)
49 std::vector<const moveit::core::LinkModel*> links;
51 if (!link_name.empty())
55 const auto* link = model.getLinkModel(link_name, &found);
60 links.push_back(link);
74 for (
const auto& link : links)
80 return !links.empty();
93 if (num_waypoints == 0)
97 double euclidean_distance, new_time_diff, old_time_diff;
98 std::vector<double> time_diff(num_waypoints - 1, 0.0);
100 for (
size_t i = 0; i < num_waypoints - 1; i++)
103 const Eigen::Isometry3d& current_link_state = trajectory.
getWayPointPtr(i)->getGlobalLinkTransform(link_model);
104 const Eigen::Isometry3d& next_link_state = trajectory.
getWayPointPtr(i + 1)->getGlobalLinkTransform(link_model);
107 euclidean_distance = (next_link_state.translation() - current_link_state.translation()).norm();
109 new_time_diff = (euclidean_distance / max_speed);
113 time_diff[i] = std::max(new_time_diff, old_time_diff);