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


C++ Model3D::setTransform方法代码示例

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


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

示例1: updateGripper

void OldGripper::updateGripper(
                               rw::models::WorkCell::Ptr wc,
                               rwsim::dynamics::DynamicWorkCell::Ptr dwc,
                               rw::models::Device::Ptr dev,
                               rwsim::dynamics::RigidDevice::Ptr ddev,
                               rw::kinematics::State& state,
                               MovableFrame::Ptr tcpFrame
                               ) {

    Geometry::Ptr baseGeometry = getBaseGeometry();
    Geometry::Ptr leftGeometry = getFingerGeometry();
    Geometry::Ptr rightGeometry = getFingerGeometry();

    // remove existing objects
    DEBUG << "- Removing objects..." << endl;
    //wc->removeObject(wc->findObject("gripper.Base").get());
    wc->removeObject(wc->findObject("gripper.LeftFinger").get());
    wc->removeObject(wc->findObject("gripper.RightFinger").get());
    DEBUG << "- Objects removed." << endl;

    // create and add new objects
    DEBUG << "- Adding new objects..." << endl;

    // if base is parametrized, the box has to be moved from origin by half its height
    /*Transform3D<> baseT;
    baseT = Transform3D<>(-0.5 * _basez * Vector3D<>::z());

    RigidObject* baseobj = new RigidObject(wc->findFrame("gripper.Base"));
    Model3D* basemodel = new Model3D("BaseModel");
    basemodel->addTriMesh(Model3D::Material("stlmat", 0.4f, 0.4f, 0.4f), *baseGeometry->getGeometryData()->getTriMesh());
    basemodel->setTransform(baseT);
    baseGeometry->setTransform(baseT);
    baseobj->addModel(basemodel);
    baseobj->addGeometry(baseGeometry);
    wc->add(baseobj);
    dwc->findBody("gripper.Base")->setObject(baseobj);*/

    RigidObject* leftobj = new RigidObject(wc->findFrame("gripper.LeftFinger"));
    Model3D* leftmodel = new Model3D("LeftModel");
    leftmodel->addTriMesh(Model3D::Material("stlmat", 0.4f, 0.4f, 0.4f), *leftGeometry->getGeometryData()->getTriMesh());
    leftmodel->setTransform(Transform3D<>());
    leftGeometry->setTransform(Transform3D<>());
    leftobj->addModel(leftmodel);
    leftobj->addGeometry(leftGeometry);
    wc->add(leftobj);
    dwc->findBody("gripper.LeftFinger")->setObject(leftobj);

    RigidObject* rightobj = new RigidObject(wc->findFrame("gripper.RightFinger"));
    Model3D* rightmodel = new Model3D("RightModel");
    rightmodel->addTriMesh(Model3D::Material("stlmat", 0.4f, 0.4f, 0.4f), *rightGeometry->getGeometryData()->getTriMesh());
    rightmodel->setTransform(Transform3D<>(Vector3D<>(), Rotation3D<>(1, 0, 0, 0, 1, 0, 0, 0, -1)));
    rightGeometry->setTransform(Transform3D<>(Vector3D<>(), Rotation3D<>(1, 0, 0, 0, 1, 0, 0, 0, -1)));
    rightobj->addModel(rightmodel);
    rightobj->addGeometry(rightGeometry);
    wc->add(rightobj);
    dwc->findBody("gripper.RightFinger")->setObject(rightobj);
    DEBUG << "Objects added." << endl;

    // set tcp
    tcpFrame->setTransform(Transform3D<>(Vector3D<>(0, 0, _length - _tcpoffset)), state);

    // set bounds
    double minOpening = 0.5 * _jawdist;

    dev->setBounds(make_pair(Q(1, minOpening), Q(1, minOpening + 0.5 * _stroke)));
    dev->setQ(Q(1, minOpening), state);

    // set force
    ddev->setMotorForceLimits(Q(2, _force, _force));

    DEBUG << "Gripper updated!" << endl;
}
开发者ID:dagothar,项目名称:gripperz,代码行数:72,代码来源:OldGripper.cpp


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