| 65 | } |
| 66 | |
| 67 | SkeletonPtr createBoxSkeleton( |
| 68 | const std::string& name, |
| 69 | const Eigen::Vector3d& size, |
| 70 | const Eigen::Vector3d& position, |
| 71 | double mass, |
| 72 | double inertia) |
| 73 | { |
| 74 | auto skeleton = Skeleton::create(name); |
| 75 | auto pair = skeleton->createJointAndBodyNodePair<FreeJoint>(); |
| 76 | auto* body = pair.second; |
| 77 | |
| 78 | body->setMass(mass); |
| 79 | body->setMomentOfInertia(inertia, inertia, inertia, 0.0, 0.0, 0.0); |
| 80 | |
| 81 | auto shape = std::make_shared<BoxShape>(size); |
| 82 | body->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>( |
| 83 | shape); |
| 84 | |
| 85 | Eigen::Vector6d positions = Eigen::Vector6d::Zero(); |
| 86 | positions.tail<3>() = position; |
| 87 | skeleton->setPositions(positions); |
| 88 | |
| 89 | return skeleton; |
| 90 | } |
| 91 | |
| 92 | } // namespace |
| 93 |
no test coverage detected