当前位置: 首页>>代码示例>>C++>>正文


C++ Rotation::GetRPY方法代码示例

本文整理汇总了C++中Rotation::GetRPY方法的典型用法代码示例。如果您正苦于以下问题:C++ Rotation::GetRPY方法的具体用法?C++ Rotation::GetRPY怎么用?C++ Rotation::GetRPY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rotation的用法示例。


在下文中一共展示了Rotation::GetRPY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: w

void FramesTest::TestRotation2(const Vector& v,double a,double b,double c) {
	Vector   v2; 
	// Wrench
	Wrench   w(Vector(7,-1,3),Vector(2,-3,3));
	Twist    t(Vector(6,3,5),Vector(4,-2,7));
	// Rotation		
	Rotation R;
	Rotation R2;
	double ra;
	double rb;
	double rc;
    R = Rotation::RPY(a,b,c);

    CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitX()),1.0,epsilon);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitY(),R.UnitY()),1.0,epsilon);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitZ(),R.UnitZ()),1.0,epsilon);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitY()),0.0,epsilon);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitX(),R.UnitZ()),0.0,epsilon);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(R.UnitY(),R.UnitZ()),0.0,epsilon);
	R2=R;
	CPPUNIT_ASSERT_EQUAL(R,R2);
	CPPUNIT_ASSERT_DOUBLES_EQUAL((R*v).Norm(),v.Norm(),epsilon);
	CPPUNIT_ASSERT_EQUAL(R.Inverse(R*v),v);
	CPPUNIT_ASSERT_EQUAL(R.Inverse(R*t),t);
	CPPUNIT_ASSERT_EQUAL(R.Inverse(R*w),w);
	CPPUNIT_ASSERT_EQUAL(R*R.Inverse(v),v);
	CPPUNIT_ASSERT_EQUAL(R*Rotation::Identity(),R);
	CPPUNIT_ASSERT_EQUAL(Rotation::Identity()*R,R);
	CPPUNIT_ASSERT_EQUAL(R*(R*(R*v)),(R*R*R)*v);
	CPPUNIT_ASSERT_EQUAL(R*(R*(R*t)),(R*R*R)*t);
	CPPUNIT_ASSERT_EQUAL(R*(R*(R*w)),(R*R*R)*w);
	CPPUNIT_ASSERT_EQUAL(R*R.Inverse(),Rotation::Identity());
	CPPUNIT_ASSERT_EQUAL(R.Inverse()*R,Rotation::Identity());
	CPPUNIT_ASSERT_EQUAL(R.Inverse()*v,R.Inverse(v));
	R.GetRPY(ra,rb,rc);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
	R = Rotation::EulerZYX(a,b,c);
	R.GetEulerZYX(ra,rb,rc);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
	R = Rotation::EulerZYZ(a,b,c);
	R.GetEulerZYZ(ra,rb,rc);
	CPPUNIT_ASSERT_DOUBLES_EQUAL(ra,a,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rb,b,epsilon);
    CPPUNIT_ASSERT_DOUBLES_EQUAL(rc,c,epsilon);
	double angle= R.GetRotAngle(v2);
	R2=Rotation::Rot2(v2,angle);
	CPPUNIT_ASSERT_EQUAL(R2,R);
	R2=Rotation::Rot(v2*1E20,angle);
	CPPUNIT_ASSERT_EQUAL(R,R2);
	v2=Vector(6,2,4);
	CPPUNIT_ASSERT_DOUBLES_EQUAL((v2).Norm(),::sqrt(dot(v2,v2)),epsilon);
}
开发者ID:shakhimardanov,项目名称:orocos_kdl_diamondback,代码行数:56,代码来源:framestest.cpp

示例2: RPY_angles

void ChainTask::RPY_angles(Rotation rot)
{
  rot.GetRPY(chi_f_spatula(0),chi_f_spatula(1),chi_f_spatula(2));
  
  geometry_msgs::PoseStamped pp;

  Frame ff = Frame(Rotation::RPY(desired_values[3],desired_values[4],desired_values[5]));

  // stupid hack for rviz (running locally, wtf?!)
  pp.header.stamp = ros::Time::now() - ros::Duration(0.1);
  pp.header.frame_id = "/spatula";
  tf::PoseKDLToMsg(ff, pp.pose);
  ros_desired_pose_port.write(pp);

  // compute Jacobian matrix

  //reference frame is spatula, reference point is end of spatula chain
  jacsolver_spatula->JntToJac(chi_f_spatula_init, Jf_spatula);
}
开发者ID:airballking,项目名称:feature_constraints_controller,代码行数:19,代码来源:ChainTask.cpp

示例3: cyl_irpy_chain

KDL::JntArray cyl_irpy_chain(const KDL::Frame& frame)
{
  static KDL::ChainFkSolverPos_recursive* fksolver_baker=0;

  if(fksolver_baker == 0)
  {
    KDL::Chain chain_baker;

    chain_baker.addSegment(Segment(Joint(Joint::RotZ)));
    chain_baker.addSegment(Segment(Joint(Joint::TransX)));
    chain_baker.addSegment(Segment(Joint(Joint::TransZ),
                    Frame(Rotation::RotX(M_PI/2)*Rotation::RotY(-M_PI/2))));

    fksolver_baker = new ChainFkSolverPos_recursive(chain_baker);
  }

  JntArray chi_f(6);

  Vector p = frame.p;

  //printf("atan2: %f\n", atan2(p.y(),p.x()));

  chi_f(0)=atan2(p.y(),p.x());
  chi_f(1)=sqrt(p.x()*p.x()+p.y()*p.y());
  chi_f(2)=p.z();

  //printf("chi_f(0): %f\n", chi_f(0));

  Frame baker_pose;
  JntArray chi_f_baker(3);
  chi_f_baker(0) = chi_f(0);
  chi_f_baker(1) = chi_f(1);
  chi_f_baker(2) = chi_f(2);
  fksolver_baker->JntToCart(chi_f_baker, baker_pose);

  // rotations
  Rotation rot = (baker_pose.Inverse()*frame).M.Inverse();
  rot.GetRPY(chi_f(3),chi_f(4),chi_f(5));

  return chi_f;
}
开发者ID:airballking,项目名称:feature_constraints_controller,代码行数:41,代码来源:ChainRPY.cpp

示例4: operator

 double operator()(const Rotation& rot ) const
 {
     double r,p,y;
     rot.GetRPY(r,p,y);
     return y;
 }
开发者ID:snrkiwi,项目名称:rtt_geometry,代码行数:6,代码来源:kdlTypekitConstructors.cpp


注:本文中的Rotation::GetRPY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。