38 #include "LinearMath/btVector3.h"
49 const struct ConfigRod {
67 const struct ConfigCable {
71 double pretension_olecranon;
72 double pretension_anconeus;
73 double pretension_brachioradialis;
74 double pretension_support;
77 double targetVelocity;
105 const double scale = 0.5;
106 const double bone_scale = 0.3;
107 const size_t nNodes = 15 + 2;
111 const double a = 22 * scale;
112 const double b = 334 * scale * bone_scale;
113 const double c = 265 * scale * bone_scale;
116 const double f = 25 * scale;
117 const double g = 17 * scale;
118 const double x = a/2;
119 const double z = c/2;
122 nodePositions.push_back(btVector3(g, 0, 0));
123 nodePositions.push_back(btVector3(0, -g, 0));
124 nodePositions.push_back(btVector3(-a/2, 0, 0));
125 nodePositions.push_back(btVector3(0, 0, g));
126 nodePositions.push_back(btVector3(0, 0, -g));
127 nodePositions.push_back(btVector3(0, g, 0));
128 nodePositions.push_back(btVector3(0, c, 0));
129 nodePositions.push_back(btVector3(x, z, 0));
130 nodePositions.push_back(btVector3(b+a/2, -g, 0));
131 nodePositions.push_back(btVector3(0, c+2, f));
132 nodePositions.push_back(btVector3(0, c+2, -f));
135 nodePositions.push_back(btVector3(a/2, -2*g, 0));
138 nodePositions.push_back(btVector3(3*a/2, -g, 0));
139 nodePositions.push_back(btVector3(3*a/4, -g, g));
140 nodePositions.push_back(btVector3(3*a/4, -g, -g));
142 nodePositions.push_back(btVector3(f, c+2, 0));
143 nodePositions.push_back(btVector3(-f, c+2, 0));
145 for(
size_t i=0;i<nNodes;i++) {
146 s.
addNode(nodePositions[i][0],nodePositions[i][1],nodePositions[i][2]);
162 s.
addPair(3, 5,
"humerus massless");
163 s.
addPair(4, 5,
"humerus massless");
164 s.
addPair(5, 6,
"humerus massless");
168 const std::vector<tgStructure*> children = s.
getChildren();
170 s.
addPair(0, 3,
"olecranon muscle");
171 s.
addPair(0, 4,
"olecranon muscle");
172 s.
addPair(1, 3,
"olecranon muscle");
173 s.
addPair(1, 4,
"olecranon muscle");
174 s.
addPair(2, 3,
"olecranon muscle");
175 s.
addPair(2, 4,
"olecranon muscle");
177 s.
addPair(0, 13,
"olecranon muscle");
178 s.
addPair(1, 13,
"olecranon muscle");
179 s.
addPair(11, 13,
"olecranon muscle");
180 s.
addPair(0, 14,
"olecranon muscle");
181 s.
addPair(1, 14,
"olecranon muscle");
182 s.
addPair(11, 14,
"olecranon muscle");
184 s.
addPair(0, 12,
"olecranon muscle");
185 s.
addPair(11, 12,
"olecranon muscle");
186 s.
addPair(0, 5,
"brachioradialis muscle");
187 s.
addPair(2, 5,
"olecranon muscle");
188 s.
addPair(3, 13,
"right anconeus muscle");
189 s.
addPair(4, 14,
"left anconeus muscle");
208 const tgRod::Config rodConfig(cRod.radius, cRod.density, cRod.friction, cRod.rollFriction, cRod.restitution);
209 const tgRod::Config rodConfigMassless(cRod.radius, 0.00, cRod.friction, cRod.rollFriction, cRod.restitution);
213 cCable.history, cCable.maxTens, cCable.targetVelocity);
215 cCable.history, cCable.maxTens, cCable.targetVelocity);
216 tgBasicActuator::Config brachioradialisMuscleConfig(cCable.stiffness, cCable.damping, cCable.pretension_brachioradialis,
217 cCable.history, cCable.maxTens, cCable.targetVelocity);
219 cCable.history, cCable.maxTens, cCable.targetVelocity);
228 btVector3 offset(0.0, 50.0, 0.0);
233 spec.addBuilder(
"massless",
new tgRodInfo(rodConfigMassless));
234 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
237 spec.addBuilder(
"brachioradialis muscle",
new tgBasicActuatorInfo(brachioradialisMuscleConfig));
248 allMuscles = tgCast::filter<tgModel, tgBasicActuator> (
getDescendants());
265 throw std::invalid_argument(
"dt is not positive");
virtual void onVisit(tgModelVisitor &r)
virtual void setup(tgWorld &world)
const std::vector< tgStructure * > & getChildren() const
virtual void setup(tgWorld &world)
Definition of class tgRodInfo.
virtual void step(double dt)
Markers for specific places on a tensegrity.
Definition of class tgBasicActuatorInfo.
virtual void onVisit(const tgModelVisitor &r) const
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
Contains the definition of class tgBasicActuator.
Definition of class tgStructure.
Definition of class tgStructureInfo.
Contains the definition of class ScarrArmModel. $Id$.
const std::vector< tgBasicActuator * > & getAllMuscles() const
Contains the definition of class tgRod.
Definition of class tgBuildSpec.
void notifyStep(double dt)
virtual void step(double dt)
std::vector< tgModel * > getDescendants() const
void buildInto(tgModel &model, tgWorld &world)
void addNode(double x, double y, double z, std::string tags="")