axial_symmetric_pt.cpp
Go to the documentation of this file.
00001 #include "descartes_trajectory/axial_symmetric_pt.h"
00002 
00003 
00004 using descartes_trajectory::TolerancedFrame;
00005 using descartes_trajectory::AxialSymmetricPt;
00006 using namespace descartes_core::utils;
00007 
00008 static TolerancedFrame makeUnconstrainedRotation(double x, double y, double z, double rx, double ry, double rz,
00009                                           AxialSymmetricPt::FreeAxis axis)
00010 {
00011   using namespace descartes_trajectory;
00012 
00013   Eigen::Affine3d pose = toFrame(x, y, z, rx, ry, rz, EulerConventions::XYZ);
00014   PositionTolerance pos_tol = ToleranceBase::zeroTolerance<PositionTolerance>(x,y,z);
00015   OrientationTolerance orient_tol = ToleranceBase::createSymmetric<OrientationTolerance>(
00016       ((axis == AxialSymmetricPt::X_AXIS) ? 0.0 : rx),
00017       ((axis == AxialSymmetricPt::Y_AXIS) ? 0.0 : ry),
00018       ((axis == AxialSymmetricPt::Z_AXIS) ? 0.0 : rz),
00019       ((axis == AxialSymmetricPt::X_AXIS) ? 2*M_PI : 0.0),
00020       ((axis == AxialSymmetricPt::Y_AXIS) ? 2*M_PI : 0.0),
00021       ((axis == AxialSymmetricPt::Z_AXIS) ? 2*M_PI : 0.0));
00022   return TolerancedFrame(pose, pos_tol, orient_tol);
00023 }
00024 
00025 static TolerancedFrame makeUnconstrainedRotation(const Eigen::Affine3d& pose,
00026                                           AxialSymmetricPt::FreeAxis axis)
00027 {
00028   using namespace descartes_trajectory;
00029 
00030   Eigen::Vector3d rpy = pose.rotation().eulerAngles(0,1,2);
00031   double rx = rpy(0);
00032   double ry = rpy(1);
00033   double rz = rpy(2);
00034   double x = pose.translation()(0);
00035   double y = pose.translation()(1);
00036   double z = pose.translation()(2);
00037 
00038   PositionTolerance pos_tol = ToleranceBase::zeroTolerance<PositionTolerance>(x,y,z);
00039   OrientationTolerance orient_tol = ToleranceBase::createSymmetric<OrientationTolerance>(
00040       ((axis == AxialSymmetricPt::X_AXIS) ? 0.0 : rx),
00041       ((axis == AxialSymmetricPt::Y_AXIS) ? 0.0 : ry),
00042       ((axis == AxialSymmetricPt::Z_AXIS) ? 0.0 : rz),
00043       ((axis == AxialSymmetricPt::X_AXIS) ? 2*M_PI : 0.0),
00044       ((axis == AxialSymmetricPt::Y_AXIS) ? 2*M_PI : 0.0),
00045       ((axis == AxialSymmetricPt::Z_AXIS) ? 2*M_PI : 0.0));
00046   return TolerancedFrame(pose, pos_tol, orient_tol);
00047 }
00048 
00049 
00050 namespace descartes_trajectory
00051 {
00052 
00053 AxialSymmetricPt::AxialSymmetricPt(const descartes_core::TimingConstraint& timing)
00054   : CartTrajectoryPt(timing)
00055 {}
00056 
00057 AxialSymmetricPt::AxialSymmetricPt(double x, double y, double z, double rx, double ry, double rz,
00058                                    double orient_increment, FreeAxis axis,
00059                                    const descartes_core::TimingConstraint& timing) :
00060   CartTrajectoryPt(makeUnconstrainedRotation(x, y, z, rx, ry, rz, axis),
00061                    0.0, // The position discretization
00062                    orient_increment, // Orientation discretization (starting at -2Pi and marching to 2Pi)
00063                    timing)
00064 {
00065 }
00066 
00067 AxialSymmetricPt::AxialSymmetricPt(const Eigen::Affine3d& pose, double orient_increment, FreeAxis axis,
00068                                    const descartes_core::TimingConstraint& timing) :
00069   CartTrajectoryPt(makeUnconstrainedRotation(pose,axis),
00070                    0.0, // The position discretization
00071                    orient_increment, // Orientation discretization (starting at -2Pi and marching to 2Pi)
00072                    timing)
00073 {
00074 }
00075 
00076 } // end of namespace descartes_trajectory


descartes_trajectory
Author(s): Jorge Nicho
autogenerated on Wed Aug 26 2015 11:21:27