MCPcopy Create free account
hub / github.com/dartsim/dart / setGeometry

Function setGeometry

tutorials/tutorial_multi_pendulum/main.cpp:259–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257};
258
259void setGeometry(const BodyNodePtr& bn)
260{
261 // Create a BoxShape to be used for both visualization and collision checking
262 std::shared_ptr<BoxShape> box(new BoxShape(
263 Eigen::Vector3d(default_width, default_depth, default_height)));
264
265 // Create a shape node for visualization and collision checking
266 auto shapeNode
267 = bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(
268 box);
269 shapeNode->getVisualAspect()->setColor(dart::Color::Blue());
270
271 // Set the location of the shape node
272 Eigen::Isometry3d box_tf(Eigen::Isometry3d::Identity());
273 Eigen::Vector3d center = Eigen::Vector3d(0, 0, default_height / 2.0);
274 box_tf.translation() = center;
275 shapeNode->setRelativeTransform(box_tf);
276
277 // Move the center of mass to the center of the object
278 bn->setLocalCOM(center);
279}
280
281BodyNode* makeRootBody(const SkeletonPtr& pendulum, const std::string& name)
282{

Callers 2

makeRootBodyFunction · 0.70
addBodyFunction · 0.70

Calls 4

getVisualAspectMethod · 0.80
setColorMethod · 0.45
setRelativeTransformMethod · 0.45
setLocalCOMMethod · 0.45

Tested by

no test coverage detected