26 #include "FlemonsArm.h"
37 #include "LinearMath/btVector3.h"
57 double pretension_olecranon;
58 double pretension_anconeus;
59 double pretension_brachioradialis;
68 double pretension_support;
70 double targetVelocity;
109 const double scale = 0.5;
110 const double bone_scale = 0.3;
111 const size_t nNodes = 31;
135 const double ulna_w = 22 * scale;
136 const double ulna_l = 334 * scale * bone_scale;
137 const double humerus_l = 265 * scale * bone_scale;
140 const double humerus_head_r = 25 * scale;
141 const double g = 17 * scale;
142 const double x = ulna_w/2;
143 const double z = humerus_l/2;
145 nodePositions.push_back(btVector3(g, 0, 0));
146 nodePositions.push_back(btVector3(0, -g, 0));
147 nodePositions.push_back(btVector3(-ulna_w/2, 0, 0));
148 nodePositions.push_back(btVector3(0, 0, g));
149 nodePositions.push_back(btVector3(0, 0, -g));
150 nodePositions.push_back(btVector3(0, g, 0));
151 nodePositions.push_back(btVector3(0, humerus_l, 0));
152 nodePositions.push_back(btVector3(x, z, 0));
153 nodePositions.push_back(btVector3(ulna_l+ulna_w/2, -g, 0));
154 nodePositions.push_back(btVector3(0, humerus_l+2, humerus_head_r));
155 nodePositions.push_back(btVector3(0, humerus_l+2, -humerus_head_r));
157 nodePositions.push_back(btVector3(ulna_w/2, -2*g, 0));
159 nodePositions.push_back(btVector3(3*ulna_w/2, -g, 0));
160 nodePositions.push_back(btVector3(3*ulna_w/4, -g, g));
161 nodePositions.push_back(btVector3(3*ulna_w/4, -g, -g));
162 nodePositions.push_back(btVector3(humerus_head_r, humerus_l+2, 0));
163 nodePositions.push_back(btVector3(-humerus_head_r, humerus_l+2, 0));
168 nodePositions.push_back(btVector3(g/2,humerus_l-2,x/2));
169 nodePositions.push_back(btVector3(-g/2,humerus_l-2,x/2));
170 nodePositions.push_back(btVector3(-g/2,humerus_l-2,-x/2));
171 nodePositions.push_back(btVector3(g/2,humerus_l-2,-x/2));
174 nodePositions.push_back(btVector3(x/3,g+7.5,g/2));
175 nodePositions.push_back(btVector3(x/3,g+7.5,-g/2));
176 nodePositions.push_back(btVector3(x/3,g+5,g/2));
177 nodePositions.push_back(btVector3(x/3,g+5,-g/2));
180 nodePositions.push_back(btVector3(ulna_l/2 -1,g+6,-x/4));
181 nodePositions.push_back(btVector3(-ulna_l/12,g+6,-x/4));
182 nodePositions.push_back(btVector3(ulna_l/2 -1,g+6,x/4));
183 nodePositions.push_back(btVector3(-ulna_l/12,g+6,x/4));
186 nodePositions.push_back(btVector3(ulna_l/9,g+10,0));
187 nodePositions.push_back(btVector3(ulna_l/9,g+2,0));
192 for(
size_t i = 0; i < nNodes; i++){
193 s.
addNode(nodePositions[i][0], nodePositions[i][1], nodePositions[i][2]);
224 s.
addPair(5, 6,
"humerus massless");
239 s.
addPair(6, 17,
"anconeus muscle");
240 s.
addPair(6, 18,
"anconeus muscle");
241 s.
addPair(6, 19,
"anconeus muscle");
242 s.
addPair(6, 20,
"anconeus muscle");
243 s.
addPair(19, 18,
"anconeus muscle");
244 s.
addPair(20, 17,
"anconeus muscle");
246 s.
addPair(17, 21,
"anconeus muscle");
247 s.
addPair(20, 22,
"anconeus muscle");
248 s.
addPair(21, 23,
"anconeus muscle");
249 s.
addPair(22, 24,
"anconeus muscle");
251 s.
addPair(22, 26,
"olecranon muscle");
252 s.
addPair(24, 26,
"olecranon muscle");
253 s.
addPair(19, 26,
"olecranon muscle");
255 s.
addPair(21, 28,
"olecranon muscle");
256 s.
addPair(23, 28,
"olecranon muscle");
257 s.
addPair(18, 28,
"olecranon muscle");
259 s.
addPair(25, 27,
"anconeus muscle");
260 s.
addPair(26, 28,
"olecranon muscle");
261 s.
addPair(5, 23,
"olecranon muscle");
262 s.
addPair(5, 24,
"olecranon muscle");
263 s.
addPair(5, 26,
"olecranon muscle");
264 s.
addPair(5, 28,
"olecranon muscle");
267 s.
addPair(29, 21,
"olecranon muscle");
268 s.
addPair(29, 22,
"olecranon muscle");
269 s.
addPair(30, 23,
"olecranon muscle");
270 s.
addPair(30, 24,
"olecranon muscle");
300 const tgRod::Config rodConfig(c.radius, c.density, c.friction, c.rollFriction, c.restitution);
301 const tgRod::Config rodConfigMassless(c.radius, 0.0, c.friction, c.rollFriction, c.restitution);
305 tgBasicActuator::Config olecranonMuscleConfig(c.stiffness, c.damping, c.pretension_olecranon, c.history, c.maxTens, c.targetVelocity);
307 tgBasicActuator::Config anconeusMuscleConfig(c.stiffness, c.damping, c.pretension_anconeus, c.history, c.maxTens, c.targetVelocity);
309 tgBasicActuator::Config brachioradialisMuscleConfig(c.stiffness, c.damping, c.pretension_brachioradialis, c.history, c.maxTens, c.targetVelocity);
311 tgBasicActuator::Config supportstringMuscleConfig(c.stiffness, c.damping, c.pretension_support, c.history, c.maxTens, c.targetVelocity);
326 s.move(btVector3(0, 50.0, 0));
331 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
332 spec.addBuilder(
"massless",
new tgRodInfo(rodConfigMassless));
335 spec.addBuilder(
"brachiorodialis muscle",
new tgBasicActuatorInfo(brachioradialisMuscleConfig));
346 allMuscles = tgCast::filter<tgModel, tgBasicActuator> (
getDescendants());
360 throw std::invalid_argument(
"dt is not positive");
virtual void setup(tgWorld &world)
Definition of class tgRodInfo.
virtual void step(double dt)
virtual void setup(tgWorld &world)
virtual ~FlemonsArmModel()
virtual void step(double dt)
virtual void onVisit(tgModelVisitor &r)
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.
const std::vector< tgBasicActuator * > & getAllMuscles() const
Contains the definition of class tgRod.
Definition of class tgBuildSpec.
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="")