1 #ifndef PCL_TRACKING_IMPL_TRACKING_H_
2 #define PCL_TRACKING_IMPL_TRACKING_H_
4 #include <pcl/common/eigen.h>
5 #include <pcl/tracking/tracking.h>
28 x = y = z = roll = pitch = yaw = 0.0;
37 roll = pitch = yaw = 0.0;
42 float _x,
float _y,
float _z,
float _roll,
float _pitch,
float _yaw)
60 sample(
const std::vector<double>& mean,
const std::vector<double>& cov)
77 Eigen::Matrix3f current_rotation;
79 Eigen::Quaternionf q_current_rotation(current_rotation);
81 Eigen::Matrix3f mean_rotation;
85 Eigen::Quaternionf q_mean_rotation(mean_rotation);
89 constexpr
float scale_factor = 0.2862;
95 Eigen::Vector4f vec_sample_mean_0(a, b, c, 1);
96 Eigen::Quaternionf q_sample_mean_0(vec_sample_mean_0);
97 q_sample_mean_0.normalize();
99 Eigen::Quaternionf q_sample_user_mean =
100 q_sample_mean_0 * q_mean_rotation * q_current_rotation;
102 Eigen::Affine3f affine_R(q_sample_user_mean.toRotationMatrix());
117 inline Eigen::Affine3f
126 float trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw;
128 trans, trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw);
129 return {trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw};
160 os <<
"(" << p.x <<
"," << p.y <<
"," << p.z <<
"," << p.
roll <<
"," << p.
pitch <<
","
166 inline ParticleXYZRPY
170 newp.x =
static_cast<float>(p.x * val);
171 newp.y =
static_cast<float>(p.y * val);
172 newp.z =
static_cast<float>(p.z * val);
173 newp.
roll =
static_cast<float>(p.
roll * val);
174 newp.
pitch =
static_cast<float>(p.
pitch * val);
175 newp.
yaw =
static_cast<float>(p.
yaw * val);
180 inline ParticleXYZRPY
194 inline ParticleXYZRPY
231 x = y = z = roll = pitch = yaw = 0.0;
240 roll = pitch = yaw = 0.0;
244 inline ParticleXYZR(
float _x,
float _y,
float _z,
float,
float _pitch,
float)
262 sample(
const std::vector<double>& mean,
const std::vector<double>& cov)
268 pitch +=
static_cast<float>(
sampleNormal(mean[4], cov[4]));
283 inline Eigen::Affine3f
292 float trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw;
294 trans, trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw);
295 return {trans_x, trans_y, trans_z, 0, trans_pitch, 0};
326 os <<
"(" << p.x <<
"," << p.y <<
"," << p.z <<
"," << p.
roll <<
"," << p.
pitch <<
","
336 newp.x =
static_cast<float>(p.x * val);
337 newp.y =
static_cast<float>(p.y * val);
338 newp.z =
static_cast<float>(p.z * val);
339 newp.
roll =
static_cast<float>(p.
roll * val);
340 newp.
pitch =
static_cast<float>(p.
pitch * val);
341 newp.
yaw =
static_cast<float>(p.
yaw * val);
397 x = y = z = roll = pitch = yaw = 0.0;
406 roll = pitch = yaw = 0.0;
410 inline ParticleXYRPY(
float _x,
float,
float _z,
float _roll,
float _pitch,
float _yaw)
428 sample(
const std::vector<double>& mean,
const std::vector<double>& cov)
433 roll +=
static_cast<float>(
sampleNormal(mean[3], cov[3]));
434 pitch +=
static_cast<float>(
sampleNormal(mean[4], cov[4]));
435 yaw +=
static_cast<float>(
sampleNormal(mean[5], cov[5]));
449 inline Eigen::Affine3f
458 float trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw;
460 trans, trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw);
461 return {trans_x, 0, trans_z, trans_roll, trans_pitch, trans_yaw};
492 os <<
"(" << p.x <<
"," << p.y <<
"," << p.z <<
"," << p.
roll <<
"," << p.
pitch <<
","
502 newp.x =
static_cast<float>(p.x * val);
503 newp.y =
static_cast<float>(p.y * val);
504 newp.z =
static_cast<float>(p.z * val);
505 newp.
roll =
static_cast<float>(p.
roll * val);
506 newp.
pitch =
static_cast<float>(p.
pitch * val);
507 newp.
yaw =
static_cast<float>(p.
yaw * val);
563 x = y = z = roll = pitch = yaw = 0.0;
572 roll = pitch = yaw = 0.0;
576 inline ParticleXYRP(
float _x,
float,
float _z,
float,
float _pitch,
float _yaw)
594 sample(
const std::vector<double>& mean,
const std::vector<double>& cov)
600 pitch +=
static_cast<float>(
sampleNormal(mean[4], cov[4]));
601 yaw +=
static_cast<float>(
sampleNormal(mean[5], cov[5]));
615 inline Eigen::Affine3f
624 float trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw;
626 trans, trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw);
627 return {trans_x, 0, trans_z, 0, trans_pitch, trans_yaw};
658 os <<
"(" << p.x <<
"," << p.y <<
"," << p.z <<
"," << p.
roll <<
"," << p.
pitch <<
","
668 newp.x =
static_cast<float>(p.x * val);
669 newp.y =
static_cast<float>(p.y * val);
670 newp.z =
static_cast<float>(p.z * val);
671 newp.
roll =
static_cast<float>(p.
roll * val);
672 newp.
pitch =
static_cast<float>(p.
pitch * val);
673 newp.
yaw =
static_cast<float>(p.
yaw * val);
729 x = y = z = roll = pitch = yaw = 0.0;
738 roll = pitch = yaw = 0.0;
742 inline ParticleXYR(
float _x,
float,
float _z,
float,
float _pitch,
float)
760 sample(
const std::vector<double>& mean,
const std::vector<double>& cov)
766 pitch +=
static_cast<float>(
sampleNormal(mean[4], cov[4]));
781 inline Eigen::Affine3f
790 float trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw;
792 trans, trans_x, trans_y, trans_z, trans_roll, trans_pitch, trans_yaw);
793 return {trans_x, 0, trans_z, 0, trans_pitch, 0};
824 os <<
"(" << p.x <<
"," << p.y <<
"," << p.z <<
"," << p.
roll <<
"," << p.
pitch <<
","
834 newp.x =
static_cast<float>(p.x * val);
835 newp.y =
static_cast<float>(p.y * val);
836 newp.z =
static_cast<float>(p.z * val);
837 newp.
roll =
static_cast<float>(p.
roll * val);
838 newp.
pitch =
static_cast<float>(p.
pitch * val);
839 newp.
yaw =
static_cast<float>(p.
yaw * val);
874 #define PCL_STATE_POINT_TYPES \
875 (pcl::tracking::ParticleXYR)(pcl::tracking::ParticleXYZRPY)( \
876 pcl::tracking::ParticleXYZR)(pcl::tracking::ParticleXYRPY)( \
877 pcl::tracking::ParticleXYRP)
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
void getTranslationAndEulerAngles(const Eigen::Transform< Scalar, 3, Eigen::Affine > &t, Scalar &x, Scalar &y, Scalar &z, Scalar &roll, Scalar &pitch, Scalar &yaw)
Extract x,y,z and the Euler angles (intrinsic rotations, ZYX-convention) from the given transformatio...
void getTransformation(Scalar x, Scalar y, Scalar z, Scalar roll, Scalar pitch, Scalar yaw, Eigen::Transform< Scalar, 3, Eigen::Affine > &t)
Create a transformation from the given translation and Euler angles (intrinsic rotations,...
void getEulerAngles(const Eigen::Transform< Scalar, 3, Eigen::Affine > &t, Scalar &roll, Scalar &pitch, Scalar &yaw)
Extract the Euler angles (intrinsic rotations, ZYX-convention) from the given transformation.
Defines functions, macros and traits for allocating and using memory.
PCL_EXPORTS double sampleNormal(double mean, double sigma)
ParticleXYZRPY operator*(const ParticleXYZRPY &p, double val)
std::ostream & operator<<(std::ostream &os, const ParticleXYZRPY &p)
ParticleXYZRPY operator-(const ParticleXYZRPY &a, const ParticleXYZRPY &b)
ParticleXYZRPY operator+(const ParticleXYZRPY &a, const ParticleXYZRPY &b)
Defines all the PCL and non-PCL macros used.
Eigen::Affine3f toEigenMatrix() const
static int stateDimension()
ParticleXYR(float _x, float, float _z, float, float _pitch, float)
float operator[](unsigned int i)
ParticleXYR(float _x, float, float _z)
void sample(const std::vector< double > &mean, const std::vector< double > &cov)
static ParticleXYR toState(const Eigen::Affine3f &trans)
static int stateDimension()
void sample(const std::vector< double > &mean, const std::vector< double > &cov)
float operator[](unsigned int i)
Eigen::Affine3f toEigenMatrix() const
ParticleXYRP(float _x, float, float _z)
static ParticleXYRP toState(const Eigen::Affine3f &trans)
ParticleXYRP(float _x, float, float _z, float, float _pitch, float _yaw)
void sample(const std::vector< double > &mean, const std::vector< double > &cov)
static int stateDimension()
Eigen::Affine3f toEigenMatrix() const
ParticleXYRPY(float _x, float, float _z)
static ParticleXYRPY toState(const Eigen::Affine3f &trans)
ParticleXYRPY(float _x, float, float _z, float _roll, float _pitch, float _yaw)
float operator[](unsigned int i)
Eigen::Affine3f toEigenMatrix() const
static int stateDimension()
ParticleXYZR(float _x, float _y, float _z, float, float _pitch, float)
static ParticleXYZR toState(const Eigen::Affine3f &trans)
void sample(const std::vector< double > &mean, const std::vector< double > &cov)
ParticleXYZR(float _x, float _y, float _z)
float operator[](unsigned int i)
static ParticleXYZRPY toState(const Eigen::Affine3f &trans)
static int stateDimension()
void sample(const std::vector< double > &mean, const std::vector< double > &cov)
ParticleXYZRPY(float _x, float _y, float _z, float _roll, float _pitch, float _yaw)
Eigen::Affine3f toEigenMatrix() const
float operator[](unsigned int i)
ParticleXYZRPY(float _x, float _y, float _z)