Controller
The `Controller` class in the SOFA framework serves as an interface for user interaction with SOFA components, including handling various types of events such as mouse, keyboard, joystick, and haptic device inputs. It also provides hooks for animation events that occur at the beginning (`onBeginAnimationStep`) and end (`onEndAnimationStep`) of each time step. The `Controller` interacts with other SOFA components through event-driven methods, allowing customization of behavior based on user input or simulation state changes. Key interactions include handling mouse events, keyboard presses and releases, joystick inputs, haptic device feedback, and GUI events. Practical usage involves inheriting from the `Controller` class to implement custom behaviors for specific interaction events. The `d_handleEventTriggersUpdate` data field controls how frequently event handling triggers updates in the controller.
- abstract
- The `Controller` class in SOFA facilitates user interaction by handling various event types (mouse, keyboard, joystick, haptic device) and providing hooks for animation events at the beginning and end of each time step.
- sheet
- # Controller **Overview** The `Controller` class serves as an interface for user interaction within the SOFA simulation environment. It handles different event types such as mouse, keyboard, joystick, and haptic device inputs, and provides hooks (`onBeginAnimationStep`, `onEndAnimationStep`) for custom behavior at the beginning and end of each time step. **Parameters and Data** - **d_handleEventTriggersUpdate**: Controls how frequently event handling triggers updates in the controller. This field is crucial for ensuring that interactions with the user are synchronized appropriately with the simulation loop.
- description
- The `Controller` class in the SOFA framework serves as an interface for user interaction with SOFA components, including handling various types of events such as mouse, keyboard, joystick, and haptic device inputs. It also provides hooks for animation events that occur at the beginning (`onBeginAnimationStep`) and end (`onEndAnimationStep`) of each time step. The `Controller` interacts with other SOFA components through event-driven methods, allowing customization of behavior based on user input or simulation state changes. Key interactions include handling mouse events, keyboard presses and releases, joystick inputs, haptic device feedback, and GUI events. Practical usage involves inheriting from the `Controller` class to implement custom behaviors for specific interaction events. The `d_handleEventTriggersUpdate` data field controls how frequently event handling triggers updates in the controller.
- maths
- The `Controller` class in the SOFA framework serves as an interface for user interaction with various components within the simulation environment. It is designed to handle different types of events, including mouse, keyboard, joystick, and haptic device inputs, which are essential for interactive simulations. The primary role of this class is not directly related to mathematical or physical models but rather to facilitate real-time control and feedback mechanisms during the simulation. ### Key Features: 1. **Event Handling:** - **Mouse Events:** Captures mouse movements and clicks through `onMouseEvent` method. - **Keyboard Events:** Handles key presses (`onKeyPressedEvent`) and releases (`onKeyReleasedEvent`). - **Joystick Inputs:** Manages joystick events via `onJoystickEvent` method. - **Haptic Device Feedback:** Interacts with haptic devices through `onHapticDeviceEvent` method. - **GUI Events:** Captures general GUI interactions using `onGUIEvent` method. 2. **Animation Hooks:* - Provides hooks for events that occur at the beginning (`onBeginAnimationStep`) and end (`onEndAnimationStep`) of each time step, which can be used to customize behavior based on simulation state changes. 3. **Data Fields:** - `d_handleEventTriggersUpdate`: Controls how frequently event handling triggers updates in the controller. This field is crucial for ensuring that interactions with the user are synchronized appropriately with the simulation loop. ### Interaction Mechanism: - The `handleEvent` method acts as a central dispatcher, which routes different types of events to their respective handler methods based on the type of event received. ### Customization and Integration: - To implement custom behaviors for specific interaction events, users typically inherit from the `Controller` class and override the necessary methods (e.g., `onMouseEvent`, `onKeyPressedEvent`). This allows for extensive customization without modifying core SOFA components. ### Example Usage: ```cpp void MyCustomController::onKeyPressedEvent(core::objectmodel::KeypressedEvent *event) { // Custom behavior when a key is pressed } ``` This example demonstrates how to customize the response to keyboard events in a derived controller class. Similarly, other event methods can be overridden for custom behaviors. ### Conclusion: Although the `Controller` does not directly participate in mathematical or physical models, it plays a vital role in interactive simulations by enabling real-time user interaction and control.
{
"name": "Controller",
"main": {
"name": "Controller",
"namespace": "sofa::component::controller",
"module": "Sofa.Component.Controller",
"include": "sofa/component/controller/Controller.h",
"doc": "Controller Class.\nInterface of user interaction on SOFA Components.\nProvides also an interface for BeginAnimation and EndAnimation events\nlaunched at the beginning and the end of a time step.",
"inherits": [],
"templates": [],
"data_fields": [
{
"name": "d_handleEventTriggersUpdate",
"type": "bool",
"xmlname": "handleEventTriggersUpdate",
"help": "Event handling frequency controls the controller update frequency"
}
],
"links": [],
"methods": [
{
"name": "onMouseEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::MouseEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onHapticDeviceEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::HapticDeviceEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onKeyPressedEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::KeypressedEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onKeyReleasedEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::KeyreleasedEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onJoystickEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::JoystickEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onBeginAnimationStep",
"return_type": "void",
"params": [
{
"name": "",
"type": "const double"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onEndAnimationStep",
"return_type": "void",
"params": [
{
"name": "",
"type": "const double"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "onGUIEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::GUIEvent *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "handleEvent",
"return_type": "void",
"params": [
{
"name": "",
"type": "core::objectmodel::Event *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `Controller` class in the SOFA framework serves as an interface for user interaction with SOFA components, including handling various types of events such as mouse, keyboard, joystick, and haptic device inputs. It also provides hooks for animation events that occur at the beginning (`onBeginAnimationStep`) and end (`onEndAnimationStep`) of each time step.\n\nThe `Controller` interacts with other SOFA components through event-driven methods, allowing customization of behavior based on user input or simulation state changes. Key interactions include handling mouse events, keyboard presses and releases, joystick inputs, haptic device feedback, and GUI events.\n\nPractical usage involves inheriting from the `Controller` class to implement custom behaviors for specific interaction events. The `d_handleEventTriggersUpdate` data field controls how frequently event handling triggers updates in the controller."
},
"maths": {
"maths": "The `Controller` class in the SOFA framework serves as an interface for user interaction with various components within the simulation environment. It is designed to handle different types of events, including mouse, keyboard, joystick, and haptic device inputs, which are essential for interactive simulations. The primary role of this class is not directly related to mathematical or physical models but rather to facilitate real-time control and feedback mechanisms during the simulation.\n\n### Key Features:\n1. **Event Handling:**\n - **Mouse Events:** Captures mouse movements and clicks through `onMouseEvent` method.\n - **Keyboard Events:** Handles key presses (`onKeyPressedEvent`) and releases (`onKeyReleasedEvent`).\n - **Joystick Inputs:** Manages joystick events via `onJoystickEvent` method.\n - **Haptic Device Feedback:** Interacts with haptic devices through `onHapticDeviceEvent` method.\n - **GUI Events:** Captures general GUI interactions using `onGUIEvent` method.\n\n2. **Animation Hooks:*\n - Provides hooks for events that occur at the beginning (`onBeginAnimationStep`) and end (`onEndAnimationStep`) of each time step, which can be used to customize behavior based on simulation state changes.\n\n3. **Data Fields:**\n - `d_handleEventTriggersUpdate`: Controls how frequently event handling triggers updates in the controller. This field is crucial for ensuring that interactions with the user are synchronized appropriately with the simulation loop.\n\n### Interaction Mechanism:\n- The `handleEvent` method acts as a central dispatcher, which routes different types of events to their respective handler methods based on the type of event received.\n\n### Customization and Integration:\n- To implement custom behaviors for specific interaction events, users typically inherit from the `Controller` class and override the necessary methods (e.g., `onMouseEvent`, `onKeyPressedEvent`). This allows for extensive customization without modifying core SOFA components.\n\n### Example Usage:\n```cpp\nvoid MyCustomController::onKeyPressedEvent(core::objectmodel::KeypressedEvent *event)\n{\n // Custom behavior when a key is pressed\n}\n```\n\nThis example demonstrates how to customize the response to keyboard events in a derived controller class. Similarly, other event methods can be overridden for custom behaviors.\n\n### Conclusion:\nAlthough the `Controller` does not directly participate in mathematical or physical models, it plays a vital role in interactive simulations by enabling real-time user interaction and control."
},
"summary": {
"abstract": "The `Controller` class in SOFA facilitates user interaction by handling various event types (mouse, keyboard, joystick, haptic device) and providing hooks for animation events at the beginning and end of each time step.",
"sheet": "# Controller\n\n**Overview**\n\nThe `Controller` class serves as an interface for user interaction within the SOFA simulation environment. It handles different event types such as mouse, keyboard, joystick, and haptic device inputs, and provides hooks (`onBeginAnimationStep`, `onEndAnimationStep`) for custom behavior at the beginning and end of each time step.\n\n**Parameters and Data**\n\n- **d_handleEventTriggersUpdate**: Controls how frequently event handling triggers updates in the controller. This field is crucial for ensuring that interactions with the user are synchronized appropriately with the simulation loop."
}
}