BaseTest.cpp
Go to the documentation of this file.
1 
21 
22 using namespace robot_model_services;
23 using namespace dynamic_reconfigure;
24 
26  init( false);
27  }
28 
29  BaseTest::BaseTest(bool silent) {
30  init(silent);
31  }
32 
34 
35  void BaseTest::init(bool silent) {
36  this->mNodeHandle = boost::shared_ptr<ros::NodeHandle>(new ros::NodeHandle("~"));
37 
38  // publishers
39  mInitPosePub = mNodeHandle->advertise<geometry_msgs::PoseWithCovarianceStamped>("/initialpose", 100, false);
40 
41  this->silent = silent;
42  }
43 
44  robot_model_services::MILDRobotStatePtr BaseTest::getRobotState(const geometry_msgs::Pose &initialPose) {
45  tf::Quaternion q(initialPose.orientation.x, initialPose.orientation.y, initialPose.orientation.z, initialPose.orientation.w);
46  tf::Matrix3x3 m(q);
47  double yaw, pitch, roll;
48  m.getRPY(roll, pitch, yaw);
49 
50  robot_model_services::MILDRobotStatePtr statePtr(new robot_model_services::MILDRobotState(0, 0, yaw, initialPose.position.x, initialPose.position.y));
51 
52  return statePtr;
53  }
54 
56  if (silent) {
57  return;
58  }
59  std::string dummy;
60  std::cout << "Press ENTER to continue.." << std::endl << ">";
61  std::getline(std::cin, dummy);
62  std::cout << std::endl;
63  }
64 
66  const Precision pitch,
67  const Precision yaw)
68  {
69 
70  Eigen::AngleAxis<Precision> rollAngle(M_PI*roll/180.0,SimpleVector3::UnitX());
71  Eigen::AngleAxis<Precision> pitchAngle(M_PI*pitch/180.0,SimpleVector3::UnitY());
72  Eigen::AngleAxis<Precision> yawAngle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
73 
74  SimpleQuaternion q = rollAngle*pitchAngle*yawAngle;
75  return q;
76  }
77 
79  const Precision pitch,
80  const Precision yaw)
81  {
82 
83  Eigen::AngleAxis<Precision> Z1_Angle(M_PI*roll/180.0,SimpleVector3::UnitZ());
84  Eigen::AngleAxis<Precision> X_Angle(M_PI*pitch/180.0,SimpleVector3::UnitX());
85  Eigen::AngleAxis<Precision> Z2_Angle(M_PI*yaw/180.0,SimpleVector3::UnitZ());
86 
87  SimpleQuaternion q = Z1_Angle*X_Angle*Z2_Angle;
88  return q;
89  }
90 
SimpleQuaternion euler2Quaternion(const Precision roll, const Precision pitch, const Precision yaw)
Definition: BaseTest.cpp:65
robot_model_services::MILDRobotStatePtr getRobotState(const geometry_msgs::Pose &initialPose)
Definition: BaseTest.cpp:44
~BaseTest()
Definition: BaseTest.cpp:33
BaseTest()
Definition: BaseTest.cpp:25
void getRPY(tfScalar &roll, tfScalar &pitch, tfScalar &yaw, unsigned int solution_number=1) const
this namespace contains all generally usable classes.
Definition: DebugHelper.hpp:27
void init(bool silent)
Definition: BaseTest.cpp:35
SimpleQuaternion ZXZ2Quaternion(const Precision roll, const Precision pitch, const Precision yaw)
Definition: BaseTest.cpp:78
void waitForEnter()
Definition: BaseTest.cpp:55
Eigen::Quaternion< Precision > SimpleQuaternion
Definition: typedef.hpp:64


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 Mon Jun 10 2019 12:49:59