![]() |
An open-source, flexible 3D physical simulation framework
|
"ControllerManager" imlements the interfaces for all controller operations that are used for the communication between the simulation modules. More...
#include <ControllerManager.h>
Public Member Functions | |
ControllerManager (interfaces::ControlCenter *c) | |
Constructor. More... | |
virtual | ~ControllerManager () |
Destructor. More... | |
virtual void | getListController (std::vector< interfaces::core_objects_exchange > *controllerList) const |
Gives information about core exchange data for controllers. More... | |
virtual int | getControllerCount (void) const |
Returns the number of controllers that are currently present in the simulation. More... | |
virtual const interfaces::ControllerData | getFullController (unsigned long index) const |
Gives all information of a certain controller. More... | |
virtual void | removeController (unsigned long index) |
Removes a controller from the simulation. More... | |
virtual void | setControllerAutoMode (unsigned long id, bool mode) |
Sets the mode of the controller with the given id. More... | |
virtual void | setControllerIP (unsigned long id, const std::string &ip) |
Sets the IP of the controller with the given id. More... | |
virtual void | setControllerPort (unsigned long id, int port) |
Gets the mode of the controller with the given id. More... | |
virtual bool | getControllerAutoMode (unsigned long id) const |
Gets the mode of the controller with the given id. More... | |
virtual const std::string | getControllerIP (unsigned long id) const |
Gets the IP of the controller with the given id. More... | |
virtual int | getControllerPort (unsigned long id) const |
Gets the port of the controller with the given id. More... | |
virtual void | connectController (unsigned long id) |
Connects the controller with the given id. More... | |
virtual void | disconnectController (unsigned long id) |
Disconnects the controller with the given id. More... | |
virtual void | updateControllers (interfaces::sReal calc_ms) |
This function updates all controllers with timing value calc_ms in miliseconds. More... | |
virtual void | resetControllerData (void) |
Resets the data of all controllers. More... | |
virtual void | clearAllControllers (void) |
Destroys all controllers in the simulation. More... | |
virtual void | handleError (void) |
virtual unsigned long | addController (const interfaces::ControllerData &controller) |
Add a controller to the simulation. More... | |
virtual void | setDefaultPort (int port) |
Sets the default port, with which all controllers are created. More... | |
virtual int | getDefaultPort (void) const |
Gets the default port, with which all controllers are created. More... | |
virtual bool | isLoadingAllowed (void) const |
Checks weather adding new controllers is allowed. More... | |
virtual void | setLoadingAllowed (bool allowed) |
Allows or forbids adding new controllers. More... | |
virtual std::list< interfaces::sReal > | getSensorValues (unsigned long id) |
![]() | |
virtual | ~ControllerManagerInterface () |
Destructor. More... | |
Private Attributes | |
bool | do_not_load_controller |
a flag indicating if adding new controllers is allowed More... | |
int | std_port |
the default port passed to every newly added controller More... | |
unsigned long | next_controller_id |
the id of the next controller added to the simulation More... | |
std::map< unsigned long, Controller * > | simController |
a containter holding all controllers in the simulation More... | |
interfaces::ControlCenter * | control |
a pointer to the control center More... | |
utils::Mutex | iMutex |
a mutex for the controllers containter More... | |
"ControllerManager" imlements the interfaces for all controller operations that are used for the communication between the simulation modules.
Inherits from ControllerManagerInterface.
gui_thread
). Definition at line 60 of file ControllerManager.h.
mars::sim::ControllerManager::ControllerManager | ( | interfaces::ControlCenter * | c | ) |
Constructor.
c | The pointer to the ControlCenter of the simulation. |
Definition at line 55 of file ControllerManager.cpp.
|
inlinevirtual |
Destructor.
Definition at line 73 of file ControllerManager.h.
|
virtual |
Add a controller to the simulation.
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 321 of file ControllerManager.cpp.
|
virtual |
Destroys all controllers in the simulation.
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 287 of file ControllerManager.cpp.
|
virtual |
Connects the controller with the given id.
id | The id of the controller that is to be connected. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 235 of file ControllerManager.cpp.
|
virtual |
Disconnects the controller with the given id.
id | The id of the controller that is to be disconnected. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 248 of file ControllerManager.cpp.
|
virtual |
Gets the mode of the controller with the given id.
id | The id of the controller whose mode is needed. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 183 of file ControllerManager.cpp.
|
virtual |
Returns the number of controllers that are currently present in the simulation.
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 88 of file ControllerManager.cpp.
|
virtual |
Gets the IP of the controller with the given id.
id | The id of the controller whose IP is needed. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 199 of file ControllerManager.cpp.
|
virtual |
Gets the port of the controller with the given id.
id | The id of the controller whose port is needed. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 219 of file ControllerManager.cpp.
|
virtual |
Gets the default port, with which all controllers are created.
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 365 of file ControllerManager.cpp.
|
virtual |
Gives all information of a certain controller.
index | The unique id of the controller to get information for. |
std::runtime_error | if the controller cannot be found |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 102 of file ControllerManager.cpp.
|
virtual |
Gives information about core exchange data for controllers.
controllerList | A 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. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 70 of file ControllerManager.cpp.
|
virtual |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 396 of file ControllerManager.cpp.
|
virtual |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 306 of file ControllerManager.cpp.
|
virtual |
Checks weather adding new controllers is allowed.
true
if allowed, false
otherwise. Implements mars::interfaces::ControllerManagerInterface.
Definition at line 383 of file ControllerManager.cpp.
|
virtual |
Removes a controller from the simulation.
index | The unique id of the controller to remove form the simulation. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 120 of file ControllerManager.cpp.
|
virtual |
Resets the data of all controllers.
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 275 of file ControllerManager.cpp.
|
virtual |
Sets the mode of the controller with the given id.
id | The id of the controller whose mode is to be set. |
mode | The new mode. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 142 of file ControllerManager.cpp.
|
virtual |
Sets the IP of the controller with the given id.
id | The id of the controller whose IP is to be set. |
ip | The new IP. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 157 of file ControllerManager.cpp.
|
virtual |
Gets the mode of the controller with the given id.
id | The id of the controller whose mode is needed. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 167 of file ControllerManager.cpp.
|
virtual |
Sets the default port, with which all controllers are created.
port | The default port. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 374 of file ControllerManager.cpp.
|
virtual |
Allows or forbids adding new controllers.
allowed | Indicates if adding will be allowed or not. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 392 of file ControllerManager.cpp.
|
virtual |
This function updates all controllers with timing value calc_ms
in miliseconds.
calc_ms | The timing value in miliseconds. |
Implements mars::interfaces::ControllerManagerInterface.
Definition at line 263 of file ControllerManager.cpp.
|
private |
a pointer to the control center
Definition at line 253 of file ControllerManager.h.
|
private |
a flag indicating if adding new controllers is allowed
Definition at line 241 of file ControllerManager.h.
|
mutableprivate |
a mutex for the controllers containter
Definition at line 256 of file ControllerManager.h.
|
private |
the id of the next controller added to the simulation
Definition at line 247 of file ControllerManager.h.
|
private |
a containter holding all controllers in the simulation
Definition at line 250 of file ControllerManager.h.
|
private |
the default port passed to every newly added controller
Definition at line 244 of file ControllerManager.h.