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


C++ Link::_setParentJoint方法代码示例

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


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

示例1: _createRootLink

bool Robot::_createRootLink(const std::string& rootLinkName, Frame& referenceFrame)
{
    // TODO: Make Robot a KinObject so that we do not need referenceFrame here
    if(!verb.Assert(_links.size()==0, verbosity::ASSERT_CASUAL,
                "Cannot create a root link, because one already exists!"))
        return false;

    _pseudo_link = new Link(this, referenceFrame, "pseudo_link", INVALID_INDEX, false);
    _pseudo_link->_isDummy = true;
    _pseudo_link->_setParentJoint(_dummyJoint);

    Link* rootLink = new Link(this, *_pseudo_link, rootLinkName, 0, true);
    _insertLink(rootLink);
    _root = rootLink;
    _anchor = rootLink;

    _pseudo_joint = new Joint(this, BASE_INDEX, _pseudo_link, rootLink,
                              ProtectedJointProperties("base", Joint::FLOATING),
                              std::vector<DofProperties>());
    _jointNameToIndex[_pseudo_joint->name()] = BASE_INDEX;

    _pseudo_link->_addChildJoint(_pseudo_joint);
    rootLink->_setParentJoint(_pseudo_joint);

    dof(DOF_POS_X).name("DOF_POS_X");
    dof(DOF_POS_Y).name("DOF_POS_Y");
    dof(DOF_POS_Z).name("DOF_POS_Z");
    dof(DOF_ROT_X).name("DOF_ROT_X");
    dof(DOF_ROT_Y).name("DOF_ROT_Y");
    dof(DOF_ROT_Z).name("DOF_ROT_Z");
    
    return true;
}
开发者ID:ehuang3,项目名称:akin,代码行数:33,代码来源:Robot.cpp

示例2: createJointLinkPair

int Robot::createJointLinkPair(Link& parentLink, const string& newLinkName,
                               const ProtectedJointProperties& joint_properties,
                               const std::vector<DofProperties>& dof_properties)
{
    if(parentLink.isDummy())
    {
        verb.Assert(false, verbosity::ASSERT_CRITICAL,
                    "Error: You wanted to make '"+newLinkName+
                    "' a child of a dummy link in robot '"+name()+"'!");
        return -1;
    }
    
    if(!parentLink.belongsTo(*this))
    {
        verb.Assert(false, verbosity::ASSERT_CRITICAL,
                    "Error: You wanted to make '"+newLinkName+"' a child of '"+parentLink.name()+
                    "', but '"+parentLink.name()+"' does not belong to the robot '"+name()+"'!");
        return -2;
    }
    
    if(checkForLinkName(newLinkName))
    {
        verb.Assert(false, verbosity::ASSERT_CRITICAL,
                    "Error: You wanted to create a new link named '"+newLinkName+
                    "' but a link ("+to_string(link(newLinkName).id())+
                    ") by that name already exists in the robot named '"+name()+"'!");
        return -3;
    }
    
    if(checkForJointName(joint_properties._name))
    {
        verb.Assert(false, verbosity::ASSERT_CRITICAL,
                    "Error: You wanted to create a new joint named '"+joint_properties._name+
                    "' but a joint (#"+to_string(joint(joint_properties._name).id())
                    +") by that name already exists in the robot named '"+name()+"'!");
        return -4;
    }

    Link* newLink = new Link(this, parentLink, newLinkName, _links.size(), false);
    _insertLink(newLink);

    Joint* newJoint = new Joint(this, _joints.size(), &parentLink, newLink,
                                joint_properties, dof_properties);
    _insertJoint(newJoint);

    parentLink._addChildJoint(newJoint);
    newLink->_setParentJoint(newJoint);
    
    return _links.size()-1;
}
开发者ID:ehuang3,项目名称:akin,代码行数:50,代码来源:Robot.cpp


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