OMIPUtils.h
Go to the documentation of this file.
00001 /*
00002  * OMIPUtils.h
00003  *
00004  *      Author: roberto
00005  *
00006  * This is a modified implementation of the method for online estimation of kinematic structures described in our paper
00007  * "Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors"
00008  * (Martín-Martín and Brock, 2014).
00009  * This implementation can be used to reproduce the results of the paper and to be applied to new research.
00010  * The implementation allows also to be extended to perceive different information/models or to use additional sources of information.
00011  * A detail explanation of the method and the system can be found in our paper.
00012  *
00013  * If you are using this implementation in your research, please consider citing our work:
00014  *
00015 @inproceedings{martinmartin_ip_iros_2014,
00016 Title = {Online Interactive Perception of Articulated Objects with Multi-Level Recursive Estimation Based on Task-Specific Priors},
00017 Author = {Roberto {Mart\'in-Mart\'in} and Oliver Brock},
00018 Booktitle = {Proceedings of the IEEE/RSJ International Conference on Intelligent Robots and Systems},
00019 Pages = {2494-2501},
00020 Year = {2014},
00021 Location = {Chicago, Illinois, USA},
00022 Note = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00023 Url = {http://www.robotics.tu-berlin.de/fileadmin/fg170/Publikationen_pdf/martinmartin_ip_iros_2014.pdf},
00024 Projectname = {Interactive Perception}
00025 }
00026  * If you have questions or suggestions, contact us:
00027  * roberto.martinmartin@tu-berlin.de
00028  *
00029  * Enjoy!
00030  */
00031 
00032 #ifndef OMIP_UTILS_H_
00033 #define OMIP_UTILS_H_
00034 
00035 #include <pcl/point_types.h>
00036 #include <Eigen/Geometry>
00037 #include <lgsm/Lgsm>
00038 #include <boost/shared_ptr.hpp>
00039 
00040 #include "omip_common/Feature.h"
00041 
00042 #include <ros/ros.h>
00043 #include <tf/transform_broadcaster.h>
00044 
00045 #include "wrappers/matrix/matrix_wrapper.h"
00046 
00047 #include "omip_common/OMIPTypeDefs.h"
00048 
00049 namespace omip
00050 {
00051 
00062 void EigenAffine2TranslationAndEulerAngles(const Eigen::Affine3d& t, double& x,
00063                                   double& y, double& z, double& roll,
00064                                   double& pitch, double& yaw);
00065 
00076 void TranslationAndEulerAngles2EigenAffine(const double& x, const double& y, const double& z, const double& roll, const double& pitch,
00077                        const double& yaw,
00078                        Eigen::Transform<double, 3, Eigen::Affine> &t);
00079 
00086 double sampleNormal(double mean, double std_dev);
00087 
00094 std::ostream& operator <<(std::ostream& os,
00095                           std::vector<Feature::Id> vector_ids);
00096 
00103 std::ostream& operator <<(std::ostream& os, Feature::Location location);
00104 
00105 
00106 std::ostream& operator <<(std::ostream& os, Eigen::Twistd twistd);
00107 
00115 double L2Distance(const Feature::Location& first, const Feature::Location& second);
00116 
00126 void TransformMatrix2Twist(const Eigen::Matrix4d& transformation_matrix, Eigen::Twistd& twist);
00127 
00133 void TransformMatrix2TwistUnwrapped(const Eigen::Matrix4d& transformation_matrix, Eigen::Twistd& twist, const Eigen::Twistd& twist_previous);
00134 
00140 void Twist2TransformMatrix( const Eigen::Twistd& transformation_twist, Eigen::Matrix4d& matrix);
00141 
00148 void TransformLocation(const Feature::Location& origin, const Eigen::Matrix4d& transformation, Feature::Location& new_location);
00149 
00156 void TransformLocation(const Feature::Location& origin, const Eigen::Twistd& twist, Feature::Location &new_location, int feat_id=0);
00157 
00164 void TransformLocation(const Feature::Location& origin, const geometry_msgs::Twist& twist,Feature::Location& new_location);
00165 
00171 void LocationOfFeature2ColumnVector(const Feature::Location& lof, MatrixWrapper::ColumnVector& col_vec);
00172 
00178 void LocationOfFeature2ColumnVectorHomogeneous(const Feature::Location &lof, MatrixWrapper::ColumnVector &col_vec);
00179 
00180 void LocationOfFeature2EigenVectorHomogeneous(const Feature::Location& lof, Eigen::Vector4d& eig_vec);
00181 
00189 Feature::Location operator-(const Feature::Location& location1,
00190                             const Feature::Location& location2);
00191 
00192 Feature::Location operator+(const Feature::Location& location1,
00193                             const Feature::Location& location2);
00199 void GeometryMsgsTwist2EigenTwist(const geometry_msgs::Twist& gm_twist, Eigen::Twistd& eigen_twist);
00200 
00206 void EigenTwist2GeometryMsgsTwist(Eigen::Twistd& eigen_twist, geometry_msgs::Twist& gm_twist);
00207 
00213 bool isFinite(const Eigen::Matrix4d& transformation);
00214 
00215 void Location2PointPCL(const Feature::Location &point_location, pcl::PointXYZ& point_pcl);
00216 
00217 void LocationAndId2FeaturePCL(const Feature::Location &feature_location, const Feature::Id &feature_id, pcl::PointXYZL& feature_pcl);
00218 
00219 void LocationAndId2FeaturePCLwc(const Feature::Location &feature_location, const Feature::Id &feature_id, omip::FeaturePCLwc& feature_pcl);
00220 
00221 void ROSTwist2EigenTwist(const geometry_msgs::Twist& ros_twist, Eigen::Twistd &eigen_twist);
00222 
00223 Eigen::Twistd unwrapTwist(Eigen::Twistd& current_twist, Eigen::Displacementd& current_displacement, Eigen::Twistd& previous_twist, bool &changed);
00224 
00225 Eigen::Twistd invertTwist(Eigen::Twistd& current_twist, Eigen::Twistd& previous_twist, bool& inverted);
00226 
00227 void invert3x3Matrix(const MatrixWrapper::Matrix& to_inv, MatrixWrapper::Matrix& inverse);
00228 
00229 void invert3x3MatrixEigen(const Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >& to_inv,
00230                           Eigen::Map<Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> >& inverse);
00231 
00232 void invert3x3MatrixEigen2(const Eigen::Matrix3d& to_inv, Eigen::Matrix3d& inverse);
00233 
00234 typedef Eigen::Matrix<double, 6, 6> Matrix6d;
00235 
00242 void computeAdjoint(const Eigen::Twistd& pose_ec, Eigen::Matrix<double, 6, 6>& adjoint_out);
00243 
00250 void adjointXcovXadjointT(const Eigen::Twistd& pose_ec, const Eigen::Matrix<double, 6, 6>& cov, Eigen::Matrix<double, 6, 6>& transformed_cov_out);
00251 
00255 void computeAdjoint(const Eigen::Displacementd pose_disp, Eigen::Matrix<double, 6, 6> &adjoint_out);
00256 void adjointXcovXadjointT(const Eigen::Displacementd &pose_disp, const Eigen::Matrix<double, 6, 6>& cov, Eigen::Matrix<double, 6, 6>& transformed_cov_out);
00257 
00258 void adjointXinvAdjointXcovXinvAdjointTXadjointT(const Eigen::Displacementd& pose_disp1,
00259                                                        const Eigen::Displacementd& pose_disp2,
00260                                                        const Eigen::Matrix<double, 6, 6>& cov,
00261                                                        Eigen::Matrix<double, 6, 6>& transformed_cov_out);
00262 
00263 }
00264 
00265 #endif /* OMIP_UTILS_H_ */


omip_common
Author(s): Roberto Martín-Martín
autogenerated on Sat Jun 8 2019 18:26:37