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

Function setGeometry

tutorials/tutorial_multi_pendulum_finished/main.cpp:325–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323};
324
325void setGeometry(const BodyNodePtr& bn)
326{
327 // Create a BoxShape to be used for both visualization and collision checking
328 std::shared_ptr<BoxShape> box(new BoxShape(
329 Eigen::Vector3d(default_width, default_depth, default_height)));
330
331 // Create a shape node for visualization and collision checking
332 auto shapeNode
333 = bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(
334 box);
335 shapeNode->getVisualAspect()->setColor(dart::Color::Blue());
336
337 // Set the location of the shape node
338 Eigen::Isometry3d box_tf(Eigen::Isometry3d::Identity());
339 Eigen::Vector3d center = Eigen::Vector3d(0, 0, default_height / 2.0);
340 box_tf.translation() = center;
341 shapeNode->setRelativeTransform(box_tf);
342
343 // Move the center of mass to the center of the object
344 bn->setLocalCOM(center);
345}
346
347BodyNode* makeRootBody(const SkeletonPtr& pendulum, const std::string& name)
348{

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