BaseTest.cpp
Go to the documentation of this file.
00001 
00020 #include <robot_model_services/test_cases/BaseTest.h>
00021 
00022 using namespace robot_model_services;
00023 using namespace dynamic_reconfigure;
00024 
00025     BaseTest::BaseTest() {
00026         init( false);
00027     }
00028 
00029     BaseTest::BaseTest(bool silent) {
00030         init(silent);
00031     }
00032 
00033     BaseTest::~BaseTest() {}
00034 
00035     void BaseTest::init(bool silent) {
00036         this->mNodeHandle = boost::shared_ptr<ros::NodeHandle>(new ros::NodeHandle("~"));
00037 
00038         // publishers
00039         mInitPosePub = mNodeHandle->advertise<geometry_msgs::PoseWithCovarianceStamped>("/initialpose", 100, false);
00040 
00041         this->silent = silent;
00042     }
00043 
00044     robot_model_services::MILDRobotStatePtr BaseTest::getRobotState(const geometry_msgs::Pose &initialPose) {
00045         tf::Quaternion q(initialPose.orientation.x, initialPose.orientation.y, initialPose.orientation.z, initialPose.orientation.w);
00046         tf::Matrix3x3 m(q);
00047         double yaw, pitch, roll;
00048         m.getRPY(roll, pitch, yaw);
00049 
00050         robot_model_services::MILDRobotStatePtr statePtr(new robot_model_services::MILDRobotState(0, 0, yaw, initialPose.position.x, initialPose.position.y));
00051 
00052         return statePtr;
00053     }
00054 
00055     void BaseTest::waitForEnter() {
00056         if (silent) {
00057             return;
00058         }
00059         std::string dummy;
00060         std::cout << "Press ENTER to continue.." << std::endl << ">";
00061         std::getline(std::cin, dummy);
00062         std::cout << std::endl;
00063     }
00064 
00065    SimpleQuaternion BaseTest::euler2Quaternion( const Precision roll,
00066                   const Precision pitch,
00067                   const Precision yaw)
00068     {
00069 
00070         Eigen::AngleAxis<Precision> rollAngle(M_PI*roll/180.0,SimpleVector3::UnitX());
00071         Eigen::AngleAxis<Precision> pitchAngle(M_PI*pitch/180.0,SimpleVector3::UnitY());
00072         Eigen::AngleAxis<Precision> yawAngle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
00073 
00074         SimpleQuaternion q = rollAngle*pitchAngle*yawAngle;
00075         return q;
00076     }
00077 
00078    SimpleQuaternion BaseTest::ZXZ2Quaternion( const Precision roll,
00079                   const Precision pitch,
00080                   const Precision yaw)
00081     {
00082 
00083         Eigen::AngleAxis<Precision> Z1_Angle(M_PI*roll/180.0,SimpleVector3::UnitZ());
00084         Eigen::AngleAxis<Precision> X_Angle(M_PI*pitch/180.0,SimpleVector3::UnitX());
00085         Eigen::AngleAxis<Precision> Z2_Angle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
00086 
00087         SimpleQuaternion q = Z1_Angle*X_Angle*Z2_Angle;
00088         return q;
00089     }
00090 


asr_robot_model_services
Author(s): Aumann Florian, Borella Jocelyn, Heller Florian, Meißner Pascal, Schleicher Ralf, Stöckle Patrick, Stroh Daniel, Trautmann Jeremias, Walter Milena, Wittenbeck Valerij
autogenerated on Sat Jun 8 2019 18:24:52