![]() |
Computational Embodied Neuroscience Simulator
1.1
3D simulation library
|
#include <cens_serialized_engine.h>
Public Types | |
typedef std::map< std::string, CENSHingeData > | Hinges |
typedef std::map< std::string, btTypedConstraint * > | GenericConstraints |
typedef std::map< std::string, btRigidBody * > | Bodies |
typedef std::map< std::string, btTransform > | Transforms |
![]() | |
typedef std::map< std::string, std::string * > | strvalues |
typedef strvalues::iterator | striter |
typedef std::map< std::string, Vector4f * > | v4values |
typedef v4values::iterator | v4iter |
typedef std::map< std::string, Vector3f * > | v3values |
typedef v3values::iterator | v3iter |
typedef std::map< std::string, double * > | dvalues |
typedef dvalues::iterator | diter |
typedef std::map< std::string, float * > | fvalues |
typedef fvalues::iterator | fiter |
typedef std::map< std::string, int * > | ivalues |
typedef ivalues::iterator | iiter |
typedef std::map< int, std::string > | labels |
typedef labels::iterator | liter |
Public Member Functions | |
CENSSerializedRobot (const std::string robotName, CENSEngine *en) | |
~CENSSerializedRobot () | |
void | addHinge (std::string hingeName, CENSHingeConstraint *_hinge) |
void | addGenericConstraint (std::string constraintName, btTypedConstraint *_constraint) |
void | addBody (std::string bodyName, btRigidBody *_body) |
void | addTransform (std::string transformName, btTransform _transform) |
bool | init () |
void | disableBodies () |
void | enableBodies () |
void | update () |
void | move (const std::string hingeName, double target_angle, double impulse=0) |
![]() | |
CENSParameterManager (std::string _filename, const char *sep="-------", const char *vsep=";", const char *filedir="parameters/") | |
CENSParameterManager (const CENSParameterManager ©) | |
void | addParameter (std::string parname, std::string &par) |
void | addParameter (std::string parname, Vector4f &par) |
void | addParameter (std::string parname, Vector3f &par) |
void | addParameter (std::string parname, double &par) |
void | addParameter (std::string parname, float &par) |
void | addParameter (std::string parname, int &par) |
bool | loadParameters () |
void | saveParameters () |
Public Attributes | |
std::string | robotName |
Hinges | hinges |
GenericConstraints | constraints |
Bodies | bodies |
Transforms | transforms |
CENSEngine * | engine |
Additional Inherited Members | |
![]() | |
std::string | filename |
const char * | separator |
const char * | vseparator |
strvalues | strparlist |
v4values | v4parlist |
v3values | v3parlist |
dvalues | dparlist |
fvalues | fparlist |
ivalues | iparlist |
labels | order |
int | added |
Data structure to import and maintain a group of serialized hinges
Definition at line 159 of file cens_serialized_engine.h.
typedef std::map<std::string, btRigidBody *> cens::CENSSerializedRobot::Bodies |
Definition at line 163 of file cens_serialized_engine.h.
typedef std::map<std::string, btTypedConstraint *> cens::CENSSerializedRobot::GenericConstraints |
Definition at line 162 of file cens_serialized_engine.h.
typedef std::map<std::string, CENSHingeData> cens::CENSSerializedRobot::Hinges |
Definition at line 161 of file cens_serialized_engine.h.
typedef std::map<std::string, btTransform> cens::CENSSerializedRobot::Transforms |
Definition at line 164 of file cens_serialized_engine.h.
|
inline |
robotName | the name of the gorup of hinges |
en | the engine that uses it |
Definition at line 190 of file cens_serialized_engine.h.
|
inline |
Definition at line 196 of file cens_serialized_engine.h.
void cens::CENSSerializedRobot::addBody | ( | std::string | bodyName, |
btRigidBody * | _body | ||
) |
Adds a body to the group
bodyName | the name of the body |
_body | pointer to the body |
Definition at line 89 of file cens_serialized_engine.cpp.
References bodies.
Referenced by cens::CENSSerializedEngine::loadBulletFile().
void cens::CENSSerializedRobot::addGenericConstraint | ( | std::string | constraintName, |
btTypedConstraint * | _constraint | ||
) |
Adds a non-hinge constraint to the group
constraintName | the name of the constraint |
_constraint | pointer to the constraint |
Definition at line 81 of file cens_serialized_engine.cpp.
References constraints.
Referenced by cens::CENSSerializedEngine::loadBulletFile().
void cens::CENSSerializedRobot::addHinge | ( | std::string | hingeName, |
CENSHingeConstraint * | _hinge | ||
) |
Adds an hinge to the group
hingeName | the name of the hinge |
_hinge | the hinge struct |
Definition at line 34 of file cens_serialized_engine.cpp.
References CENSParameterManager::addParameter(), and hinges.
Referenced by cens::CENSSerializedEngine::loadBulletFile().
void cens::CENSSerializedRobot::addTransform | ( | std::string | transformName, |
btTransform | _transform | ||
) |
Adds a transform to the group
transformName | the name of the body |
_transform | position and rotation of the body |
Definition at line 96 of file cens_serialized_engine.cpp.
References transforms.
Referenced by cens::CENSSerializedEngine::loadBulletFile().
void cens::CENSSerializedRobot::disableBodies | ( | ) |
Definition at line 141 of file cens_serialized_engine.cpp.
References bodies, hinges, move(), and transforms.
void cens::CENSSerializedRobot::enableBodies | ( | ) |
Definition at line 162 of file cens_serialized_engine.cpp.
References bodies, cens::eigen2btVec(), engine, and cens::CENSPhysics::getGravity().
bool cens::CENSSerializedRobot::init | ( | ) |
initialize hinges starting from data in each struct
Definition at line 104 of file cens_serialized_engine.cpp.
References cens::CENSHingeData::enable_collision, cens::CENSHingeData::enabled, engine, cens::CENSHingeData::hinge, hinges, CENSParameterManager::loadParameters(), cens::CENSHingeData::lower_limit, cens::CENSHingeData::max_motor_impulse, CENSParameterManager::saveParameters(), cens::CENSPhysics::setCollisionFilter(), and cens::CENSHingeData::upper_limit.
Referenced by cens::CENSSerializedEngine::loadBulletFile().
void cens::CENSSerializedRobot::move | ( | const std::string | hingeName, |
double | target_angle, | ||
double | impulse = 0 |
||
) |
Move a hinge by changing its status (target_angle, inpulse)
hingeName | the name of the hinge to move |
target_angle | the new angle to be reached |
impulse | the maximum impulse that can be acquired while changing angle. This changes hinge.max_motor_impulse in case of CENS_DEFAULT_CONTROL or hinge.kp in case of CENS_PD_CONTROL |
prop | the proportion between hinge.kp and hinge.kd (only for CENS_PD_CONTROL). |
Definition at line 221 of file cens_serialized_engine.cpp.
References cens::CENS_DEFAULT_CONTROL, cens::CENS_PD_CONTROL, and hinges.
Referenced by disableBodies().
void cens::CENSSerializedRobot::update | ( | ) |
update hinges' status
Definition at line 175 of file cens_serialized_engine.cpp.
References cens::CENS_DEFAULT_CONTROL, cens::CENS_PD_CONTROL, cens::CENSHingeData::current_angle, cens::CENSHingeData::dyn_kd, cens::CENSHingeData::enabled, engine, cens::CENSPhysics::getDynamicsWorld(), cens::CENSHingeData::hinge, hinges, cens::CENSHingeData::ki, cens::CENSHingeData::kp, cens::CENSHingeData::lower_limit, cens::CENSHingeData::max_motor_impulse, cens::CENSHingeData::motor_dt, cens::CENSHingeData::motor_type, cens::CENSHingeConstraint::setPDMotorTarget(), and cens::CENSHingeData::upper_limit.
Bodies cens::CENSSerializedRobot::bodies |
Map of hinges to their names
Definition at line 177 of file cens_serialized_engine.h.
Referenced by addBody(), disableBodies(), and enableBodies().
GenericConstraints cens::CENSSerializedRobot::constraints |
Map of non-hinge constraints to their names
Definition at line 174 of file cens_serialized_engine.h.
Referenced by addGenericConstraint().
CENSEngine* cens::CENSSerializedRobot::engine |
A pointer to the engine
Definition at line 183 of file cens_serialized_engine.h.
Referenced by enableBodies(), init(), and update().
Hinges cens::CENSSerializedRobot::hinges |
Map of hinges to their names
Definition at line 171 of file cens_serialized_engine.h.
Referenced by addHinge(), disableBodies(), init(), move(), and update().
std::string cens::CENSSerializedRobot::robotName |
Name of the group (corresponds to a file in the params directory)
Definition at line 168 of file cens_serialized_engine.h.
Transforms cens::CENSSerializedRobot::transforms |
Map of transforms to body names
Definition at line 180 of file cens_serialized_engine.h.
Referenced by addTransform(), and disableBodies().