8 #include "../state/JointState.h" 9 #include "../state/JointAcceleration.h" 22 template <
size_t NJOINTS,
typename SCALAR =
double>
32 : abs_max_joint_velocities_(kAbsMaxJointVelocities), abs_max_joint_accelerations_(kAbsMaxJointAccelerations)
35 for (
size_t i = 0;
i < NJOINTS;
i++)
52 std::vector<SCALAR> planned_joint_times(NJOINTS);
56 for (
size_t i = 0;
i < NJOINTS;
i++)
58 planned_joint_times[
i] = joint_traj_generators_[
i].setup(
59 start(
i), end(
i), abs_max_joint_velocities_(
i), abs_max_joint_accelerations_(
i));
62 SCALAR time_horizon = *std::max_element(planned_joint_times.begin(), planned_joint_times.end());
63 size_t num_traj_points = round(time_horizon / sampling_time) + 1;
67 std::cout <<
"SimpleArmTrajectoryGenerator: Time horizon of new Trajectory: " << time_horizon <<
" sec." 69 std::cout <<
"SimpleArmTrajectoryGenerator: Number of Sampling Points: " << num_traj_points
75 for (
size_t n = 0;
n < num_traj_points;
n++)
78 double time =
n * sampling_time;
80 for (
size_t i = 0;
i < NJOINTS;
i++)
82 joint_traj_generators_[
i].queryTrajectory(time, x_new, v_new);
84 new_state(
i + NJOINTS) = v_new;
87 new_traj.
push_back(new_state, time,
true);
95 std::vector<tpl::SingleDOFTrajectoryGenerator<SCALAR>> joint_traj_generators_;
typename ct::rbd::JointState< NJOINTS, SCALAR >::Velocity Velocity
Definition: SimpleArmTrajectoryGenerator.h:27
joint state and joint velocity
Definition: JointState.h:21
typename ct::rbd::JointState< NJOINTS, SCALAR >::Position Position
Definition: SimpleArmTrajectoryGenerator.h:26
Definition: SimpleArmTrajectoryGenerator.h:23
CppAD::AD< CppAD::cg::CG< double > > SCALAR
bool verbose
Definition: rbdJITtests.h:15
Eigen::Matrix< SCALAR, NJOINTS, 1 > Acceleration
Definition: JointAcceleration.h:27
core::StateTrajectory< 2 *NJOINTS > generateTrajectory(const Position &start, const Position &end, const SCALAR sampling_time=SCALAR(0.02), bool verbose=false)
Definition: SimpleArmTrajectoryGenerator.h:45
void push_back(const T &data, const SCALAR &time, const bool timeIsAbsolute)
typename ct::rbd::JointAcceleration< NJOINTS, SCALAR >::Acceleration Acceleration
Definition: SimpleArmTrajectoryGenerator.h:28
tpl::SingleDOFTrajectoryGenerator< double > SingleDOFTrajectoryGenerator
Definition: SingleDOFTrajectoryGenerator.h:206
SimpleArmTrajectoryGenerator(const Velocity &kAbsMaxJointVelocities, const Acceleration &kAbsMaxJointAccelerations)
Definition: SimpleArmTrajectoryGenerator.h:31