42 #include "LinearMath/btVector3.h"
51 FlemonsSpineModelLearning::FlemonsSpineModelLearning(
int segments) :
56 FlemonsSpineModelLearning::~FlemonsSpineModelLearning()
64 const double density = 4.2/300.0;
65 const double radius = 0.5;
66 const double friction = 0.5;
67 const double rollFriction = 0.0;
68 const double restitution = 0.0;
69 const tgRod::Config rodConfig(radius, density, friction, rollFriction, restitution);
71 const double elasticity = 1000.0;
72 const double damping = 10.0;
73 const double pretension = 0.0;
74 const bool history =
false;
75 const double maxTens = 7000.0;
76 const double maxSpeed = 12.0;
79 const double mRad = 1.0;
80 const double motorFriction = 10.0;
81 const double motorInertia = 1.0;
82 const bool backDrivable =
false;
84 mRad, motorFriction, motorInertia, backDrivable,
85 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();
159 spec.addBuilder(
"rod",
new tgRodInfo(rodConfig));
174 m_allMuscles = tgCast::filter<tgModel, tgSpringCableActuator> (
getDescendants());
176 m_allSegments = this->find<tgModel> (
"segment");
180 std::cout <<
"StructureInfo:" << std::endl;
181 std::cout << structureInfo << std::endl;
183 std::cout <<
"Model: " << std::endl;
184 std::cout << *
this << std::endl;
const std::vector< tgStructure * > & getChildren() const
virtual void setup(tgWorld &world)
void addChild(tgStructure *child)
Definition of class tgRodInfo.
Convenience function for combining strings with ints, mostly for naming structures.
Utility class for class casting and filtering collections by type.
Implementing the tetrahedral complex spine inspired by Tom Flemons.
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...
virtual void step(double dt)
std::string tgString(std::string s, int i)
Definition of class tgStructure.
Definition of class tgStructureInfo.
Definition of class tgKinematicActuatorInfo.
Rand seeding simular to the evolution and terrain classes.
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="")