10 template<
size_t state_dimensions>
12 using Vector = Eigen::Matrix<double, state_dimensions, 1>;
17 : segments_(aggregated_path.segments_), cumulative_lengths_(aggregated_path.cumulative_lengths_) {}
21 if (segments_.empty())
22 throw std::runtime_error(
"AggregatedPath needs at least one segment..");
23 cumulative_lengths_.resize(segments_.size());
24 double cumulative_length = 0.0;
25 for (
size_t i = 1; i < segments_.size() - 1; i += 1) {
26 cumulative_length += segments_[i]->length();
27 cumulative_lengths_[i] = cumulative_length;
31 [[nodiscard]]
inline double length()
const override {
32 return cumulative_lengths_.back();
37 for (
size_t i = 0; i < state_dimensions; i++) {
38 auto max_ptr = *std::max_element(
39 segments_.begin(), segments_.end(),
41 return std::abs(l->max_ddq()(i)) < std::abs(r->max_ddq()(i));
43 result(i) = std::abs(max_ptr->max_ddq()(i));
50 for (
size_t i = 0; i < state_dimensions; i++) {
51 auto max_ptr = *std::max_element(
52 segments_.begin(), segments_.end(),
54 return std::abs(l->max_dddq()(i)) < std::abs(r->max_dddq()(i));
56 result(i) = std::abs(max_ptr->max_dddq()(i));
63 double s_local = (index == 0) ? s : s - cumulative_lengths_[index - 1];
64 return (*segments_[index])(s_local);
68 auto ptr = std::lower_bound(cumulative_lengths_.begin(), cumulative_lengths_.end(), s);
69 size_t index = std::distance(cumulative_lengths_.begin(), ptr);
70 return std::min(index, segments_.size() - 1);
73 inline std::vector<std::shared_ptr<Path<state_dimensions>>>
segments()
const {
78 std::vector<std::shared_ptr<Path<state_dimensions>>> segments_;
79 std::vector<double> cumulative_lengths_;
90 mk_path_from_waypoints(
const std::vector<PathWaypoint> &waypoints,
double default_initial_elbow_pos = 0.0);
Definition: aggregated_path.hpp:11
AggregatedPath(const AggregatedPath< state_dimensions > &aggregated_path)
Definition: aggregated_path.hpp:16
AggregatedPath(const std::vector< std::shared_ptr< Path< state_dimensions >>> &segments)
Definition: aggregated_path.hpp:19
size_t get_index(double s) const
Definition: aggregated_path.hpp:67
Vector max_ddq() const override
Definition: aggregated_path.hpp:35
Vector max_dddq() const override
Definition: aggregated_path.hpp:48
PathStep< state_dimensions > operator()(double s) const override
Definition: aggregated_path.hpp:61
double length() const override
Definition: aggregated_path.hpp:31
std::vector< std::shared_ptr< Path< state_dimensions > > > segments() const
Definition: aggregated_path.hpp:73
Cartesian pose of a robot.
Definition: robot_pose.hpp:16
Definition: gripper.cpp:3
AggregatedPath< 7 > mk_path_from_waypoints(const std::vector< PathWaypoint > &waypoints, double default_initial_elbow_pos)
Definition: aggregated_path.cpp:8
Definition: aggregated_path.hpp:82
double blend_max_distance
Path Waypoint: Maximum distance for blending.
Definition: aggregated_path.hpp:86
RobotPose robot_pose
Definition: aggregated_path.hpp:83