44 #include "LinearMath/btVector3.h"
51 FlemonsSpineModelMixed::FlemonsSpineModelMixed(
int segments) :
56 FlemonsSpineModelMixed::~FlemonsSpineModelMixed()
68 const double density = 4.2/300.0;
69 const double radius = 0.5;
70 const double friction = 0.5;
71 const double rollFriction = 0.0;
72 const double restitution = 0.0;
73 const tgRod::Config rodConfig(radius, density, friction, rollFriction, restitution);
75 const double elasticity = 1000.0;
76 const double damping = 10.0;
77 const double pretension = 0.0;
78 const bool history =
true;
79 const double maxTens = 7000.0;
80 const double maxSpeed = 12.0;
82 const double mRad = 1.0;
83 const double motorFriction = 10.0;
84 const double motorInertia = 1.0;
85 const bool backDrivable =
false;
87 mRad, motorFriction, motorInertia, backDrivable,
88 history, maxTens, maxSpeed);
97 tetra.
addNode( v_size, v_size, v_size);
98 tetra.
addNode( v_size, -v_size, -v_size);
99 tetra.
addNode(-v_size, v_size, -v_size);
100 tetra.
addNode(-v_size, -v_size, v_size);
102 tetra.
addPair(0, 1,
"front rod");
103 tetra.
addPair(0, 2,
"right rod");
104 tetra.
addPair(0, 3,
"back rod");
105 tetra.
addPair(0, 4,
"left rod");
109 tetra.move(btVector3(0.0,15.0,100.0));
115 btVector3 offset(0.0, 0.0, -v_size * 1.15);
116 for (std::size_t i = 0; i < m_segments; i++)
122 p->addTags(
tgString(
"segment num", i + 1));
123 p->move((i + 1.0) * offset);
131 std::vector<tgStructure*> children = snake.
getChildren();
132 for (std::size_t i = 1; i < children.size(); i++)
134 tgNodes n0 = children[i - 1]->getNodes();
135 tgNodes n1 = children[i]->getNodes();
158 else if(i == children.size() - 1)
203 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
218 m_allMuscles = tgCast::filter<tgModel, tgSpringCableActuator> (
getDescendants());
220 m_allSegments = this->find<tgModel> (
"segment");
224 std::cout <<
"StructureInfo:" << std::endl;
225 std::cout << structureInfo << std::endl;
227 std::cout <<
"Model: " << std::endl;
228 std::cout << *
this << std::endl;
const std::vector< tgStructure * > & getChildren() const
void addChild(tgStructure *child)
Definition of class tgRodInfo.
virtual void step(double dt)
Convenience function for combining strings with ints, mostly for naming structures.
Utility class for class casting and filtering collections by type.
virtual void setup(tgWorld &world)
Definition of class tgBasicActuatorInfo.
void addPair(int fromNodeIdx, int toNodeIdx, std::string tags="")
Contains the definition of abstract base class tgSpringCableActuator. Assumes that the string is line...
std::string tgString(std::string s, int i)
Implementing the tetrahedral complex spine inspired by Tom Flemons.
Definition of class tgStructure.
Definition of class tgStructureInfo.
Definition of class tgKinematicActuatorInfo.
Rand seeding simular to the evolution and terrain classes.
virtual void setup(tgWorld &world)
Definition of class tgBuildSpec.
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="")