#include <CscEnvironmentSimulator.h>
Public Member Functions | |
| CscEnvironmentSimulator (bool autoIncrement) | |
| virtual | ~CscEnvironmentSimulator () |
| void | clear () |
| virtual vector< CscWorldObject * > | getObjects (const function< bool(const CscWorldObject *)> filter=[](const CscWorldObject *) { return true;}) const |
| CscWorldElement * | getElementByName (const string &nameIn) |
| float * | getConscienceSimulationWorldStatus (bool rotationsAsEuler=false) |
| vector< CscPoint3d * > * | getVertexFromStrategy (CscWorldElementId entityId, int strategy) |
| vector< CscPoint3d * > * | getPatchFromStrategy (CscWorldElementId entityId, int strategy) |
| void | importObject (CscWorldObject *object) |
| void | importObjects (vector< CscWorldObject * > *objects) |
| void | importPlace (CscWorldPlace *place, bool removeOthers=true) |
| void | importLine (CscWorldLine *line) |
| void | importImage (CscWorldImage *sceneImage) |
| void | removeOtherElementByName (const string &name) |
| void | importPointsAsObjects (vector< CscPoint3d * > *points) |
| void | importEntity (const CscWorldEntity *entity, bool requiresExternalInit=false, const optional< function< void()>> &onRemoved={}) |
| bool | removeEntity (const CscWorldElementId &entityId) |
| virtual void | clearEntities () |
| bool | hasEntity (const CscWorldElementId &entityId) |
| CscPhysicsSimulator * | getPhysicSimulator () const |
| void | setFocusedObjectByIndex (int objectIndex) |
| CscWorldObject * | getFocusedObjectCurrent () const |
| int | countObjects () |
| virtual void | clearObjects () |
| CscWorldObject * | getObjectById (const CscWorldElementId objectId) const |
| const CscPoint3d * | getObjectPositionInSimulator (const string &serialNumber) const |
| CscWorldObject * | getObjectByModelId (int objectModelId) |
| virtual vector< CscWorldObject * > | getObjectsByModelId (int objectModelId) |
| CscWorldPlace * | getPlace () |
| CscWorldPlace * | getPlaceById (const CscWorldElementId &placeId) |
| const vector< CscWorldPlace * > | getPlaces (function< bool(const CscWorldPlace *)> filter=[](const CscWorldPlace *) { return true;}) |
| const CscWorldEntity * | getEntity (const CscWorldElementId &entityId) const |
| virtual vector< CscWorldEntity * > | getEntities (const function< bool(const CscWorldEntity *)> filter=[](const CscWorldEntity *) { return true;}) |
| virtual vector< string > | getEntitySerialNumbers (const function< bool(const CscWorldEntity *)> filter=[](const CscWorldEntity *) { return true;}) |
| const CscEntityModel * | getEntityModel (const CscWorldElementId &entityId) const |
| const MemberState * | getEntityMemberStateById (const CscWorldElementId &entityId, int id) const |
| const MemberState * | getEntityMemberState (const CscWorldElementId &entityId, const CscMember *member) const |
| const MemberState * | getEntityMemberStateByName (const CscWorldElementId &entityId, const string &memberName) const |
| const CscPoint3d * | getEntityPosition (const CscWorldElementId &entityId) const |
| CscPoint3dOriented | getEntityPositionAndRotation (const CscWorldElementId &entityId) const |
| CscPoint3d | getEntityAcceleration (const CscWorldElementId &entityId) const |
| pair< CscPoint3d, CscQuaternion > | getEntityPositionAndRotationQuaternion (const CscWorldElementId &entityId) const |
| void | doWithEntities (function< void(const map< CscWorldElementId, const CscWorldEntity * > &entities)> action) |
| void | doWithObjects (function< void(const vector< CscWorldObject * > &objects)> action) |
| CscState * | getEntityState (const CscWorldElementId &entityId) const |
| void | forceState (const CscWorldElementId &entityId, CscState *aState, int memberIdForInputs, const bool applyPos[3], const bool applyRot[3], const bool applyAcc[3], optional< int > nbMaxIteration={}, optional< int > maxLoopDurationMillis={}) |
| void | playSequence (const CscWorldElementId &entityId, CscState *init, CscSequence *sequence, const map< int, CscPivotMovementType > &pivotMovementByPivotId, bool geneticAi=false, bool extrapolationRealTime=false) |
| void | playState (const CscWorldElementId &entityId, CscState *state, int duration, int delay, bool relativeValues) |
| void | setAllPivotsToRelaxedMode (const CscWorldElementId &entityId) |
| void | forceMemberValues (const CscWorldElementId &entityId, const CscMemberInputStatus *inputsValues, const bool applyPosition[3], const bool applyEuler[3], const bool applyAcceleration[3], optional< int > nbMaxIteration={}, optional< int > maxLoopDurationMillis={}) |
| int | moveMemberToStateFromMember (const CscWorldElementId &entityId, const CscMemberInputStatus *inputsValues, const bool applyPosition[3], const bool applyEuler[3], const bool applyAcceleration[3], int nbMaxIteration=40, int tryNumber=0) |
| float | getJointHingeAngle (const CscWorldElementId &entityId, int jointIdIn) const |
| void | updateMemberEulers (const CscWorldElementId &entityId, int memberId, double eulerX, double eulerY, double eulerZ) |
| void | updateMemberPosition (const CscWorldElementId &entityId, int memberId, float posX, float posY, float posZ) |
| void | moveObjectToPosition (CscWorldElement *object, const CscPoint3d *targetPosition) |
| void | moveObjectToRotation (CscWorldElement *object, const CscPoint3d *targetRotation) |
| void | moveObjectToPositionAndRotation (CscWorldElement *object, const CscPoint3d *targetPosition, const CscPoint3d *targetRotation) |
| virtual void | clearPlaces () |
| void | loadDefaultPlaceFloor () |
| void | clearOtherElements () |
| CscGrid * | getSceneFloor () const |
| void | focusVisionIntoPosition (float posX, float posY, float posZ) |
| CscWorldObject * | getObjectByName (const string &name) |
| CscWorldObject * | getObjectByPosition (CscPoint3d *position, float radius) |
| virtual void | removeObjectById (CscWorldElementId objectId) |
| void | removeObjectByName (const string &name) |
| void | removeObjectsByModelId (int objectModelId) |
| void | removeObjectsByTag (const string &searchedTag) |
| bool | removePlaceById (const string &placeId) |
| bool | hasObjectWithModelId (int objectModelId) |
| void | dump (fs::path outPath=fs::path(string(CSC_DEFAULT_OUT_DIR)+"/envSim_"+to_string(nowMillis())+".png")) const |
| CscPoint3d * | computeConsciencePositionFromGnssPosition (const CscPoint3d *gnssPosition, const string &projection) |
| Converts a GNSS position to a Conscience coordinate system position. This method takes a CscPoint3d object representing a GNSS position (longitude in X, latitude in Z, altitude in Y) and returns a new CscPoint3d object with coordinates transformed to the Conscience coordinate system (centimeters). More... | |
| CscPoint3d * | computeGnssPositionFromConsciencePosition (const CscPoint3d *consciencePosition, const string &projection) |
| Converts a Conscience system position to a GNSS position. This method accepts a CscPoint3d object representing a position in the Conscience coordinate system (centimeters) and returns a new CscPoint3d object with coordinates mapped to GNSS positioning (longitude in X, latitude in Z, altitude in Y) More... | |
| vector< CscPoint3d * > * | computeGnssPositionsFromConsciencePositions (vector< CscPoint3d * > *consciencePositions, const string &projection) |
| Converts a Conscience system positions to GNSS positions. This method accepts a list of CscPoint3d object representing positions in the Conscience coordinate system (centimeters) and returns a new list of CscPoint3d object with coordinates mapped to GNSS positioning (longitude in X, latitude in Z, altitude in Y) More... | |
| void | setGnssReferencePosition (CscPoint3d *gnssPoint) |
Sets the reference GNSS position. This method updates the internal reference coordinates to a new GNSS position as specified by the gnssPoint parameter. The reference point represents the origin (0,0,0) in the Conscience coordinate system. More... | |
| bool | gnssReferencePositionIsSet () |
| true if the reference GNSS position have a value. More... | |
| void | computeGnssReferencePositionWithConsciencePosition (CscPoint3d *gnssPoint, CscPoint3d *consciencePosition, const string &projection) |
Sets the reference GNSS position. This method updates the internal reference coordinates to a new GNSS position as specified by the gnssPoint parameter. The reference point represents the position consciencePosition in the Conscience coordinate system. More... | |
Public Attributes | |
| int | currentFocusedObjectIndex |
| CscEnvironmentSimulator::CscEnvironmentSimulator | ( | bool | autoIncrement | ) |
|
virtual |
| void CscEnvironmentSimulator::clear | ( | ) |
|
virtual |
|
virtual |
| void CscEnvironmentSimulator::clearOtherElements | ( | ) |
|
virtual |
| CscPoint3d * CscEnvironmentSimulator::computeConsciencePositionFromGnssPosition | ( | const CscPoint3d * | gnssPosition, |
| const string & | projection | ||
| ) |
Converts a GNSS position to a Conscience coordinate system position. This method takes a CscPoint3d object representing a GNSS position (longitude in X, latitude in Z, altitude in Y) and returns a new CscPoint3d object with coordinates transformed to the Conscience coordinate system (centimeters).
| CscPoint3d * CscEnvironmentSimulator::computeGnssPositionFromConsciencePosition | ( | const CscPoint3d * | consciencePosition, |
| const string & | projection | ||
| ) |
Converts a Conscience system position to a GNSS position. This method accepts a CscPoint3d object representing a position in the Conscience coordinate system (centimeters) and returns a new CscPoint3d object with coordinates mapped to GNSS positioning (longitude in X, latitude in Z, altitude in Y)
| vector< CscPoint3d * > * CscEnvironmentSimulator::computeGnssPositionsFromConsciencePositions | ( | vector< CscPoint3d * > * | consciencePositions, |
| const string & | projection | ||
| ) |
Converts a Conscience system positions to GNSS positions. This method accepts a list of CscPoint3d object representing positions in the Conscience coordinate system (centimeters) and returns a new list of CscPoint3d object with coordinates mapped to GNSS positioning (longitude in X, latitude in Z, altitude in Y)
| void CscEnvironmentSimulator::computeGnssReferencePositionWithConsciencePosition | ( | CscPoint3d * | gnssPoint, |
| CscPoint3d * | consciencePosition, | ||
| const string & | projection | ||
| ) |
Sets the reference GNSS position. This method updates the internal reference coordinates to a new GNSS position as specified by the gnssPoint parameter. The reference point represents the position consciencePosition in the Conscience coordinate system.
| int CscEnvironmentSimulator::countObjects | ( | ) |
| void CscEnvironmentSimulator::doWithEntities | ( | function< void(const map< CscWorldElementId, const CscWorldEntity * > &entities)> | action | ) |
Executes given action in a critical section preventing modifications on environment's entities while action is processing.
| void CscEnvironmentSimulator::doWithObjects | ( | function< void(const vector< CscWorldObject * > &objects)> | action | ) |
Executes given action in a critical section preventing modifications on environment's objects while action is processing.
| void CscEnvironmentSimulator::dump | ( | fs::path | outPath = fs::path(string(CSC_DEFAULT_OUT_DIR) + "/envSim_" + to_string(nowMillis()) + ".png") | ) | const |
write an overview of this environment simulator to disk
| void CscEnvironmentSimulator::focusVisionIntoPosition | ( | float | posX, |
| float | posY, | ||
| float | posZ | ||
| ) |
| void CscEnvironmentSimulator::forceMemberValues | ( | const CscWorldElementId & | entityId, |
| const CscMemberInputStatus * | inputsValues, | ||
| const bool | applyPosition[3], | ||
| const bool | applyEuler[3], | ||
| const bool | applyAcceleration[3], | ||
| optional< int > | nbMaxIteration = {}, |
||
| optional< int > | maxLoopDurationMillis = {} |
||
| ) |
| nbMaxIteration | maximum number of iteration for forceMemberValuesAndVerifyState loop which can take a long time before convergence |
| maxLoopDurationMillis | maximum duration for forceMemberValuesAndVerifyState loop which can take a long time before convergence |
| void CscEnvironmentSimulator::forceState | ( | const CscWorldElementId & | entityId, |
| CscState * | aState, | ||
| int | memberIdForInputs, | ||
| const bool | applyPos[3], | ||
| const bool | applyRot[3], | ||
| const bool | applyAcc[3], | ||
| optional< int > | nbMaxIteration = {}, |
||
| optional< int > | maxLoopDurationMillis = {} |
||
| ) |
| nbMaxIteration | maximum number of iteration for forceMemberValuesAndVerifyState loop which can take a long time before convergence |
| maxLoopDurationMillis | maximum duration for forceMemberValuesAndVerifyState loop which can take a long time before convergence |
| float * CscEnvironmentSimulator::getConscienceSimulationWorldStatus | ( | bool | rotationsAsEuler = false | ) |
| rotationsAsEuler | if true, rotations will be encoded as 3 floats: pitch,yaw,roll - otherwise, rotations will be encoded as quaternions, 4 floats: w,x,y,z |
| CscWorldElement * CscEnvironmentSimulator::getElementByName | ( | const string & | nameIn | ) |
|
virtual |
| const CscWorldEntity * CscEnvironmentSimulator::getEntity | ( | const CscWorldElementId & | entityId | ) | const |
| CscPoint3d CscEnvironmentSimulator::getEntityAcceleration | ( | const CscWorldElementId & | entityId | ) | const |
| const MemberState * CscEnvironmentSimulator::getEntityMemberState | ( | const CscWorldElementId & | entityId, |
| const CscMember * | member | ||
| ) | const |
| const MemberState * CscEnvironmentSimulator::getEntityMemberStateById | ( | const CscWorldElementId & | entityId, |
| int | id | ||
| ) | const |
| const MemberState * CscEnvironmentSimulator::getEntityMemberStateByName | ( | const CscWorldElementId & | entityId, |
| const string & | memberName | ||
| ) | const |
| const CscEntityModel * CscEnvironmentSimulator::getEntityModel | ( | const CscWorldElementId & | entityId | ) | const |
| const CscPoint3d * CscEnvironmentSimulator::getEntityPosition | ( | const CscWorldElementId & | entityId | ) | const |
| CscPoint3dOriented CscEnvironmentSimulator::getEntityPositionAndRotation | ( | const CscWorldElementId & | entityId | ) | const |
| pair< CscPoint3d, CscQuaternion > CscEnvironmentSimulator::getEntityPositionAndRotationQuaternion | ( | const CscWorldElementId & | entityId | ) | const |
|
virtual |
| CscState * CscEnvironmentSimulator::getEntityState | ( | const CscWorldElementId & | entityId | ) | const |
return requested entity's current state WARNING: a new state is returned, which means pointer needs to be deleted after usage
| CscWorldObject * CscEnvironmentSimulator::getFocusedObjectCurrent | ( | ) | const |
| float CscEnvironmentSimulator::getJointHingeAngle | ( | const CscWorldElementId & | entityId, |
| int | jointIdIn | ||
| ) | const |
| CscWorldObject * CscEnvironmentSimulator::getObjectById | ( | const CscWorldElementId | objectId | ) | const |
| CscWorldObject * CscEnvironmentSimulator::getObjectByModelId | ( | int | objectModelId | ) |
| CscWorldObject * CscEnvironmentSimulator::getObjectByName | ( | const string & | name | ) |
| CscWorldObject * CscEnvironmentSimulator::getObjectByPosition | ( | CscPoint3d * | position, |
| float | radius | ||
| ) |
| const CscPoint3d * CscEnvironmentSimulator::getObjectPositionInSimulator | ( | const string & | serialNumber | ) | const |
|
virtual |
|
virtual |
| vector< CscPoint3d * > * CscEnvironmentSimulator::getPatchFromStrategy | ( | CscWorldElementId | entityId, |
| int | strategy | ||
| ) |
| CscPhysicsSimulator * CscEnvironmentSimulator::getPhysicSimulator | ( | ) | const |
| CscWorldPlace * CscEnvironmentSimulator::getPlace | ( | ) |
return first place
| CscWorldPlace * CscEnvironmentSimulator::getPlaceById | ( | const CscWorldElementId & | placeId | ) |
| const vector< CscWorldPlace * > CscEnvironmentSimulator::getPlaces | ( | function< bool(const CscWorldPlace *)> | filter = [](const CscWorldPlace *) { return true; } | ) |
| CscGrid * CscEnvironmentSimulator::getSceneFloor | ( | ) | const |
| vector< CscPoint3d * > * CscEnvironmentSimulator::getVertexFromStrategy | ( | CscWorldElementId | entityId, |
| int | strategy | ||
| ) |
| bool CscEnvironmentSimulator::gnssReferencePositionIsSet | ( | ) |
true if the reference GNSS position have a value.
| bool CscEnvironmentSimulator::hasEntity | ( | const CscWorldElementId & | entityId | ) |
| bool CscEnvironmentSimulator::hasObjectWithModelId | ( | int | objectModelId | ) |
| void CscEnvironmentSimulator::importEntity | ( | const CscWorldEntity * | entity, |
| bool | requiresExternalInit = false, |
||
| const optional< function< void()>> & | onRemoved = {} |
||
| ) |
| void CscEnvironmentSimulator::importImage | ( | CscWorldImage * | sceneImage | ) |
| void CscEnvironmentSimulator::importLine | ( | CscWorldLine * | line | ) |
| void CscEnvironmentSimulator::importObject | ( | CscWorldObject * | object | ) |
| void CscEnvironmentSimulator::importObjects | ( | vector< CscWorldObject * > * | objects | ) |
| void CscEnvironmentSimulator::importPlace | ( | CscWorldPlace * | place, |
| bool | removeOthers = true |
||
| ) |
| void CscEnvironmentSimulator::importPointsAsObjects | ( | vector< CscPoint3d * > * | points | ) |
For debug purpose, mainly. It will import each point as a tiny cube
| void CscEnvironmentSimulator::loadDefaultPlaceFloor | ( | ) |
| int CscEnvironmentSimulator::moveMemberToStateFromMember | ( | const CscWorldElementId & | entityId, |
| const CscMemberInputStatus * | inputsValues, | ||
| const bool | applyPosition[3], | ||
| const bool | applyEuler[3], | ||
| const bool | applyAcceleration[3], | ||
| int | nbMaxIteration = 40, |
||
| int | tryNumber = 0 |
||
| ) |
| void CscEnvironmentSimulator::moveObjectToPosition | ( | CscWorldElement * | object, |
| const CscPoint3d * | targetPosition | ||
| ) |
| void CscEnvironmentSimulator::moveObjectToPositionAndRotation | ( | CscWorldElement * | object, |
| const CscPoint3d * | targetPosition, | ||
| const CscPoint3d * | targetRotation | ||
| ) |
| void CscEnvironmentSimulator::moveObjectToRotation | ( | CscWorldElement * | object, |
| const CscPoint3d * | targetRotation | ||
| ) |
| void CscEnvironmentSimulator::playSequence | ( | const CscWorldElementId & | entityId, |
| CscState * | init, | ||
| CscSequence * | sequence, | ||
| const map< int, CscPivotMovementType > & | pivotMovementByPivotId, | ||
| bool | geneticAi = false, |
||
| bool | extrapolationRealTime = false |
||
| ) |
| void CscEnvironmentSimulator::playState | ( | const CscWorldElementId & | entityId, |
| CscState * | state, | ||
| int | duration, | ||
| int | delay, | ||
| bool | relativeValues | ||
| ) |
| bool CscEnvironmentSimulator::removeEntity | ( | const CscWorldElementId & | entityId | ) |
|
virtual |
| void CscEnvironmentSimulator::removeObjectByName | ( | const string & | name | ) |
| void CscEnvironmentSimulator::removeObjectsByModelId | ( | int | objectModelId | ) |
| void CscEnvironmentSimulator::removeObjectsByTag | ( | const string & | searchedTag | ) |
| void CscEnvironmentSimulator::removeOtherElementByName | ( | const string & | name | ) |
| bool CscEnvironmentSimulator::removePlaceById | ( | const string & | placeId | ) |
| void CscEnvironmentSimulator::setAllPivotsToRelaxedMode | ( | const CscWorldElementId & | entityId | ) |
| void CscEnvironmentSimulator::setFocusedObjectByIndex | ( | int | objectIndex | ) |
| void CscEnvironmentSimulator::setGnssReferencePosition | ( | CscPoint3d * | gnssPoint | ) |
Sets the reference GNSS position. This method updates the internal reference coordinates to a new GNSS position as specified by the gnssPoint parameter. The reference point represents the origin (0,0,0) in the Conscience coordinate system.
| void CscEnvironmentSimulator::updateMemberEulers | ( | const CscWorldElementId & | entityId, |
| int | memberId, | ||
| double | eulerX, | ||
| double | eulerY, | ||
| double | eulerZ | ||
| ) |
| void CscEnvironmentSimulator::updateMemberPosition | ( | const CscWorldElementId & | entityId, |
| int | memberId, | ||
| float | posX, | ||
| float | posY, | ||
| float | posZ | ||
| ) |
| int CscEnvironmentSimulator::currentFocusedObjectIndex |