OMIPUtils.cpp
Go to the documentation of this file.
1 #include <lgsm/Lgsm>
2 
4 
5 #include <math.h>
6 
7 #include <tr1/random>
8 
9 #include <iostream>
10 #include <fstream>
11 
12 using namespace omip;
13 
14 void omip::EigenAffine2TranslationAndEulerAngles(const Eigen::Affine3d& t,
15  double& x, double& y, double& z,
16  double& roll, double& pitch,
17  double& yaw)
18 {
19  x = t(0, 3);
20  y = t(1, 3);
21  z = t(2, 3);
22  roll = atan2(t(2, 1), t(2, 2));
23  pitch = asin(-t(2, 0));
24  yaw = atan2(t(1, 0), t(0, 0));
25 }
26 
28  const double& x, const double& y, const double& z, const double& roll, const double& pitch, const double& yaw,
29  Eigen::Transform<double, 3, Eigen::Affine> &t)
30 {
31  double A = cos(yaw), B = sin(yaw), C = cos(pitch), D = sin(pitch), E = cos(roll), F = sin(roll), DE = D * E, DF = D * F;
32 
33  t(0, 0) = A * C;
34  t(0, 1) = A * DF - B * E;
35  t(0, 2) = B * F + A * DE;
36  t(0, 3) = x;
37  t(1, 0) = B * C;
38  t(1, 1) = A * E + B * DF;
39  t(1, 2) = B * DE - A * F;
40  t(1, 3) = y;
41  t(2, 0) = -D;
42  t(2, 1) = C * F;
43  t(2, 2) = C * E;
44  t(2, 3) = z;
45  t(3, 0) = 0;
46  t(3, 1) = 0;
47  t(3, 2) = 0;
48  t(3, 3) = 1;
49 }
50 
51 double omip::sampleNormal(double mean, double std_dev)
52 {
53  using namespace boost;
54  static std::tr1::mt19937 rng(static_cast<unsigned>(std::time(0)));
55 
56  std::tr1::normal_distribution<double> norm_dist(mean, std_dev);
57 
58  std::tr1::variate_generator<std::tr1::mt19937&, std::tr1::normal_distribution<double> > normal_sampler(
59  rng, norm_dist);
60 
61  return (normal_sampler());
62 }
63 
64 std::ostream& omip::operator <<(std::ostream& os,
65  std::vector<Feature::Id> vector_ids)
66 {
67  for (size_t idx = 0; idx < vector_ids.size(); idx++)
68  {
69  os << vector_ids.at(idx) << " ";
70  }
71  return (os);
72 }
73 
74 std::ostream& omip::operator <<(std::ostream& os, Feature::Location location)
75 {
76  os << "(" << boost::tuples::get<0>(location) << ","
77  << boost::tuples::get<1>(location) << ","
78  << boost::tuples::get<2>(location) << ")";
79 
80  return (os);
81 }
82 
83 std::ostream& omip::operator <<(std::ostream& os, Eigen::Twistd twistd)
84 {
85  os << "(" << twistd.vx() << ","
86  << twistd.vy() << ","
87  << twistd.vz() << ","
88  << twistd.rx() << ","
89  << twistd.ry() << ","
90  << twistd.rz() << ")";
91 
92  return (os);
93 }
94 
95 double omip::L2Distance(const Feature::Location &first, const Feature::Location &second)
96 {
97  double error_value = sqrt( pow(boost::tuples::get<0>(first) - boost::tuples::get<0>(second), 2)
98  + pow(boost::tuples::get<1>(first) - boost::tuples::get<1>(second), 2)
99  + pow(boost::tuples::get<2>(first) - boost::tuples::get<2>(second), 2));
100  return error_value;
101 }
102 
103 void omip::TransformMatrix2Twist(const Eigen::Matrix4d& transformation_matrix, Eigen::Twistd &twist)
104 {
105  //std::cout << "Error! Do not use TransformMatrix2Twist. It uses the log to convert from lie group to lie algebra and log is dicontinuous. Use TransformMatrix2TwistUnwrapped instead!" << std::endl;
106  //getchar();
107  Eigen::Displacementd displ_from_transf(transformation_matrix);
108  twist = displ_from_transf.log(1e-12);
109 }
110 
111 void omip::TransformMatrix2TwistUnwrapped(const Eigen::Matrix4d& transformation_matrix, Eigen::Twistd &twist, const Eigen::Twistd &twist_previous)
112 {
113  Eigen::Displacementd displ_from_transf(transformation_matrix);
114  twist = displ_from_transf.log(1e-12);
115 }
116 
117 void omip::Twist2TransformMatrix(const Eigen::Twistd& transformation_twist, Eigen::Matrix4d &matrix)
118 {
119  Eigen::Displacementd displ_from_twist = transformation_twist.exp(1e-12);
120  matrix = displ_from_twist.toHomogeneousMatrix();
121 }
122 
123 void omip::TransformLocation(const Feature::Location& origin, const Eigen::Matrix4d& transformation, Feature::Location& new_location)
124 {
125  Eigen::Affine3d motion_matrix(transformation);
126  Eigen::Vector3d origin_vector = Eigen::Vector3d(
127  boost::tuples::get<0>(origin), boost::tuples::get<1>(origin),
128  boost::tuples::get<2>(origin));
129  Eigen::Vector3d destination_vector = motion_matrix * origin_vector;
130  boost::tuples::get<0>(new_location) = destination_vector[0];
131  boost::tuples::get<1>(new_location)= destination_vector[1];
132  boost::tuples::get<2>(new_location) = destination_vector[2];
133 }
134 
135 void omip::TransformLocation(const Feature::Location& origin, const Eigen::Twistd& twist, Feature::Location& new_location, int feat_id)
136 {
137  Eigen::Matrix4d eigen_transform;
138  omip::Twist2TransformMatrix(twist, eigen_transform);
139 
140  omip::TransformLocation(origin, eigen_transform, new_location);
141 
142  // std::ofstream feat_innovation;
143  // std::ostringstream name_file;
144  // name_file << "/home/roberto/Desktop/twists_and_Ts.txt";
145  // feat_innovation.open (name_file.str().c_str(), std::ios::app);
146 
147  // feat_innovation << feat_id << std::endl;
148  // feat_innovation << boost::tuples::get<0>(origin) << " " << boost::tuples::get<1>(origin) << " " << boost::tuples::get<2>(origin) << " " << std::endl;
149  // Eigen::Twistd copy = twist;
150  // Eigen::Vector3d angular_part = Eigen::Vector3d(copy.rx(),copy.ry(),copy.rz() );
151  // feat_innovation << (angular_part.norm() - 2*M_PI) << std::endl;
152  // feat_innovation << boost::tuples::get<0>(new_location) << " " << boost::tuples::get<1>(new_location) << " " << boost::tuples::get<2>(new_location) << " " << std::endl;
153  // feat_innovation << twist << std::endl;
154  // feat_innovation << eigen_transform << std::endl<< std::endl;
155  // feat_innovation.close();
156 }
157 
158 void omip::TransformLocation(const Feature::Location& origin, const geometry_msgs::Twist& twist, Feature::Location& new_location)
159 {
160  Eigen::Twistd eigen_twist;
161  GeometryMsgsTwist2EigenTwist(twist, eigen_twist);
162  omip::TransformLocation(origin, eigen_twist, new_location);
163 }
164 
165 void omip::LocationOfFeature2ColumnVector(const Feature::Location &lof, MatrixWrapper::ColumnVector &col_vec)
166 {
167  col_vec(1) = boost::tuples::get<0>(lof);
168  col_vec(2) = boost::tuples::get<1>(lof);
169  col_vec(3) = boost::tuples::get<2>(lof);
170 }
171 
172 void omip::LocationOfFeature2ColumnVectorHomogeneous(const Feature::Location& lof, MatrixWrapper::ColumnVector& col_vec)
173 {
174  col_vec(1) = boost::tuples::get<0>(lof);
175  col_vec(2) = boost::tuples::get<1>(lof);
176  col_vec(3) = boost::tuples::get<2>(lof);
177  col_vec(4) = 1;
178 }
179 
180 void omip::LocationOfFeature2EigenVectorHomogeneous(const Feature::Location& lof, Eigen::Vector4d& eig_vec)
181 {
182  eig_vec(0) = boost::tuples::get<0>(lof);
183  eig_vec(1) = boost::tuples::get<1>(lof);
184  eig_vec(2) = boost::tuples::get<2>(lof);
185  eig_vec(3) = 1;
186 }
187 
189  const Feature::Location& location2)
190 {
191  return Feature::Location(
192  boost::tuples::get<0>(location1) - boost::tuples::get<0>(location2),
193  boost::tuples::get<1>(location1) - boost::tuples::get<1>(location2),
194  boost::tuples::get<2>(location1) - boost::tuples::get<2>(location2));
195 }
196 
198  const Feature::Location& location2)
199 {
200  return Feature::Location(
201  boost::tuples::get<0>(location1) + boost::tuples::get<0>(location2),
202  boost::tuples::get<1>(location1) + boost::tuples::get<1>(location2),
203  boost::tuples::get<2>(location1) + boost::tuples::get<2>(location2));
204 }
205 
206 void omip::GeometryMsgsTwist2EigenTwist(const geometry_msgs::Twist& gm_twist, Eigen::Twistd &eigen_twist)
207 {
208  eigen_twist = Eigen::Twistd(gm_twist.angular.x, gm_twist.angular.y, gm_twist.angular.z,
209  gm_twist.linear.x, gm_twist.linear.y, gm_twist.linear.z);
210 }
211 
212 void omip::EigenTwist2GeometryMsgsTwist(Eigen::Twistd& eigen_twist, geometry_msgs::Twist &gm_twist)
213 {
214  gm_twist.linear.x = eigen_twist.getLinearVelocity().x();
215  gm_twist.linear.y = eigen_twist.getLinearVelocity().y();
216  gm_twist.linear.z = eigen_twist.getLinearVelocity().z();
217  gm_twist.angular.x = eigen_twist.getAngularVelocity().x();
218  gm_twist.angular.y = eigen_twist.getAngularVelocity().y();
219  gm_twist.angular.z = eigen_twist.getAngularVelocity().z();
220 }
221 
222 bool omip::isFinite(const Eigen::Matrix4d& transformation)
223 {
224  bool ret_val = true;
225  for (int col = 0; col < transformation.cols(); ++col)
226  {
227  for (int row = 0; row < transformation.rows(); ++row)
228  {
229  if (isnan(transformation(row, col)))
230  {
231  ret_val = false;
232  break;
233  }
234  }
235  }
236  return ret_val;
237 }
238 
239 void omip::Location2PointPCL(const Feature::Location &point_location,pcl::PointXYZ& point_pcl)
240 {
241  point_pcl.x = boost::tuples::get<0>(point_location);
242  point_pcl.y = boost::tuples::get<1>(point_location);
243  point_pcl.z = boost::tuples::get<2>(point_location);
244 }
245 
246 void omip::LocationAndId2FeaturePCL(const Feature::Location &feature_location, const Feature::Id &feature_id, omip::FeaturePCL &feature_pcl)
247 {
248  feature_pcl.x = boost::tuples::get<0>(feature_location);
249  feature_pcl.y = boost::tuples::get<1>(feature_location);
250  feature_pcl.z = boost::tuples::get<2>(feature_location);
251  feature_pcl.label = feature_id;
252 }
253 
254 void omip::LocationAndId2FeaturePCLwc(const Feature::Location &feature_location, const Feature::Id &feature_id, omip::FeaturePCLwc &feature_pcl)
255 {
256  feature_pcl.x = boost::tuples::get<0>(feature_location);
257  feature_pcl.y = boost::tuples::get<1>(feature_location);
258  feature_pcl.z = boost::tuples::get<2>(feature_location);
259  feature_pcl.label = feature_id;
260 }
261 
262 void omip::ROSTwist2EigenTwist(const geometry_msgs::Twist& ros_twist, Eigen::Twistd& eigen_twist)
263 {
264  geometry_msgs::Vector3 linear = ros_twist.linear;
265  geometry_msgs::Vector3 angular = ros_twist.angular;
266  eigen_twist = Eigen::Twistd(angular.x, angular.y, angular.z,
267  linear.x, linear.y, linear.z);
268 }
269 
270 //Normalize to [-180,180):
271 inline double constrainAngle(double x){
272  x = fmod(x + M_PI,2*M_PI);
273  if (x < 0)
274  x += 2*M_PI;
275  return x - M_PI;
276 }
277 // convert to [-360,360]
278 inline double angleConv(double angle){
279  return fmod(constrainAngle(angle),2*M_PI);
280 }
281 inline double angleDiff(double a,double b){
282  double dif = fmod(b - a + M_PI,2*M_PI);
283  if (dif < 0)
284  dif += 2*M_PI;
285  return dif - M_PI;
286 }
287 inline double unwrap(double previousAngle,double newAngle){
288  return previousAngle - angleDiff(newAngle,angleConv(previousAngle));
289 }
290 
291 Eigen::Twistd omip::unwrapTwist(Eigen::Twistd& current_twist, Eigen::Displacementd& current_displacement, Eigen::Twistd& previous_twist, bool& changed)
292 {
293  Eigen::Vector3d current_angular_component = Eigen::Vector3d(current_twist.rx(), current_twist.ry(), current_twist.rz());
294  double current_rotation_angle = current_angular_component.norm();
295  Eigen::Vector3d current_angular_direction = current_angular_component / current_rotation_angle;
296  Eigen::Vector3d previous_angular_component = Eigen::Vector3d(previous_twist.rx(), previous_twist.ry(), previous_twist.rz());
297  double previous_rotation_angle = previous_angular_component.norm();
298  Eigen::Vector3d previous_angular_direction = previous_angular_component / previous_rotation_angle;
299 
300  // The difference should be around 2PI (a little bit less)
301  if(Eigen::Vector3d(current_twist.rx()-previous_twist.rx(), current_twist.ry()-previous_twist.ry(), current_twist.rz()-previous_twist.rz()).norm() > M_PI
302  || current_angular_direction.dot(previous_angular_direction) < -0.8)
303  {
304 
305  Eigen::Vector3d new_angular_component;
306 
307  Eigen::Twistd unwrapped_twist;
308  // Two cases:
309  // 1) Jump from PI to -PI or vice versa
310  // 1) Jump from 2*PI to 0 or from -2*PI to zero
311  if(previous_rotation_angle + 0.3 < 2*M_PI)
312  {
313  // If previous and current are looking in opposite directions -> scalar product will be close to -1
314  if(current_angular_direction.dot(previous_angular_direction) < 0)
315  {
316  new_angular_component= M_PI*previous_angular_direction -(M_PI - current_rotation_angle)*current_angular_direction;
317  }// If both are looking in the same direction -> scalar product is close to +1
318  else{
319  new_angular_component= M_PI*previous_angular_direction +(M_PI - current_rotation_angle)*current_angular_direction;
320  }
321  }else{
322  ROS_ERROR_STREAM("Numeric instability in the logarithm of a homogeneous transformation!");
323  // If previous and current are looking in opposite directions -> scalar product will be close to -1
324  if(current_angular_direction.dot(previous_angular_direction) < 0)
325  {
326  new_angular_component= std::min(2*M_PI, previous_rotation_angle)*previous_angular_direction +current_rotation_angle*current_angular_direction;
327  }// If both are looking in the same direction -> scalar product is close to +1
328  else{
329  new_angular_component= std::min(2*M_PI, previous_rotation_angle)*previous_angular_direction +current_rotation_angle*current_angular_direction;
330  }
331  }
332 
333  double n2 = new_angular_component.squaredNorm(); // ||wtilde||^2
334  double n = sqrt(n2);
335  double sn = sin(n);
336  double val = (double(2.0) * sn - n * (double(1.0) + cos(n))) / (double(2.0) *n2 * sn);
337 
338  Eigen::Vector3d RE3Element = Eigen::Vector3d(current_displacement.getR3Element()(0),current_displacement.getR3Element()(1),current_displacement.getR3Element()(2) );
339  Eigen::Vector3d lin = -0.5*new_angular_component.cross(RE3Element);
340  lin += (double(1.0) - val * n2 ) * RE3Element;
341  lin += val * new_angular_component.dot(RE3Element) * new_angular_component;
342 
343  unwrapped_twist = Eigen::Twistd(new_angular_component.x(), new_angular_component.y(), new_angular_component.z(), lin.x(), lin.y(), lin.z());
344 
345  if(std::fabs(val) > 10)
346  {
347  ROS_ERROR_STREAM("Numeric instability in the logarithm of a homogeneous transformation. Val: " << val);
348  }
349 
350  changed = true;
351  return unwrapped_twist;
352  }else{
353  changed = false;
354  return current_twist;
355  }
356 }
357 
358 Eigen::Twistd omip::invertTwist(Eigen::Twistd& current_twist, Eigen::Twistd& previous_twist, bool& inverted)
359 {
360  Eigen::Vector3d current_angular_component = Eigen::Vector3d(current_twist.rx(), current_twist.ry(), current_twist.rz());
361  double current_rotation_angle = current_angular_component.norm();
362  Eigen::Vector3d current_angular_direction = current_angular_component / current_rotation_angle;
363  Eigen::Vector3d previous_angular_component = Eigen::Vector3d(previous_twist.rx(), previous_twist.ry(), previous_twist.rz());
364  double previous_rotation_angle = previous_angular_component.norm();
365  Eigen::Vector3d previous_angular_direction = previous_angular_component / previous_rotation_angle;
366  // The difference should be around 2PI (a little bit less)
367  if(Eigen::Vector3d(current_twist.rx()-previous_twist.rx(), current_twist.ry()-previous_twist.ry(), current_twist.rz()-previous_twist.rz()).norm() > M_PI
368  || current_angular_direction.dot(previous_angular_direction) < -0.8)
369  {
370  inverted = true;
371  return -current_twist;
372  }else{
373  inverted = false;
374  return current_twist;
375  }
376 }
377 
378 void omip::invert3x3Matrix(const MatrixWrapper::Matrix& to_inv, MatrixWrapper::Matrix& inverse)
379 {
380  double determinant = +to_inv(1,1)*(to_inv(2,2)*to_inv(3,3)-to_inv(3,2)*to_inv(2,3))
381  -to_inv(1,2)*(to_inv(2,1)*to_inv(3,3)-to_inv(2,3)*to_inv(3,1))
382  +to_inv(1,3)*(to_inv(2,1)*to_inv(3,2)-to_inv(2,2)*to_inv(3,1));
383  double invdet = 1.0/determinant;
384  inverse(1,1) = (to_inv(2,2)*to_inv(3,3)-to_inv(3,2)*to_inv(2,3))*invdet;
385  inverse(2,1) = -(to_inv(1,2)*to_inv(3,3)-to_inv(1,3)*to_inv(3,2))*invdet;
386  inverse(3,1) = (to_inv(1,2)*to_inv(2,3)-to_inv(1,3)*to_inv(2,2))*invdet;
387  inverse(1,2) = -(to_inv(2,1)*to_inv(3,3)-to_inv(2,3)*to_inv(3,1))*invdet;
388  inverse(2,2) = (to_inv(1,1)*to_inv(3,3)-to_inv(1,3)*to_inv(3,1))*invdet;
389  inverse(3,2) = -(to_inv(1,1)*to_inv(2,3)-to_inv(2,1)*to_inv(1,3))*invdet;
390  inverse(1,3) = (to_inv(2,1)*to_inv(3,2)-to_inv(3,1)*to_inv(2,2))*invdet;
391  inverse(2,3) = -(to_inv(1,1)*to_inv(3,2)-to_inv(3,1)*to_inv(1,2))*invdet;
392  inverse(3,3) = (to_inv(1,1)*to_inv(2,2)-to_inv(2,1)*to_inv(1,2))*invdet;
393 }
394 
395 void omip::invert3x3MatrixEigen(const Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >& to_inv,
396  Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >& inverse)
397 {
398  double determinant = +to_inv(0,0)*(to_inv(1,1)*to_inv(2,2)-to_inv(2,1)*to_inv(1,2))
399  -to_inv(0,1)*(to_inv(1,0)*to_inv(2,2)-to_inv(1,2)*to_inv(2,0))
400  +to_inv(0,2)*(to_inv(1,0)*to_inv(2,1)-to_inv(1,1)*to_inv(2,0));
401  double invdet = 1.0/determinant;
402  inverse(0,0) = (to_inv(1,1)*to_inv(2,2)-to_inv(2,1)*to_inv(1,2))*invdet;
403  inverse(1,0) = -(to_inv(0,1)*to_inv(2,2)-to_inv(0,2)*to_inv(2,1))*invdet;
404  inverse(2,0) = (to_inv(0,1)*to_inv(1,2)-to_inv(0,2)*to_inv(1,1))*invdet;
405  inverse(0,1) = -(to_inv(1,0)*to_inv(2,2)-to_inv(1,2)*to_inv(2,0))*invdet;
406  inverse(1,1) = (to_inv(0,0)*to_inv(2,2)-to_inv(0,2)*to_inv(2,0))*invdet;
407  inverse(2,1) = -(to_inv(0,0)*to_inv(1,2)-to_inv(1,0)*to_inv(0,2))*invdet;
408  inverse(0,2) = (to_inv(1,0)*to_inv(2,1)-to_inv(2,0)*to_inv(1,1))*invdet;
409  inverse(1,2) = -(to_inv(0,0)*to_inv(2,1)-to_inv(2,0)*to_inv(0,1))*invdet;
410  inverse(2,2) = (to_inv(0,0)*to_inv(1,1)-to_inv(1,0)*to_inv(0,1))*invdet;
411 }
412 
413 void omip::invert3x3MatrixEigen2(const Eigen::Matrix3d& to_inv,
414  Eigen::Matrix3d& inverse)
415 {
416  double determinant = +to_inv(0,0)*(to_inv(1,1)*to_inv(2,2)-to_inv(2,1)*to_inv(1,2))
417  -to_inv(0,1)*(to_inv(1,0)*to_inv(2,2)-to_inv(1,2)*to_inv(2,0))
418  +to_inv(0,2)*(to_inv(1,0)*to_inv(2,1)-to_inv(1,1)*to_inv(2,0));
419  double invdet = 1.0/determinant;
420  inverse(0,0) = (to_inv(1,1)*to_inv(2,2)-to_inv(2,1)*to_inv(1,2))*invdet;
421  inverse(1,0) = -(to_inv(0,1)*to_inv(2,2)-to_inv(0,2)*to_inv(2,1))*invdet;
422  inverse(2,0) = (to_inv(0,1)*to_inv(1,2)-to_inv(0,2)*to_inv(1,1))*invdet;
423  inverse(0,1) = -(to_inv(1,0)*to_inv(2,2)-to_inv(1,2)*to_inv(2,0))*invdet;
424  inverse(1,1) = (to_inv(0,0)*to_inv(2,2)-to_inv(0,2)*to_inv(2,0))*invdet;
425  inverse(2,1) = -(to_inv(0,0)*to_inv(1,2)-to_inv(1,0)*to_inv(0,2))*invdet;
426  inverse(0,2) = (to_inv(1,0)*to_inv(2,1)-to_inv(2,0)*to_inv(1,1))*invdet;
427  inverse(1,2) = -(to_inv(0,0)*to_inv(2,1)-to_inv(2,0)*to_inv(0,1))*invdet;
428  inverse(2,2) = (to_inv(0,0)*to_inv(1,1)-to_inv(1,0)*to_inv(0,1))*invdet;
429 }
boost::tuple< double, double, double > Location
Definition: Feature.h:59
Feature::Location operator-(const Feature::Location &location1, const Feature::Location &location2)
Definition: OMIPUtils.cpp:188
void EigenAffine2TranslationAndEulerAngles(const Eigen::Affine3d &t, double &x, double &y, double &z, double &roll, double &pitch, double &yaw)
Definition: OMIPUtils.cpp:14
double L2Distance(const Feature::Location &first, const Feature::Location &second)
Definition: OMIPUtils.cpp:95
OMIP_ADD_POINT4D uint32_t label
Definition: OMIPTypeDefs.h:81
void TransformMatrix2Twist(const Eigen::Matrix4d &transformation_matrix, Eigen::Twistd &twist)
Definition: OMIPUtils.cpp:103
bool isFinite(const Eigen::Matrix4d &transformation)
Definition: OMIPUtils.cpp:222
Feature::Location operator+(const Feature::Location &location1, const Feature::Location &location2)
Definition: OMIPUtils.cpp:197
void Twist2TransformMatrix(const Eigen::Twistd &transformation_twist, Eigen::Matrix4d &matrix)
Definition: OMIPUtils.cpp:117
void TranslationAndEulerAngles2EigenAffine(const double &x, const double &y, const double &z, const double &roll, const double &pitch, const double &yaw, Eigen::Transform< double, 3, Eigen::Affine > &t)
Definition: OMIPUtils.cpp:27
double constrainAngle(double x)
Definition: OMIPUtils.cpp:271
TFSIMD_FORCE_INLINE Quaternion inverse(const Quaternion &q)
void ROSTwist2EigenTwist(const geometry_msgs::Twist &ros_twist, Eigen::Twistd &eigen_twist)
Definition: OMIPUtils.cpp:262
void LocationOfFeature2ColumnVectorHomogeneous(const Feature::Location &lof, MatrixWrapper::ColumnVector &col_vec)
Definition: OMIPUtils.cpp:172
void invert3x3MatrixEigen2(const Eigen::Matrix3d &to_inv, Eigen::Matrix3d &inverse)
Definition: OMIPUtils.cpp:413
double sampleNormal(double mean, double std_dev)
Definition: OMIPUtils.cpp:51
Eigen::Twistd unwrapTwist(Eigen::Twistd &current_twist, Eigen::Displacementd &current_displacement, Eigen::Twistd &previous_twist, bool &changed)
Definition: OMIPUtils.cpp:291
void TransformMatrix2TwistUnwrapped(const Eigen::Matrix4d &transformation_matrix, Eigen::Twistd &twist, const Eigen::Twistd &twist_previous)
Definition: OMIPUtils.cpp:111
void invert3x3Matrix(const MatrixWrapper::Matrix &to_inv, MatrixWrapper::Matrix &inverse)
Definition: OMIPUtils.cpp:378
double angleDiff(double a, double b)
Definition: OMIPUtils.cpp:281
void LocationOfFeature2ColumnVector(const Feature::Location &lof, MatrixWrapper::ColumnVector &col_vec)
Definition: OMIPUtils.cpp:165
void LocationOfFeature2EigenVectorHomogeneous(const Feature::Location &lof, Eigen::Vector4d &eig_vec)
Definition: OMIPUtils.cpp:180
pcl::PointXYZL FeaturePCL
Definition: OMIPTypeDefs.h:76
void LocationAndId2FeaturePCL(const Feature::Location &feature_location, const Feature::Id &feature_id, pcl::PointXYZL &feature_pcl)
Definition: OMIPUtils.cpp:246
double angleConv(double angle)
Definition: OMIPUtils.cpp:278
Definition: Feature.h:40
void GeometryMsgsTwist2EigenTwist(const geometry_msgs::Twist &gm_twist, Eigen::Twistd &eigen_twist)
Definition: OMIPUtils.cpp:206
void TransformLocation(const Feature::Location &origin, const Eigen::Matrix4d &transformation, Feature::Location &new_location)
Definition: OMIPUtils.cpp:123
void LocationAndId2FeaturePCLwc(const Feature::Location &feature_location, const Feature::Id &feature_id, omip::FeaturePCLwc &feature_pcl)
Definition: OMIPUtils.cpp:254
std::ostream & operator<<(std::ostream &os, std::vector< Feature::Id > vector_ids)
Definition: OMIPUtils.cpp:64
void invert3x3MatrixEigen(const Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > &to_inv, Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > &inverse)
Definition: OMIPUtils.cpp:395
#define ROS_ERROR_STREAM(args)
void Location2PointPCL(const Feature::Location &point_location, pcl::PointXYZ &point_pcl)
Definition: OMIPUtils.cpp:239
double unwrap(double previousAngle, double newAngle)
Definition: OMIPUtils.cpp:287
Eigen::Twistd invertTwist(Eigen::Twistd &current_twist, Eigen::Twistd &previous_twist, bool &inverted)
Definition: OMIPUtils.cpp:358
void EigenTwist2GeometryMsgsTwist(Eigen::Twistd &eigen_twist, geometry_msgs::Twist &gm_twist)
Definition: OMIPUtils.cpp:212


omip_common
Author(s): Roberto Martín-Martín
autogenerated on Mon Jun 10 2019 14:06:05