eigen_conversions.h
Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (c) 2010, Stephan Weiss, ASL, ETH Zurich, Switzerland
00004 You can contact the author at <stephan dot weiss at ieee dot org>
00005 
00006 All rights reserved.
00007 
00008 Redistribution and use in source and binary forms, with or without
00009 modification, are permitted provided that the following conditions are met:
00010 * Redistributions of source code must retain the above copyright
00011 notice, this list of conditions and the following disclaimer.
00012 * Redistributions in binary form must reproduce the above copyright
00013 notice, this list of conditions and the following disclaimer in the
00014 documentation and/or other materials provided with the distribution.
00015 * Neither the name of ETHZ-ASL nor the
00016 names of its contributors may be used to endorse or promote products
00017 derived from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022 DISCLAIMED. IN NO EVENT SHALL ETHZ-ASL BE LIABLE FOR ANY
00023 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00026 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 
00030 */
00031 
00032 #ifndef EIGEN_CONVERSIONS_H_
00033 #define EIGEN_CONVERSIONS_H_
00034 
00035 #include <Eigen/Dense>
00036 #include <Eigen/Geometry>
00037 
00038 #include <geometry_msgs/Quaternion.h>
00039 #include <geometry_msgs/Point.h>
00040 
00041 namespace eigen_conversions
00042 {
00043 
00045 template<class Scalar>
00046   inline void quaternionToMsg(const Eigen::Quaternion<Scalar> & q_in, geometry_msgs::Quaternion & q_out)
00047   {
00048     q_out.w = q_in.w();
00049     q_out.x = q_in.x();
00050     q_out.y = q_in.y();
00051     q_out.z = q_in.z();
00052   }
00053 
00055 template<class Scalar>
00056   inline geometry_msgs::Quaternion quaternionToMsg(const Eigen::Quaternion<Scalar> & q_in)
00057   {
00058     geometry_msgs::Quaternion q_out;
00059     quaternionToMsg(q_in, q_out);
00060     return q_out;
00061   }
00062 
00064 template<class Derived, class Point>
00065   inline void vector3dToPoint(const Eigen::MatrixBase<Derived> & vec, Point & point)
00066   {
00067     EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Derived, 3);
00068     point.x = vec[0];
00069     point.y = vec[1];
00070     point.z = vec[2];
00071   }
00072 
00074 template<class Derived, class Point>
00075   inline Point vector3dToPoint(const Eigen::MatrixBase<Derived> & vec)
00076   {
00077     Point point;
00078     vector3dToPoint(vec, point);
00079     return point;
00080   }
00081 
00082 }
00083 ;
00084 
00085 #endif /* EIGEN_CONVERSIONS_H_ */


ssf_core
Author(s): Stephan Weiss, Markus Achtelik
autogenerated on Fri Jan 3 2014 11:21:29