Privacy
An open-source, flexible 3D physical simulation framework
mars::interfaces::ControllerManagerInterface Class Referenceabstract

"ControllerManagerInterface" declares the interfaces for all controller operations that are used for the communication between the simulation modules. More...

#include <ControllerManagerInterface.h>

Public Member Functions

virtual ~ControllerManagerInterface ()
 Destructor. More...
 
virtual void getListController (std::vector< core_objects_exchange > *controllerList) const =0
 Gives information about core exchange data for controllers. More...
 
virtual int getControllerCount (void) const =0
 Returns the number of controllers that are currently present in the simulation. More...
 
virtual const ControllerData getFullController (unsigned long index) const =0
 Gives all information of a certain controller. More...
 
virtual void removeController (unsigned long index)=0
 Removes a controller from the simulation. More...
 
virtual void setControllerAutoMode (unsigned long id, bool mode)=0
 Sets the mode of the controller with the given id. More...
 
virtual void setControllerIP (unsigned long id, const std::string &ip)=0
 Sets the IP of the controller with the given id. More...
 
virtual void setControllerPort (unsigned long id, int port)=0
 Sets the port of the controller with the given id. More...
 
virtual bool getControllerAutoMode (unsigned long id) const =0
 Gets the mode of the controller with the given id. More...
 
virtual const std::string getControllerIP (unsigned long id) const =0
 Gets the IP of the controller with the given id. More...
 
virtual int getControllerPort (unsigned long id) const =0
 Gets the port of the controller with the given id. More...
 
virtual void connectController (unsigned long id)=0
 Connects the controller with the given id. More...
 
virtual void disconnectController (unsigned long id)=0
 Disconnects the controller with the given id. More...
 
virtual void updateControllers (double calc_ms)=0
 This function updates all controllers with timing value calc_ms in miliseconds. More...
 
virtual void resetControllerData (void)=0
 Resets the data of all controllers. More...
 
virtual void clearAllControllers (void)=0
 Destroys all controllers in the simulation. More...
 
virtual void handleError (void)=0
 
virtual unsigned long addController (const ControllerData &controllerData)=0
 Add a controller to the simulation. More...
 
virtual void setDefaultPort (int port)=0
 Sets the default port, with which all controllers are created. More...
 
virtual int getDefaultPort (void) const =0
 Gets the default port, with which all controllers are created. More...
 
virtual bool isLoadingAllowed (void) const =0
 Checks weather adding new controllers is allowed. More...
 
virtual void setLoadingAllowed (bool allowed)=0
 Allows or forbids adding new controllers. More...
 
virtual std::list< sRealgetSensorValues (unsigned long id)=0
 

Detailed Description

"ControllerManagerInterface" declares the interfaces for all controller operations that are used for the communication between the simulation modules.

The class defines only pure virtual functions that are implemented within the simulation and can be used everywhere by accessing this interface via the ControlCenter class.

It is very important to assure the serialization between the threads to have the desired results. Currently the verified use of the functions is only guaranteed by calling it within the main thread (update callback from gui_thread).

Definition at line 61 of file ControllerManagerInterface.h.

Constructor & Destructor Documentation

◆ ~ControllerManagerInterface()

virtual mars::interfaces::ControllerManagerInterface::~ControllerManagerInterface ( )
inlinevirtual

Destructor.

Definition at line 67 of file ControllerManagerInterface.h.

Member Function Documentation

◆ addController()

virtual unsigned long mars::interfaces::ControllerManagerInterface::addController ( const ControllerData controllerData)
pure virtual

Add a controller to the simulation.

Returns
The id of the newly added controller.

Implemented in mars::sim::ControllerManager.

◆ clearAllControllers()

virtual void mars::interfaces::ControllerManagerInterface::clearAllControllers ( void  )
pure virtual

Destroys all controllers in the simulation.

Implemented in mars::sim::ControllerManager.

◆ connectController()

virtual void mars::interfaces::ControllerManagerInterface::connectController ( unsigned long  id)
pure virtual

Connects the controller with the given id.

Parameters
idThe id of the controller that is to be connected.

Implemented in mars::sim::ControllerManager.

◆ disconnectController()

virtual void mars::interfaces::ControllerManagerInterface::disconnectController ( unsigned long  id)
pure virtual

Disconnects the controller with the given id.

Parameters
idThe id of the controller that is to be disconnected.

Implemented in mars::sim::ControllerManager.

◆ getControllerAutoMode()

virtual bool mars::interfaces::ControllerManagerInterface::getControllerAutoMode ( unsigned long  id) const
pure virtual

Gets the mode of the controller with the given id.

Parameters
idThe id of the controller whose mode is needed.
Returns
The mode of the controller with the given id.

Implemented in mars::sim::ControllerManager.

◆ getControllerCount()

virtual int mars::interfaces::ControllerManagerInterface::getControllerCount ( void  ) const
pure virtual

Returns the number of controllers that are currently present in the simulation.

Returns
The number of all controllers.

Implemented in mars::sim::ControllerManager.

◆ getControllerIP()

virtual const std::string mars::interfaces::ControllerManagerInterface::getControllerIP ( unsigned long  id) const
pure virtual

Gets the IP of the controller with the given id.

Parameters
idThe id of the controller whose IP is needed.
Returns
The IP of the controller with the given id.

Implemented in mars::sim::ControllerManager.

◆ getControllerPort()

virtual int mars::interfaces::ControllerManagerInterface::getControllerPort ( unsigned long  id) const
pure virtual

Gets the port of the controller with the given id.

Parameters
idThe id of the controller whose port is needed.
Returns
The port of the controller with the given id.

Implemented in mars::sim::ControllerManager.

◆ getDefaultPort()

virtual int mars::interfaces::ControllerManagerInterface::getDefaultPort ( void  ) const
pure virtual

Gets the default port, with which all controllers are created.

Returns
The default port.

Implemented in mars::sim::ControllerManager.

◆ getFullController()

virtual const ControllerData mars::interfaces::ControllerManagerInterface::getFullController ( unsigned long  index) const
pure virtual

Gives all information of a certain controller.

Parameters
indexThe unique id of the controller to get information for.
Returns
A pointer to the ControllerData of the controller with the given id.

Implemented in mars::sim::ControllerManager.

◆ getListController()

virtual void mars::interfaces::ControllerManagerInterface::getListController ( std::vector< core_objects_exchange > *  controllerList) const
pure virtual

Gives information about core exchange data for controllers.

Parameters
controllerListA pointer to a vector that is filled with a core_objects_exchange struct for every controller. The vector is cleared in the beginning of this function.

Implemented in mars::sim::ControllerManager.

◆ getSensorValues()

virtual std::list<sReal> mars::interfaces::ControllerManagerInterface::getSensorValues ( unsigned long  id)
pure virtual

◆ handleError()

virtual void mars::interfaces::ControllerManagerInterface::handleError ( void  )
pure virtual

◆ isLoadingAllowed()

virtual bool mars::interfaces::ControllerManagerInterface::isLoadingAllowed ( void  ) const
pure virtual

Checks weather adding new controllers is allowed.

Returns
true if allowed, false otherwise.

Implemented in mars::sim::ControllerManager.

◆ removeController()

virtual void mars::interfaces::ControllerManagerInterface::removeController ( unsigned long  index)
pure virtual

Removes a controller from the simulation.

Parameters
indexThe unique id of the controller to remove form the simulation.

Implemented in mars::sim::ControllerManager.

◆ resetControllerData()

virtual void mars::interfaces::ControllerManagerInterface::resetControllerData ( void  )
pure virtual

Resets the data of all controllers.

Implemented in mars::sim::ControllerManager.

◆ setControllerAutoMode()

virtual void mars::interfaces::ControllerManagerInterface::setControllerAutoMode ( unsigned long  id,
bool  mode 
)
pure virtual

Sets the mode of the controller with the given id.

Parameters
idThe id of the controller whose mode is to be set.
modeThe new mode.

Implemented in mars::sim::ControllerManager.

◆ setControllerIP()

virtual void mars::interfaces::ControllerManagerInterface::setControllerIP ( unsigned long  id,
const std::string &  ip 
)
pure virtual

Sets the IP of the controller with the given id.

Parameters
idThe id of the controller whose IP is to be set.
ipThe new IP.

Implemented in mars::sim::ControllerManager.

◆ setControllerPort()

virtual void mars::interfaces::ControllerManagerInterface::setControllerPort ( unsigned long  id,
int  port 
)
pure virtual

Sets the port of the controller with the given id.

Parameters
idThe id of the controller whose port is to be set.
modeThe new port.

Implemented in mars::sim::ControllerManager.

◆ setDefaultPort()

virtual void mars::interfaces::ControllerManagerInterface::setDefaultPort ( int  port)
pure virtual

Sets the default port, with which all controllers are created.

Parameters
portThe default port.

Implemented in mars::sim::ControllerManager.

◆ setLoadingAllowed()

virtual void mars::interfaces::ControllerManagerInterface::setLoadingAllowed ( bool  allowed)
pure virtual

Allows or forbids adding new controllers.

Parameters
allowedIndicates if adding will be allowed or not.

Implemented in mars::sim::ControllerManager.

◆ updateControllers()

virtual void mars::interfaces::ControllerManagerInterface::updateControllers ( double  calc_ms)
pure virtual

This function updates all controllers with timing value calc_ms in miliseconds.

Warning
This function is only used internally and should not be called outside the core.
Parameters
calc_msThe timing value in miliseconds.

Implemented in mars::sim::ControllerManager.


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