sot-core  4.11.8
Hierarchical task solver plug-in for dynamic-graph.
dynamicgraph::sot::SotLoader Class Reference

This class is loading the control part of the Stack-Of-Tasks. More...

#include <sot/core/sot-loader.hh>

Public Member Functions

 SotLoader ()
 Default constructor. More...
 
 ~SotLoader ()
 Default destructor. More...
 
int parseOptions (int argc, char *argv[])
 Read user input to extract the path of the SoT dynamic library. More...
 
bool initialization ()
 Prepare the SoT framework. More...
 
void cleanUp ()
 Unload the library which handles the robot device. More...
 
bool isDynamicGraphStopped ()
 Get Status of dg. More...
 
void startDG ()
 Get Status of dg. More...
 
void stopDG ()
 Get Status of dg. More...
 
void setDynamicLibraryName (std::string &afilename)
 Specify the name of the dynamic library. More...
 
void runPythonCommand (const std::string &command, std::string &result, std::string &out, std::string &err)
 Run a python command inside the embeded python interpreter. More...
 
void runPythonFile (std::string ifilename, std::string &err)
 Run a python script inside the embeded python interpreter. More...
 
void runPythonFile (std::string ifilename)
 Run a python script inside the embeded python interpreter. More...
 
void oneIteration (std::map< std::string, SensorValues > &sensors_in, std::map< std::string, ControlValues > &control_values)
 Compute one iteration of control. Basically executes fillSensors, the SoT and the readControl. More...
 
void loadDeviceInPython (const std::string &device_name)
 Load the Device entity in the python global scope. More...
 

Protected Attributes

bool dynamic_graph_stopped_
 Check if the dynamic graph is running or not. More...
 
AbstractSotExternalInterfacesot_external_interface_
 The interface between the device and the robot driver. More...
 
std::string sot_dynamic_library_filename_
 Name of the dynamic library containing the dgs::AbstractSotExternalInterface object. More...
 
void * sot_dynamic_library_
 Handle on the SoT library. More...
 
python::Interpreter embeded_python_interpreter_
 Embeded python interpreter. More...
 
std::map< std::string, SensorValuessensors_in_
 Map of sensor readings. More...
 
std::map< std::string, ControlValuescontrol_values_
 Map of control values. More...
 
std::string device_name_
 Device entity created and loaded, so we deregister it as the Pool is not responsible for it's life time. More...
 

Detailed Description

This class is loading the control part of the Stack-Of-Tasks.

  • 1/ It loads dynamically the graph interface.
  • 2/ It loads the python interpreter.
  • 3/ It loads the Device entity C++ pointer inside the python interpreter.
  • 4/ It provides the user interface to the graph:
    • 4.1/ starts and stop the graph executtion.
    • 4.2/ run a python command/script inside the embeded python interpreter.
    • 4.3/ execute one iteration of the graph.

In order to Use this class you need to provide a dynamic library containing an implementation of the AbstractSotExternalInterface class.

Then you can either inherite from this class an initialize and use the sensors_in_ and control_values_ objects. Or you can create you own outside of this class. And then use the oneIteration to execute the graph.

Constructor & Destructor Documentation

◆ SotLoader()

dynamicgraph::sot::SotLoader::SotLoader ( )

Default constructor.

◆ ~SotLoader()

dynamicgraph::sot::SotLoader::~SotLoader ( )

Default destructor.

Member Function Documentation

◆ cleanUp()

void dynamicgraph::sot::SotLoader::cleanUp ( )

Unload the library which handles the robot device.

◆ initialization()

bool dynamicgraph::sot::SotLoader::initialization ( )

Prepare the SoT framework.

◆ isDynamicGraphStopped()

bool dynamicgraph::sot::SotLoader::isDynamicGraphStopped ( )
inline

Get Status of dg.

◆ loadDeviceInPython()

void dynamicgraph::sot::SotLoader::loadDeviceInPython ( const std::string &  device_name)

Load the Device entity in the python global scope.

◆ oneIteration()

void dynamicgraph::sot::SotLoader::oneIteration ( std::map< std::string, SensorValues > &  sensors_in,
std::map< std::string, ControlValues > &  control_values 
)

Compute one iteration of control. Basically executes fillSensors, the SoT and the readControl.

◆ parseOptions()

int dynamicgraph::sot::SotLoader::parseOptions ( int  argc,
char *  argv[] 
)

Read user input to extract the path of the SoT dynamic library.

◆ runPythonCommand()

void dynamicgraph::sot::SotLoader::runPythonCommand ( const std::string &  command,
std::string &  result,
std::string &  out,
std::string &  err 
)

Run a python command inside the embeded python interpreter.

◆ runPythonFile() [1/2]

void dynamicgraph::sot::SotLoader::runPythonFile ( std::string  ifilename)
inline

Run a python script inside the embeded python interpreter.

◆ runPythonFile() [2/2]

void dynamicgraph::sot::SotLoader::runPythonFile ( std::string  ifilename,
std::string &  err 
)
inline

Run a python script inside the embeded python interpreter.

◆ setDynamicLibraryName()

void dynamicgraph::sot::SotLoader::setDynamicLibraryName ( std::string &  afilename)
inline

Specify the name of the dynamic library.

◆ startDG()

void dynamicgraph::sot::SotLoader::startDG ( )
inline

Get Status of dg.

◆ stopDG()

void dynamicgraph::sot::SotLoader::stopDG ( )
inline

Get Status of dg.

Member Data Documentation

◆ control_values_

std::map<std::string, ControlValues> dynamicgraph::sot::SotLoader::control_values_
protected

Map of control values.

◆ device_name_

std::string dynamicgraph::sot::SotLoader::device_name_
protected

Device entity created and loaded, so we deregister it as the Pool is not responsible for it's life time.

◆ dynamic_graph_stopped_

bool dynamicgraph::sot::SotLoader::dynamic_graph_stopped_
protected

Check if the dynamic graph is running or not.

◆ embeded_python_interpreter_

python::Interpreter dynamicgraph::sot::SotLoader::embeded_python_interpreter_
protected

Embeded python interpreter.

◆ sensors_in_

std::map<std::string, SensorValues> dynamicgraph::sot::SotLoader::sensors_in_
protected

Map of sensor readings.

◆ sot_dynamic_library_

void* dynamicgraph::sot::SotLoader::sot_dynamic_library_
protected

Handle on the SoT library.

◆ sot_dynamic_library_filename_

std::string dynamicgraph::sot::SotLoader::sot_dynamic_library_filename_
protected

Name of the dynamic library containing the dgs::AbstractSotExternalInterface object.

◆ sot_external_interface_

AbstractSotExternalInterface* dynamicgraph::sot::SotLoader::sot_external_interface_
protected

The interface between the device and the robot driver.


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