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


C++ Joint::id方法代码示例

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


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

示例1: mergeInertia

sva::RBInertiad MultiBodyGraph::mergeInertia(const sva::RBInertiad& parentInertia,
	const sva::RBInertiad& childInertia, const Joint& joint,
	const sva::PTransformd& X_p_j,
	const std::map<int, std::vector<double>>& jointPosById)
{
	if(jointPosById.find(joint.id()) == jointPosById.end())
	{
		std::ostringstream msg;
		msg << "jointPosById  must contain joint id " <<
					 joint.id() << " configuration";
		throw std::out_of_range(msg.str());
	}

	if(int(jointPosById.at(joint.id()).size()) != joint.params())
	{
		std::ostringstream msg;
		msg << "joint id " << joint.id() << " need " << joint.params() <<
					 " parameters";
		throw std::domain_error(msg.str());
	}

	sva::PTransformd jointConfig = joint.pose(jointPosById.at(joint.id()));
	// transformation from current body to joint in next body
	sva::PTransformd X_cb_jnb = jointConfig*X_p_j;

	// set merged sub inertia in current body base and add it to the current inertia
	return parentInertia + X_cb_jnb.transMul(childInertia);
}
开发者ID:francois-keith,项目名称:RBDyn,代码行数:28,代码来源:MultiBodyGraph.cpp

示例2: addJoint

void MultiBodyGraph::addJoint(const Joint& J)
{
	if(J.id() < 0)
	{
		std::ostringstream msg;
		msg << "Joint id must be greater than zero";
		throw std::domain_error(msg.str());
	}

	// check that the joint id don't exist
	if(jointId2Joint_.find(J.id()) != jointId2Joint_.end())
	{
		std::ostringstream msg;
		msg << "Joint id: "  << J.id() << " already exist.";
		throw std::domain_error(msg.str());
	}

	// check that the joint name don't exist
	if(jointName2Id_.find(J.name()) != jointName2Id_.end())
	{
		std::ostringstream msg;
		msg << "Joint name: "  << J.name() << " already exist.";
		throw std::domain_error(msg.str());
	}

	joints_.push_back(std::make_shared<Joint>(J));
	jointId2Joint_[J.id()] = joints_.back();
	jointName2Id_[J.name()] = J.id();
}
开发者ID:francois-keith,项目名称:RBDyn,代码行数:29,代码来源:MultiBodyGraph.cpp


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