Class ControllerHandler

Nested Relationships

Nested Types

Class Documentation

class ControllerHandler

This class is responsible for tracking the active controllers and on control mode change offer the controllers name that need to be activated and deactivated. The following three public function has to be called in the following order:

Public Functions

explicit ControllerHandler(std::vector<std::string> fixed_controllers = {})

Construct a new control mode handler object.

Parameters:

fixed_controllers – Controllers that have to be active in all control modes

~ControllerHandler() = default

Destroy the control mode handler object.

bool UpdateControllerName(const ControllerType controller_type, const std::string &controller_name)

Updates the controllers’ name for a specific controller type.

Parameters:
  • controller_type – The type of the controller which will be updated.

  • controller_name – The new controller’s name. From now on this controller will be activated on controller activation.

Returns:

True, if update was successful.

Returns:

False, if update failed.

std::pair<std::vector<std::string>, std::vector<std::string>> GetControllersForSwitch(ControlMode new_control_mode)

Calculates the controllers that have to be activated and deactivated for the control mode change.

Parameters:

new_control_mode – The new control mode. It is based on Controller_handler::control_mode enum.

Throws:

std::out_of_range – new_control_mode attribute is invalid

Returns:

std::pair<std::vector<std::string>, std::vector<std::string>>: Two vectors, first has the controllers to activate, second has the controllers to deactivate

std::vector<std::string> GetControllersForDeactivation()

Returns all controllers that has active state (used for driver deactivation)

Returns:

std::vector<std::string>: Vector that contains controllers for deactivation

void ApproveControllerActivation()

Approves that the controller activation was successful.

bool ApproveControllerDeactivation()

Approves that the controller deactivation was successful.

std::vector<std::string> GetControllersForMode(ControlMode control_mode)