Conscience Core
Public Member Functions | Static Public Member Functions | List of all members
conscience_core::ai::CscEntityReflexion Class Reference

#include <CscEntityReflexion.h>

Public Member Functions

 CscEntityReflexion (ptr< CscEntityReflexionParameters > parameters, CscEnvironmentSimulator &globalEnvironmentSimulator)
 
virtual ~CscEntityReflexion ()
 
void stopAndRelease (bool removeFromEnvironment=true)
 
void setSensorValues (const string &sensorName, const map< string, double > &values)
 
bool isLidarEngineActivated ()
 
bool isLidarEngineInitialized ()
 
string getEntityType (const CscEntityModel &model) const
 
void restoreCartography (optional< fs::path > cartographyDirMaybe={})
 
CscPlaceCartographygetCartography () const
 
void setScene (CscWorldPlace *place)
 
CscCaptureEnginegetCaptureEngine (const optional< string > &videoSourceId={}) const
 
void resetToInitialState ()
 
ptr< CscEntityReflexiongetSharedPtr () const
 
void consumeVideoSource (const optional< string > &id={}, bool reopenEvenIfAlreadyOpened=true)
 
void setVideoSource (ptr< CscEntityVideoSource > videoSource, bool consumeIfClosedOrSourceChanged=false)
 
void resetParameters (ptr< CscEntityReflexionParameters >)
 
ptr< const CscEntityReflexionParametersgetParameters () const
 
ptr< CscEntityReflexionDetectionParametersgetDetectionParameters ()
 
void setDetectionParameters (ptr< CscEntityReflexionDetectionParameters >)
 
void unwatchAlerts (vector< CscAlertType > alertsToBeUnwatched)
 
void fireLiveEnvironmentUpdate ()
 
ptr< CscEntityClientgetEntityClient () const
 
optional< ptr< DetectionResult > > getLastDetectionResult ()
 
CscEnvironmentSimulatorgetGlobalEnvironmentSimulator ()
 
void addLiveEnvironmentUpdateListener (LiveEnvironmentUpdateListener listener)
 
void onSequenceToBeSentToRealEntity (SequenceProcessorSendSequenceListener listener)
 
const string & getSerialNumber () const
 
const string & getEntityModelId () const
 
optional< fs::path > stopLastPeriodCaptureRecordingToFile ()
 
void startLastPeriodCaptureRecordingToFile (short durationSeconds, const fs::path &outputPath)
 
void stopCaptureRecordingToFile ()
 
void startCaptureRecordingToFile (const fs::path &outputPath, const optional< string > &videoSourceId={})
 
void purgeAIObjectives ()
 
const CscEntityModelgetEntityModel () const
 
const CscSimulationWorldgetAISimulationWorld () const
 
float * geAIObjectivesStatus () const
 
CscSequenceprocessKnowledgeItem (CscKnowledgeItem *knowledgeItem, CscState *initialState)
 
void stopLidarEngine ()
 
void startLidarEngineLocalDevice (string devicePath, double *currentState)
 
void startLidarEngineEntity ()
 
optional< string > getStringDetectorResult ()
 
void clearStringDetectorResult ()
 
void vocalPhoneCallTest (const vector< string > &phoneNumbers, const map< string, string > &additionalParams)
 
void removeObjectivesByAITypes (knowledge::CscArtificialIntelligenceType type)
 
void setSlamCartographyActivated (bool enable)
 
void stopAndSaveLidarCartography ()
 
void setSlamLocalizationActivated (bool enable, CscPoint3dOriented *position=nullptr)
 
void clearLidarCartography ()
 
CscEntityPositionManagergetPositionManager () const
 
vector< ptr< HumanDecision > > getOngoingDecisions ()
 
void answerDecision (const string &decisionUid, bool accept)
 
const FocusParametergetFocusParameter ()
 
void setFocusParameter (const FocusParameter *focusParam)
 
map< string, ptr< CscPublicAIData > > getPublicAIDataForSubject (const string &subject)
 
void clearPublicAIDataForSubject (const string &subject)
 
CscSequencesProcessorgetSequenceProcessor () const
 
CscSlamEnginegetSlamEngine ()
 
CscLidarEnginegetLidarEngine ()
 
bool isSimulated () const
 This method determines whether the reflection entity is simulated or real. A simulated entity is only available within the simulator and has no repercussions in the real world. On the other hand, a real entity exists outside the simulator; it is its digital twin that is displayed within the simulator. More...
 
bool useGnssPositioning () const
 This method determines if the entity use a gnss positioning. It's use for determine the position send in sequence result. More...
 
ptr< CscEntityIdentitygetEntityIdentity () const
 
void sendSequenceToRealRobot (CscSequence *sequence) const
 
void ifRunning (function< void()> action)
 
void loadCartographyFromPoints (const vector< const CscPoint3d * > &points)
 
const vector< ptr< CscEntityVideoSource > > & getVideoSources () const
 
ptr< CscEntityVideoSourcegetVideoSource (const optional< string > &id={}) const
 
void addVideoSource (ptr< CscEntityVideoSource > videoSource)
 
void removeVideoSource (ptr< CscEntityVideoSource > videoSource)
 
CscEntityReflexionActivity getActivitySummary ()
 
ptr< CscEntityDetectionStategetDetectionState () const
 
CscEntityStatusFlags getAllEntityStatusFlags () const
 
bool hasStatusFlag (const vector< CscEntityStatusFlagsList > &statuses) const
 
bool hasStatusFlag (CscEntityStatusFlagsList status) const
 
void setLastEntityStatusFlags (const string &lastEntityStatusFlags)
 
void addAdditionalEntityStatusFlag (CscEntityStatusFlagsList flag)
 
void removeAdditionalEntityStatusFlag (CscEntityStatusFlagsList flag)
 
void startAutonomousExploration ()
 
void stopAutonomousExploration ()
 
void setEntityClient (ptr< CscEntityClient > entityClient)
 
void ifNotStopped (const function< void()> &action)
 
void addCustomData (const map< string, void * > &customData)
 
map< string, void * > getCustomData () const
 
void * getCustomDataValue (const string &key) const
 

Static Public Member Functions

static bool & autoCloseStreamEnabled ()
 

Detailed Description

Processes "reflection" for an entity (identified by its serial number). Entity thinking process can be described as 2 main loops : 1) capture / detect / focus & notify 2) AI with genetical algorithms

Constructor & Destructor Documentation

◆ CscEntityReflexion()

conscience_core::ai::CscEntityReflexion::CscEntityReflexion ( ptr< CscEntityReflexionParameters parameters,
CscEnvironmentSimulator globalEnvironmentSimulator 
)

Reflection starts when this constructor is called. Which means that instance initializes, entity is imported in simulator(s), and threads start

◆ ~CscEntityReflexion()

conscience_core::ai::CscEntityReflexion::~CscEntityReflexion ( )
virtual

Member Function Documentation

◆ addAdditionalEntityStatusFlag()

void conscience_core::ai::CscEntityReflexion::addAdditionalEntityStatusFlag ( CscEntityStatusFlagsList  flag)

This will add a new additional flag (in addition to last entity status flags from real entity)

◆ addCustomData()

void conscience_core::ai::CscEntityReflexion::addCustomData ( const map< string, void * > &  customData)

assign any user defined data to this entity

◆ addLiveEnvironmentUpdateListener()

void conscience_core::ai::CscEntityReflexion::addLiveEnvironmentUpdateListener ( LiveEnvironmentUpdateListener  listener)

◆ addVideoSource()

void conscience_core::ai::CscEntityReflexion::addVideoSource ( ptr< CscEntityVideoSource videoSource)

Adds a secondary video source for this entity reflexion. Primary video source is given in entity reflexion paramters

◆ answerDecision()

void conscience_core::ai::CscEntityReflexion::answerDecision ( const string &  decisionUid,
bool  accept 
)

◆ autoCloseStreamEnabled()

bool & conscience_core::ai::CscEntityReflexion::autoCloseStreamEnabled ( )
static

Default: true If true, reflexions will automatically close their stream consumption when idle (no detector enabled)

◆ clearLidarCartography()

void conscience_core::ai::CscEntityReflexion::clearLidarCartography ( )

◆ clearPublicAIDataForSubject()

void conscience_core::ai::CscEntityReflexion::clearPublicAIDataForSubject ( const string &  subject)

◆ clearStringDetectorResult()

void conscience_core::ai::CscEntityReflexion::clearStringDetectorResult ( )

◆ consumeVideoSource()

void conscience_core::ai::CscEntityReflexion::consumeVideoSource ( const optional< string > &  id = {},
bool  reopenEvenIfAlreadyOpened = true 
)

Closes currently opened stream, if any, and then open a new capture stream based on video source configured in parameters

Parameters
idid of the video source to be consumed. If empty, primary video source will be consumed
reopenEvenIfAlreadyOpenedif true, captureEngine will be reopened on source. If false, captureEngine will be opened only if not already opened
See also
CscEntityReflexionParameters

◆ fireLiveEnvironmentUpdate()

void conscience_core::ai::CscEntityReflexion::fireLiveEnvironmentUpdate ( )

◆ geAIObjectivesStatus()

float * conscience_core::ai::CscEntityReflexion::geAIObjectivesStatus ( ) const

◆ getActivitySummary()

CscEntityReflexionActivity conscience_core::ai::CscEntityReflexion::getActivitySummary ( )

◆ getAISimulationWorld()

const CscSimulationWorld * conscience_core::ai::CscEntityReflexion::getAISimulationWorld ( ) const

◆ getAllEntityStatusFlags()

CscEntityStatusFlags conscience_core::ai::CscEntityReflexion::getAllEntityStatusFlags ( ) const

returns last known entity status flags (Only supported for real entities at the moment) and additional flags

See also
CscEntityStatusFlagsList
CscEntityReflexion::addAdditionalEntityStatusFlag(flag)

◆ getCaptureEngine()

CscCaptureEngine * conscience_core::ai::CscEntityReflexion::getCaptureEngine ( const optional< string > &  videoSourceId = {}) const

Gets capture engine for given videoSourceId or null if capture engine not found for requested video source

Parameters
videoSourceIdid of the video source of the capture engine. If empty, primary source will be used

◆ getCartography()

CscPlaceCartography * conscience_core::ai::CscEntityReflexion::getCartography ( ) const

◆ getCustomData()

map< string, void * > conscience_core::ai::CscEntityReflexion::getCustomData ( ) const
Returns
thread safe copy of this entity's user defined data

◆ getCustomDataValue()

void * conscience_core::ai::CscEntityReflexion::getCustomDataValue ( const string &  key) const
Returns
thread safe, return value of user defined data for given key, or nullptr if not found

◆ getDetectionParameters()

ptr< CscEntityReflexionDetectionParameters > conscience_core::ai::CscEntityReflexion::getDetectionParameters ( )

◆ getDetectionState()

ptr<CscEntityDetectionState> conscience_core::ai::CscEntityReflexion::getDetectionState ( ) const
inline

◆ getEntityClient()

ptr< CscEntityClient > conscience_core::ai::CscEntityReflexion::getEntityClient ( ) const

◆ getEntityIdentity()

ptr< CscEntityIdentity > conscience_core::ai::CscEntityReflexion::getEntityIdentity ( ) const

◆ getEntityModel()

const CscEntityModel * conscience_core::ai::CscEntityReflexion::getEntityModel ( ) const

◆ getEntityModelId()

const string & conscience_core::ai::CscEntityReflexion::getEntityModelId ( ) const

◆ getEntityType()

string conscience_core::ai::CscEntityReflexion::getEntityType ( const CscEntityModel model) const

◆ getFocusParameter()

const FocusParameter * conscience_core::ai::CscEntityReflexion::getFocusParameter ( )

◆ getGlobalEnvironmentSimulator()

CscEnvironmentSimulator & conscience_core::ai::CscEntityReflexion::getGlobalEnvironmentSimulator ( )

◆ getLastDetectionResult()

optional< ptr< DetectionResult > > conscience_core::ai::CscEntityReflexion::getLastDetectionResult ( )

◆ getLidarEngine()

CscLidarEngine * conscience_core::ai::CscEntityReflexion::getLidarEngine ( )

◆ getOngoingDecisions()

vector< ptr< HumanDecision > > conscience_core::ai::CscEntityReflexion::getOngoingDecisions ( )

◆ getParameters()

ptr< const CscEntityReflexionParameters > conscience_core::ai::CscEntityReflexion::getParameters ( ) const

◆ getPositionManager()

CscEntityPositionManager * conscience_core::ai::CscEntityReflexion::getPositionManager ( ) const

◆ getPublicAIDataForSubject()

map< string, ptr< CscPublicAIData > > conscience_core::ai::CscEntityReflexion::getPublicAIDataForSubject ( const string &  subject)

◆ getSequenceProcessor()

CscSequencesProcessor * conscience_core::ai::CscEntityReflexion::getSequenceProcessor ( ) const

◆ getSerialNumber()

const string & conscience_core::ai::CscEntityReflexion::getSerialNumber ( ) const

◆ getSharedPtr()

ptr< CscEntityReflexion > conscience_core::ai::CscEntityReflexion::getSharedPtr ( ) const

◆ getSlamEngine()

CscSlamEngine * conscience_core::ai::CscEntityReflexion::getSlamEngine ( )

◆ getStringDetectorResult()

optional< string > conscience_core::ai::CscEntityReflexion::getStringDetectorResult ( )

◆ getVideoSource()

ptr< CscEntityVideoSource > conscience_core::ai::CscEntityReflexion::getVideoSource ( const optional< string > &  id = {}) const
Parameters
idid of the video source. If empty, primary source will be used

◆ getVideoSources()

const vector< ptr< CscEntityVideoSource > > & conscience_core::ai::CscEntityReflexion::getVideoSources ( ) const

◆ hasStatusFlag() [1/2]

bool conscience_core::ai::CscEntityReflexion::hasStatusFlag ( const vector< CscEntityStatusFlagsList > &  statuses) const
Returns
true if entity has any of the given status flags

◆ hasStatusFlag() [2/2]

bool conscience_core::ai::CscEntityReflexion::hasStatusFlag ( CscEntityStatusFlagsList  status) const

◆ ifNotStopped()

void conscience_core::ai::CscEntityReflexion::ifNotStopped ( const function< void()> &  action)

◆ ifRunning()

void conscience_core::ai::CscEntityReflexion::ifRunning ( function< void()>  action)

Thread safe method to run an action if and only if this entity reflexion is alive and running. Be sure to keep this action as short as possible because it locks entity reflexion loop

Thread safe method to run an action if and only if this entity reflexion is alive and running

◆ isLidarEngineActivated()

bool conscience_core::ai::CscEntityReflexion::isLidarEngineActivated ( )

◆ isLidarEngineInitialized()

bool conscience_core::ai::CscEntityReflexion::isLidarEngineInitialized ( )

◆ isSimulated()

bool conscience_core::ai::CscEntityReflexion::isSimulated ( ) const

This method determines whether the reflection entity is simulated or real. A simulated entity is only available within the simulator and has no repercussions in the real world. On the other hand, a real entity exists outside the simulator; it is its digital twin that is displayed within the simulator.

◆ loadCartographyFromPoints()

void conscience_core::ai::CscEntityReflexion::loadCartographyFromPoints ( const vector< const CscPoint3d * > &  points)

◆ onSequenceToBeSentToRealEntity()

void conscience_core::ai::CscEntityReflexion::onSequenceToBeSentToRealEntity ( SequenceProcessorSendSequenceListener  listener)

◆ processKnowledgeItem()

CscSequence * conscience_core::ai::CscEntityReflexion::processKnowledgeItem ( CscKnowledgeItem knowledgeItem,
CscState initialState 
)
Parameters
knowledgeItemwill be DELETED after use

◆ purgeAIObjectives()

void conscience_core::ai::CscEntityReflexion::purgeAIObjectives ( )

◆ removeAdditionalEntityStatusFlag()

void conscience_core::ai::CscEntityReflexion::removeAdditionalEntityStatusFlag ( CscEntityStatusFlagsList  flag)

◆ removeObjectivesByAITypes()

void conscience_core::ai::CscEntityReflexion::removeObjectivesByAITypes ( knowledge::CscArtificialIntelligenceType  type)

◆ removeVideoSource()

void conscience_core::ai::CscEntityReflexion::removeVideoSource ( ptr< CscEntityVideoSource videoSource)

◆ resetParameters()

void conscience_core::ai::CscEntityReflexion::resetParameters ( ptr< CscEntityReflexionParameters parameters)

Sets parameters for this entity reflexion. WARNING: consumeVideoSource() must be called to take in account video source changes

See also
CscEntityReflexion::consumeVideoSource()

◆ resetToInitialState()

void conscience_core::ai::CscEntityReflexion::resetToInitialState ( )

◆ restoreCartography()

void conscience_core::ai::CscEntityReflexion::restoreCartography ( optional< fs::path >  cartographyDirMaybe = {})
Parameters
cartographyDirMaybeif empty, will load latest from FS (default directory), otherwise will try to open carto folder if directory, or points csv file if file

◆ sendSequenceToRealRobot()

void conscience_core::ai::CscEntityReflexion::sendSequenceToRealRobot ( CscSequence sequence) const
Parameters
sequencewill NOT be deleted by this method

◆ setDetectionParameters()

void conscience_core::ai::CscEntityReflexion::setDetectionParameters ( ptr< CscEntityReflexionDetectionParameters detectionParameters)

◆ setEntityClient()

void conscience_core::ai::CscEntityReflexion::setEntityClient ( ptr< CscEntityClient entityClient)

◆ setFocusParameter()

void conscience_core::ai::CscEntityReflexion::setFocusParameter ( const FocusParameter focusParam)

◆ setLastEntityStatusFlags()

void conscience_core::ai::CscEntityReflexion::setLastEntityStatusFlags ( const string &  lastEntityStatusFlags)

Only a string containing CscEntityStatusFlagsList or empty string are supported at the moment coming from the entity

◆ setScene()

void conscience_core::ai::CscEntityReflexion::setScene ( CscWorldPlace place)

◆ setSensorValues()

void conscience_core::ai::CscEntityReflexion::setSensorValues ( const string &  sensorName,
const map< string, double > &  values 
)

◆ setSlamCartographyActivated()

void conscience_core::ai::CscEntityReflexion::setSlamCartographyActivated ( bool  enable)

◆ setSlamLocalizationActivated()

void conscience_core::ai::CscEntityReflexion::setSlamLocalizationActivated ( bool  enable,
CscPoint3dOriented position = nullptr 
)
Parameters
positionforce initial position

◆ setVideoSource()

void conscience_core::ai::CscEntityReflexion::setVideoSource ( ptr< CscEntityVideoSource videoSource,
bool  consumeIfClosedOrSourceChanged = false 
)

Sets video source for this entity reflexion. WARNING: consumeVideoSource() must be called to take in account (or consumeIfClosedOrSourceChanged should be true)

Parameters
videoSourcenew video source to be used as main source
consumeIfClosedOrSourceChangedif true, will open video stream if not opened (or reopen if source changed)
See also
CscEntityReflexion::consumeVideoSource()

◆ startAutonomousExploration()

void conscience_core::ai::CscEntityReflexion::startAutonomousExploration ( )

◆ startCaptureRecordingToFile()

void conscience_core::ai::CscEntityReflexion::startCaptureRecordingToFile ( const fs::path &  outputPath,
const optional< string > &  videoSourceId = {} 
)

◆ startLastPeriodCaptureRecordingToFile()

void conscience_core::ai::CscEntityReflexion::startLastPeriodCaptureRecordingToFile ( short  durationSeconds,
const fs::path &  outputPath 
)

◆ startLidarEngineEntity()

void conscience_core::ai::CscEntityReflexion::startLidarEngineEntity ( )

◆ startLidarEngineLocalDevice()

void conscience_core::ai::CscEntityReflexion::startLidarEngineLocalDevice ( string  devicePath,
double *  currentState 
)

◆ stopAndRelease()

void conscience_core::ai::CscEntityReflexion::stopAndRelease ( bool  removeFromEnvironment = true)
Parameters
removeFromEnvironmentpass false if entity has already been removed from environment simulator

◆ stopAndSaveLidarCartography()

void conscience_core::ai::CscEntityReflexion::stopAndSaveLidarCartography ( )

◆ stopAutonomousExploration()

void conscience_core::ai::CscEntityReflexion::stopAutonomousExploration ( )

◆ stopCaptureRecordingToFile()

void conscience_core::ai::CscEntityReflexion::stopCaptureRecordingToFile ( )

◆ stopLastPeriodCaptureRecordingToFile()

optional< fs::path > conscience_core::ai::CscEntityReflexion::stopLastPeriodCaptureRecordingToFile ( )
Returns
path of recorded file OR empty if no capture was in progress

◆ stopLidarEngine()

void conscience_core::ai::CscEntityReflexion::stopLidarEngine ( )

◆ unwatchAlerts()

void conscience_core::ai::CscEntityReflexion::unwatchAlerts ( vector< CscAlertType >  alertsToBeUnwatched)

◆ useGnssPositioning()

bool conscience_core::ai::CscEntityReflexion::useGnssPositioning ( ) const

This method determines if the entity use a gnss positioning. It's use for determine the position send in sequence result.

◆ vocalPhoneCallTest()

void conscience_core::ai::CscEntityReflexion::vocalPhoneCallTest ( const vector< string > &  phoneNumbers,
const map< string, string > &  additionalParams 
)

The documentation for this class was generated from the following files: