euler_quat.cpp
Go to the documentation of this file.
00001 /*
00002  * eigen_test.cpp
00003  *
00004  *  Created on: Oct 16, 2013
00005  *      Author: dnad
00006  */
00007 #include <labust/tools/conversions.hpp>
00008 #include <iostream>
00009 #include <sstream>
00010 
00011 int main(int argc, char* argv[])
00012 {
00013         using namespace Eigen;
00014 
00015         if (argc == 4)
00016         {
00017                 Eigen::Vector3d rpy;
00018                 for (int i=0; i<3; ++i)
00019                 {
00020                         std::istringstream in(argv[i+1]);
00021                         in >> rpy(i);
00022                         rpy(i) *= M_PI/180;
00023                 }
00024                 Quaternion<double> q;
00025                 labust::tools::quaternionFromEulerZYX(rpy(0),rpy(1), rpy(2),q);
00026                 std::cout<<"rpy:"<<rpy(0)<<" "<<rpy(1)<<" "<<rpy(2)<<std::endl;
00027                 std::cout<<"quat:"<<q.x()<<" "<<q.y()<<" "<<q.z()<<" "<<q.w()<<std::endl;
00028         }
00029         else if (argc == 5)
00030         {
00031                 double roll,pitch,yaw;
00032                 Eigen::Vector4d quat;
00033                 for (int i=0; i<4; ++i)
00034                 {
00035                         std::istringstream in(argv[i+1]);
00036                         in >> quat(i);
00037                 }
00038 
00039                 Quaternion<double> q(quat(3),quat(0),quat(1),quat(2));
00040                 labust::tools::eulerZYXFromQuaternion(q, roll,pitch,yaw);
00041                 std::cout<<"rpy:"<<roll<<" "<<pitch<<" "<<yaw<<std::endl;
00042                 std::cout<<"quat:"<<q.x()<<" "<<q.y()<<" "<<q.z()<<" "<<q.w()<<std::endl;
00043         }
00044 
00045         return 0;
00046 }
00047 
00048 
00049 
00050 
00051 


labust_navigation
Author(s): Gyula Nagy
autogenerated on Fri Aug 28 2015 11:23:33