36 #include "LinearMath/btVector3.h"
73 double targetVelocity;
110 const double half_length = c.rod_length / 2;
112 s.
addNode(-c.rod_space, -half_length, 0);
113 s.
addNode(-c.rod_space, half_length, 0);
114 s.
addNode( c.rod_space, -half_length, 0);
115 s.
addNode( c.rod_space, half_length, 0);
116 s.
addNode(0, -c.rod_space, -half_length);
117 s.
addNode(0, -c.rod_space, half_length);
118 s.
addNode(0, c.rod_space, -half_length);
119 s.
addNode(0, c.rod_space, half_length);
120 s.
addNode(-half_length, 0, c.rod_space);
121 s.
addNode( half_length, 0, c.rod_space);
122 s.
addNode(-half_length, 0, -c.rod_space);
123 s.
addNode( half_length, 0, -c.rod_space);
178 const tgRod::Config rodConfig(c.radius, c.density, c.friction,
179 c.rollFriction, c.restitution);
185 c.hist, c.maxTens, c.targetVelocity);
188 c.hist, c.maxTens, c.targetVelocity);
195 s.move(btVector3(0, 10, 0));
199 btVector3 rotationPoint = btVector3(0, 0, 0);
200 btVector3 rotationAxis = btVector3(0, 1, 0);
201 double rotationAngle = M_PI/2;
202 s.
addRotation(rotationPoint, rotationAxis, rotationAngle);
206 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
214 structureInfo.buildInto(*
this, world);
219 allMuscles = tgCast::filter<tgModel, tgBasicActuator> (
getDescendants());
221 passiveMuscles = tgCast::find<tgModel, tgBasicActuator>(
tgTagSearch(
"cableA"),
223 activeMuscles = tgCast::find<tgModel, tgBasicActuator>(
tgTagSearch(
"cableB"),
238 throw std::invalid_argument(
"dt is not positive");
260 return passiveMuscles;
265 return activeMuscles;
270 return (c.stiffnessA/c.stiffnessB);
virtual void setup(tgWorld &world)
Definition of class tgRodInfo.
virtual void step(double dt)
virtual void onVisit(tgModelVisitor &r)
const std::vector< tgBasicActuator * > & getAllMuscles() const
const std::vector< tgBasicActuator * > & getPassiveMuscles() const
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.
const std::vector< tgBasicActuator * > & getActiveMuscles() const
virtual const double muscleRatio()
Contains the definition of class tgRod.
Definition of class tgBuildSpec.
void notifyStep(double dt)
std::vector< tgModel * > getDescendants() const
void addNode(double x, double y, double z, std::string tags="")