28 inline double sqr(
double x)
44 throw std::runtime_error(
"Tried to create reference values for empty trajectory!");
47 std::vector<std::vector<double> > zwischenPunkte;
55 double between_stepsize = 0.8;
56 for (
unsigned int i=0; i <
m_trajectory.points.size()-1; i++)
58 std::vector<double> direction;
59 direction.resize(
m_trajectory.points[i+1].positions.size());
61 for(
unsigned int j = 0; j <
m_trajectory.points[i+1].positions.size(); j++)
64 len += direction.at(j) * direction.at(j);
66 double dist = sqrt(len);
67 int num_segs = ceil(dist/between_stepsize);
68 zwischenPunkte.resize(num_segs);
69 for (
int j=0; j < num_segs; j++)
71 std::vector<double> betw_joint;
72 betw_joint.resize(direction.size());
73 for(
unsigned int d=0;
d < direction.size();
d++)
75 betw_joint.at(
d) =
m_trajectory.points[i].positions.at(
d) + direction.at(
d) * ( (double)j / (
double)num_segs );
77 zwischenPunkte.at(j) = betw_joint;
80 zwischenPunkte.push_back(
m_trajectory.points.back().positions );
83 zwischenPunkte.resize(trajectory.points.size());
84 for(
unsigned int i = 0; i < trajectory.points.size(); i++)
86 zwischenPunkte.at(i) = trajectory.points.at(i).positions;
89 ROS_INFO(
"Calculated %lu zwischenPunkte", zwischenPunkte.size());
99 throw std::runtime_error(
"Error in BSplineND::ipoWithConstSampleDist!");
109 std::vector<double> dist;
164 std::vector<double> soll;
183 int i = int(it-start) - 1;
219 return 0.5*
m_sa1*t*t;
247 std::vector<double> result =
m_trajectory.points.front().positions;
248 if (s < 0.0 || s >= 1.0)
250 for(
unsigned int j=0; j < result.size(); j++)
260 int i = int(it-start) - 1;
269 std::vector<double> vi;
270 std::vector<double> vii;
315 result.at(k) = vi.at(k) + (vii.at(k)-vi.at(k))*frac;
RefValJS_PTP_Trajectory(const trajectory_msgs::JointTrajectory &trajectory, double v_rad_s, double a_rad_s2, bool smooth=false)
BSplineND< std::vector< double > > m_TrajectorySpline
double norm(const std::vector< double > &j)
std::vector< double >::const_iterator vecd_it
void setCtrlPoints(const std::vector< PointND > &ctrlPointVec)
trajectory_msgs::JointTrajectory m_trajectory
bool ipoWithConstSampleDist(double dIpoDist, std::vector< PointND > &ipoVec)
double ds_dt(double t) const
static const double weigths[]
std::vector< double > r(double s) const
double getMaxdPos() const
std::vector< double > dr_ds(double s) const
std::vector< std::vector< double > > m_SplinePoints