8 #ifndef yocs_math_toolkit_SOPHUS_HELPERS_HPP_ 9 #define yocs_math_toolkit_SOPHUS_HELPERS_HPP_ 19 #include <Eigen/Geometry> 22 #if defined(ECL_CXX11_FOUND) 25 #include <sophus/se3.hpp> 26 #include <sophus/se2.hpp> 27 #include <sophus/so2.hpp> 28 #include <sophus/so3.hpp> 43 #if defined(ECL_CXX11_FOUND) 44 typedef std::shared_ptr<SE3f> SE3fPtr;
47 Sophus::SE3fPtr points2DToSophusTransform(
float from_x,
float from_y,
float to_x,
float to_y);
55 std::ostream & operator << ( std::ostream & out, const SE3<T> & se3 )
59 const Eigen::Matrix<T,3,1> & t = se3.translation();
60 const Eigen::Quaternion<T> & q = se3.unit_quaternion();
61 out << t.transpose() <<
" " << q.x() <<
" " << q.y() <<
" " << q.z() <<
" " << q.w();
66 std::ostream & operator << ( std::ostream & out, const SE2<T> & se2 )
68 typename SE2<T>::Tangent tanget_vector = SE2<T>::log( se2 );
69 out << tanget_vector.transpose();
79 Eigen::Vector3f
toPose2D(
const Sophus::SE3f& pose);
86 Sophus::SE3f
toPose3D(
const Eigen::Vector3f& pose);
94 Eigen::Matrix3f R = ( Eigen::AngleAxis<float> (
static_cast<float> ( theta ), Eigen::Vector3f::UnitZ ()) ).matrix();
95 Eigen::Quaternionf q(R);
106 void convert(
float theta, Eigen::Quaternionf & q )
108 q.vec() << 0, 0, sin(theta*0.5
f);
109 q.w() = cos(theta*0.5f);
128 Sophus::SE3f
operator()(
const Eigen::Vector3f& pose);
137 Eigen::Vector3f
operator()(
const Sophus::SE3f& pose);
Eigen::Vector3f toPose2D(const Sophus::SE3f &pose)
Convert a full Sophus pose into a 2 dimensional pose.
void convert(float theta, Eigen::Quaternionf &q)
Eigen::Quaternionf operator()(float theta)
Sophus::SE3f toPose3D(const Eigen::Vector3f &pose)
Convert a 2 dimensional pose to a full Sophus pose in 3d.
PlanarRotation2Quaternion()