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


C++ Pose3D::setAxisAngle方法代码示例

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


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

示例1: main

int main(void)
{

    Pose3D pz;
    pz.setAxisAngle(0,1,0, M_PI/3);
    pz.setPosition(0,2,0);

    Pose3D pz2;
    pz2.setAxisAngle(0,1,0, M_PI/2 - M_PI/3);
    pz2.setPosition(0,1,0);

    pz.multiplyPose(pz2);

    cout << pz;
    NEWMAT::Matrix m = pz.asMatrix();
    cout << m;

    Position p;
    p.x = 0;
    p.y = 0;
    p.z = 1;

    pz.applyToPosition(p);
    printf("After rotate: %f %f %f\n", p.x, p.y, p.z);

    cout << endl;

    for (int ind = 0; ind < 2; ind++)
    {
        bool caching;
        if (ind == 0) {
            caching = true;
            std::cout << "Caching Mode"<<std::endl;
        }
        else {
            caching = false;
            std::cout << std::endl<<std::endl<<std::endl<<"Not Caching Mode" <<std::endl;
        }



        double dx,dy,dz,dyaw,dp,dr;
        std::cout <<"Creating TransformReference" << std::endl;
        TransformReference mTR(caching);



        dx = dy= dz = 0;
        dyaw = dp = dr = 0.1;

        uint64_t atime;


        timeval temp_time_struct;
        gettimeofday(&temp_time_struct,NULL);
        atime =  temp_time_struct.tv_sec * 1000000000ULL + (uint64_t)temp_time_struct.tv_usec * 1000ULL;

        std::cout <<"Setting values" << std::endl;

        //Fill in some transforms
        //  mTR.setWithEulers(10,2,1,1,1,dyaw,dp,dr,atime); //Switching out for DH params below
        mTR.setWithDH("10","2",1.0,1.0,1.0,dyaw,atime);
        //mTR.setWithEulers("2","3",1-1,1,1,dyaw,dp,dr,atime-1000);
        mTR.setWithEulers("2","3",1,1,1,dyaw,dp,dr,atime-100);
        mTR.setWithEulers("2","3",1,1,1,dyaw,dp,dr,atime-50);
        mTR.setWithEulers("2","3",1,1,1,dyaw,dp,dr,atime-1000);
        mTR.setWithEulers("2","3",1,1,1,dyaw,dp,dr,atime+500);
        mTR.setWithEulers("2","3",1+100,1,1,dyaw,dp,dr,atime+1000);
        mTR.setWithEulers("2","3",1,1,1,dyaw,dp,dr,atime+1100);
        mTR.setWithEulers("3","5",dx,dy,dz,dyaw,dp,dr,atime);
        mTR.setWithEulers("5","1",dx,dy,dz,dyaw,dp,dr,atime);
        mTR.setWithEulers("6","5",dx,dy,dz,dyaw,dp,dr,atime);
        mTR.setWithEulers("6","5",dx,dy,dz,dyaw,dp,dr,atime);
        mTR.setWithEulers("7","6",1,1,1,dyaw,dp,dr,atime);
        mTR.setWithDH("8","7",1.0,1.0,1.0,dyaw,atime);
        //mTR.setWithEulers("8","7",1,1,1,dyaw,dp,dr,atime); //Switching out for DH params above

        std::cout <<"Trying some tests" << std::endl;
        //Demonstrate InvalidFrame LookupException
        try
        {
            std::cout<< mTR.viewChain("10","9");
        }
        catch (TransformReference::LookupException &ex)
        {
            std::cout << "Caught " << ex.what()<<std::endl;
        }




        // See the list of transforms to get between the frames
        std::cout<<"Viewing (10,8):"<<std::endl;
        std::cout << mTR.viewChain("10","8");


        //See the resultant transform
        std::cout <<"Calling getMatrix(10,8)"<<std::endl;
        //      NEWMAT::Matrix mat = mTR.getMatrix(1,1);
        NEWMAT::Matrix mat = mTR.getMatrix("10","8",atime);
//.........这里部分代码省略.........
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:101,代码来源:main.cpp


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