37 #include "LinearMath/btVector3.h"
70 double targetVelocity;
87 #if (0) // Acceleration limit removed 12/10/14
115 const double half_length = c.rod_length / 2;
117 s.
addNode(-c.rod_space, -half_length, 0);
118 s.
addNode(-c.rod_space, half_length, 0);
119 s.
addNode( c.rod_space, -half_length, 0);
120 s.
addNode( c.rod_space, half_length, 0);
121 s.
addNode(0, -c.rod_space, -half_length);
122 s.
addNode(0, -c.rod_space, half_length);
123 s.
addNode(0, c.rod_space, -half_length);
124 s.
addNode(0, c.rod_space, half_length);
125 s.
addNode(-half_length, 0, c.rod_space);
126 s.
addNode( half_length, 0, c.rod_space);
127 s.
addNode(-half_length, 0, -c.rod_space);
128 s.
addNode( half_length, 0, -c.rod_space);
181 const tgRod::Config rodConfig(c.radius, c.density, c.friction,
182 c.rollFriction, c.restitution);
186 c.maxTens, c.targetVelocity);
197 s.move(btVector3(0, 10, 0));
201 btVector3 rotationPoint = btVector3(0, 0, 0);
202 btVector3 rotationAxis = btVector3(0, 1, 0);
203 double rotationAngle = M_PI/2;
204 s.
addRotation(rotationPoint, rotationAxis, rotationAngle);
208 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
225 allMuscles = tgCast::filter<tgModel, tgBasicActuator> (
getDescendants());
239 throw std::invalid_argument(
"dt is not positive");
268 std::vector <tgRod*> rods = find<tgRod>(
"rod");
269 assert(!rods.empty());
271 btVector3 ballCenterOfMass(0, 0, 0);
272 double ballMass = 0.0;
273 for (std::size_t i = 0; i < rods.size(); i++) {
274 const tgRod*
const rod = rods[i];
276 const double rodMass = rod->
mass();
278 ballCenterOfMass += rodCenterOfMass * rodMass;
282 assert(ballMass > 0.0);
283 ballCenterOfMass /= ballMass;
286 std::vector<double> result(3);
287 for (
size_t i = 0; i < 3; ++i) { result[i] = ballCenterOfMass[i]; }
virtual void setup(tgWorld &world)
Definition of class tgRodInfo.
const std::vector< tgBasicActuator * > & getAllMuscles() const
virtual void step(double dt)
virtual void step(double dt)
Contains the definition of class Escape_T6Model. $Id$.
virtual btVector3 centerOfMass() const
Definition of class tgBasicActuatorInfo.
virtual void onVisit(const tgModelVisitor &r) const
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
void addRotation(const btVector3 &fixedPoint, const btVector3 &axis, double angle)
virtual ~Escape_T6Model()
Contains the definition of class tgBasicActuator.
std::vector< double > getBallCOM()
Definition of class tgStructure.
Definition of class tgStructureInfo.
virtual void onVisit(tgModelVisitor &r)
virtual double mass() const
Contains the definition of class tgRod.
Definition of class tgBuildSpec.
virtual void setup(tgWorld &world)
void notifyStep(double dt)
std::vector< tgModel * > getDescendants() const
void buildInto(tgModel &model, tgWorld &world)
void addNode(double x, double y, double z, std::string tags="")