ros2_control - rolling
Loading...
Searching...
No Matches
cartesian_trajectory.hpp
1// Copyright (c) 2026 ros2_control Development Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef CARTESIAN_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_HPP_
16#define CARTESIAN_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_HPP_
17
18#include <cstddef>
19#include <vector>
20
21#include "Eigen/Dense"
22#include "Eigen/Geometry"
23
24namespace cartesian_trajectory_controller
25{
26
30double min_segment_duration(
31 const Eigen::Vector3d & from_position, const Eigen::Quaterniond & from_orientation,
32 const Eigen::Vector3d & to_position, const Eigen::Quaterniond & to_orientation,
33 double max_linear_speed, double max_angular_speed, double min_duration);
34
38{
39public:
43 const std::vector<double> & times, const std::vector<Eigen::Vector3d> & positions,
44 const std::vector<Eigen::Quaterniond> & orientations,
45 const Eigen::Vector3d & initial_velocity = Eigen::Vector3d::Zero(),
46 double initial_angular_speed = 0.0);
47
50 bool sample(double t, Eigen::Vector3d & position, Eigen::Quaterniond & orientation) const;
51
52 double duration() const;
53
54private:
56 void interpolate_segment(
57 std::size_t index, double time_into_segment, double segment_duration,
58 Eigen::Vector3d & position, Eigen::Quaterniond & orientation) const;
59
60 std::vector<double> times_;
61 std::vector<Eigen::Vector3d> positions_;
62 std::vector<Eigen::Vector3d> velocities_;
63 std::vector<Eigen::Quaterniond> orientations_;
65 std::vector<double> angles_;
66 std::vector<double> angle_velocities_;
67};
68
69} // namespace cartesian_trajectory_controller
70
71#endif // CARTESIAN_TRAJECTORY_CONTROLLER__CARTESIAN_TRAJECTORY_HPP_
CartesianTrajectory(const std::vector< double > &times, const std::vector< Eigen::Vector3d > &positions, const std::vector< Eigen::Quaterniond > &orientations, const Eigen::Vector3d &initial_velocity=Eigen::Vector3d::Zero(), double initial_angular_speed=0.0)
Definition cartesian_trajectory.cpp:42
bool sample(double t, Eigen::Vector3d &position, Eigen::Quaterniond &orientation) const
Definition cartesian_trajectory.cpp:86