本文整理汇总了C++中PrismaticJoint::setJointAxis方法的典型用法代码示例。如果您正苦于以下问题:C++ PrismaticJoint::setJointAxis方法的具体用法?C++ PrismaticJoint::setJointAxis怎么用?C++ PrismaticJoint::setJointAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrismaticJoint
的用法示例。
在下文中一共展示了PrismaticJoint::setJointAxis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hwriter
int
main(int argc, char *argv[])
{
real_type omega = 2;
SharedPtr<System> system = new System("Tire Testrig");
system->addSampleTime(real_type(1)/real_type(100));
system->setTimestepper(new DoPri5);
// set the moving ground
system->getEnvironment()->setGround(new MovingGround(Vector3(10, 0, 0)));
system->getEnvironment()->setGravity(new ZGravity());
// First build up the mechanical system
FixedRootJoint* fixedRootJoint = new FixedRootJoint("Fixed Root Joint");
system->addModel(fixedRootJoint);
fixedRootJoint->setRefPosition(Vector3(0, 0, 1));
PrismaticJoint* prismaticJoint = new PrismaticJoint("Normal Force joint");
prismaticJoint->setJointAxis(Vector3::unit(2));
system->addModel(prismaticJoint);
Summer* normalForceSum = new Summer("Normal Force Sum");
normalForceSum->setNumSummands(2);
normalForceSum->setInputSign(0, Summer::Minus);
system->addModel(normalForceSum);
Connection::connect(prismaticJoint->getInputPort(0),
normalForceSum->getOutputPort(0));
ConstModel* normalForce = new ConstModel("Normal force");
normalForce->setScalarValue(2000);
system->addModel(normalForce);
Connection::connect(normalForceSum->getInputPort(0),
normalForce->getOutputPort(0));
LinearSpringDamper* strutDamper = new LinearSpringDamper("Strut Damper");
strutDamper->setSpringConstant(0);
strutDamper->setDamperConstant(-30);
system->addModel(strutDamper);
Connection::connect(normalForceSum->getInputPort(1),
strutDamper->getOutputPort(0));
Connection::connect(strutDamper->getInputPort(0),
prismaticJoint->getOutputPort(0));
Connection::connect(strutDamper->getInputPort(1),
prismaticJoint->getOutputPort(1));
RigidBody* rootMount = new RigidBody("Root Mount");
system->addModel(rootMount);
rootMount->setInboardJoint(fixedRootJoint);
rootMount->addInteract(prismaticJoint);
RevoluteActuator* camberActuator = new RevoluteActuator("Camber Actuator");
system->addModel(camberActuator);
ConstModel* camberAngle = new ConstModel("Camber Angle");
camberAngle->setScalarValue(0);
system->addModel(camberAngle);
Connection::connect(camberActuator->getInputPort(0),
camberAngle->getOutputPort(0));
RigidBody* normalForceStrut = new RigidBody("Normal Force Strut");
system->addModel(normalForceStrut);
normalForceStrut->setInboardJoint(prismaticJoint);
normalForceStrut->addInteract(camberActuator);
RevoluteActuator* sideActuator = new RevoluteActuator("Sideslip Actuator");
system->addModel(sideActuator);
ConstModel* sideslipAngle = new ConstModel("Sideslip Angle");
sideslipAngle->setScalarValue(0);
system->addModel(sideslipAngle);
Connection::connect(sideActuator->getInputPort(0),
sideslipAngle->getOutputPort(0));
RigidBody* camberStrut = new RigidBody("Camber Strut");
system->addModel(camberStrut);
camberStrut->setInboardJoint(camberActuator);
camberStrut->addInteract(sideActuator);
RevoluteJoint* hubJoint = new RevoluteJoint("Hub Joint");
hubJoint->setJointAxis(Vector3(0, 1, 0));
system->addModel(hubJoint);
RigidBody* hubStrut = new RigidBody("Hub Strut");
system->addModel(hubStrut);
hubStrut->setInboardJoint(sideActuator);
hubStrut->addInteract(hubJoint);
RigidBody* rimAndTire = new RigidBody("Rim And Tire");
system->addModel(rimAndTire);
rimAndTire->setInboardJoint(hubJoint);
Mass* tireAndRimMass = new Mass("Rim And Tire Mass");
tireAndRimMass->setInertia(1, InertiaMatrix(1, 0, 0, 1, 0, 1));
system->addModel(tireAndRimMass);
rimAndTire->addInteract(tireAndRimMass);
//.........这里部分代码省略.........