36 #include "LinearMath/btVector3.h"
68 double targetVelocity;
105 const double half_length = c.rod_length / 2;
107 s.
addNode(-c.rod_space, -half_length, 0);
108 s.
addNode(-c.rod_space, half_length, 0);
109 s.
addNode( c.rod_space, -half_length, 0);
110 s.
addNode( c.rod_space, half_length, 0);
111 s.
addNode(0, -c.rod_space, -half_length);
112 s.
addNode(0, -c.rod_space, half_length);
113 s.
addNode(0, c.rod_space, -half_length);
114 s.
addNode(0, c.rod_space, half_length);
115 s.
addNode(-half_length, 0, c.rod_space);
116 s.
addNode( half_length, 0, c.rod_space);
117 s.
addNode(-half_length, 0, -c.rod_space);
118 s.
addNode( half_length, 0, -c.rod_space);
171 const tgRod::Config rodConfig(c.radius, c.density, c.friction,
172 c.rollFriction, c.restitution);
176 c.maxTens, c.targetVelocity);
183 s.move(btVector3(0, 10, 0));
187 btVector3 rotationPoint = btVector3(0, 0, 0);
188 btVector3 rotationAxis = btVector3(0, 1, 0);
189 double rotationAngle = M_PI/2;
190 s.
addRotation(rotationPoint, rotationAxis, rotationAngle);
194 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
201 structureInfo.buildInto(*
this, world);
205 allActuators = tgCast::filter<tgModel, tgBasicActuator> (
getDescendants());
219 throw std::invalid_argument(
"dt is not positive");
virtual void setup(tgWorld &world)
Definition of class tgRodInfo.
virtual void step(double dt)
virtual void onVisit(tgModelVisitor &r)
Definition of class tgBasicActuatorInfo.
virtual void onVisit(const tgModelVisitor &r) const
virtual void setup(tgWorld &world)
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
Contains the definition of class tgBasicActuator.
virtual void step(double dt)
Definition of class tgStructure.
Definition of class tgStructureInfo.
Contains the definition of class tgRod.
Definition of class tgBuildSpec.
void notifyStep(double dt)
const std::vector< tgBasicActuator * > & getAllActuators() const
std::vector< tgModel * > getDescendants() const
void addNode(double x, double y, double z, std::string tags="")