InputEventReader
The `InputEventReader` component in SOFA reads input events from a specified file (e.g., `/dev/input/eventX`) and propagates them as SOFA MouseEvents within the simulation framework. It is part of the Sofa.Component.Playback module and inherits from `BaseObject`. This component allows for the integration of external mouse or pedal inputs into simulations, enhancing interactivity and control over the simulation environment. ### Interactions with Other Components - **Propagation of Events**: The `InputEventReader` interacts with other SOFA components by propagating MouseEvents and Keypress/Keyrelease events through the scene graph. These events can influence various aspects of the simulation such as object movements or user interactions. - **Initialization**: It utilizes the `init()` method to set up file streams for reading from an input file, if specified. ### Practical Usage Guidance - **Data Fields**: - `inverseSense`: Inverts the sense of movement (default: false). - `printEvent`: Prints event information during runtime (default: false). - `key1` and `key2`: Define key events for left and right pedal actions, respectively (defaults: '0' and '1'). - `writeEvents`: Determines whether to write incoming events to a file or read from it (default: false). The filename can be specified through the `outputFilename` data field. - **Usage**: This component is particularly useful for scenarios requiring external device input integration, such as haptic feedback devices or custom control interfaces.
- abstract
- The `InputEventReader` reads input events from a specified file (e.g., `/dev/input/eventX`) and propagates them as SOFA MouseEvents within the simulation framework.
- sheet
- # InputEventReader ## Overview The `InputEventReader` component in SOFA reads input events from an external file, such as `/dev/input/eventX`, and converts these events into SOFA MouseEvents. This allows for integration of external device inputs into simulations, enhancing interactivity. ## Parameters and Data - **inverseSense**: Inverts the sense of movement (default: false). - **printEvent**: Prints event information during runtime (default: false). - **key1**: Key event generated when the left pedal is pressed (default: '0'). - **key2**: Key event generated when the right pedal is pressed (default: '1'). - **writeEvents**: Determines whether to write incoming events to a file or read from it (default: false). If writing is enabled, the output filename can be specified through `outputFilename`. ## Practical Notes The component is particularly useful for scenarios requiring external device input integration, such as haptic feedback devices or custom control interfaces. Ensure that the input file path is correctly set and that the simulation environment has appropriate permissions to read from it.
- description
- The `InputEventReader` component in SOFA reads input events from a specified file (e.g., `/dev/input/eventX`) and propagates them as SOFA MouseEvents within the simulation framework. It is part of the Sofa.Component.Playback module and inherits from `BaseObject`. This component allows for the integration of external mouse or pedal inputs into simulations, enhancing interactivity and control over the simulation environment. ### Interactions with Other Components - **Propagation of Events**: The `InputEventReader` interacts with other SOFA components by propagating MouseEvents and Keypress/Keyrelease events through the scene graph. These events can influence various aspects of the simulation such as object movements or user interactions. - **Initialization**: It utilizes the `init()` method to set up file streams for reading from an input file, if specified. ### Practical Usage Guidance - **Data Fields**: - `inverseSense`: Inverts the sense of movement (default: false). - `printEvent`: Prints event information during runtime (default: false). - `key1` and `key2`: Define key events for left and right pedal actions, respectively (defaults: '0' and '1'). - `writeEvents`: Determines whether to write incoming events to a file or read from it (default: false). The filename can be specified through the `outputFilename` data field. - **Usage**: This component is particularly useful for scenarios requiring external device input integration, such as haptic feedback devices or custom control interfaces.
- maths
- The `InputEventReader` component in the SOFA framework is primarily responsible for reading input events from an external file (e.g., `/dev/input/eventX`) and propagating them as `MouseEvent`, `KeypressedEvent`, or `KeyreleasedEvent` within the simulation environment. This component does not directly contribute to any governing equations, constitutive laws, or numerical discretization methods associated with finite element simulations. Instead, its role is limited to the handling of external input events and their conversion into appropriate SOFA event types for interaction with other components in the scene graph. ### Mathematical and Physical Description 1. **Governing Equations**: - The `InputEventReader` component does not implement or contribute to any governing equations related to mechanics, continuum physics, or numerical integration schemes. 2. **Constitutive Laws**: - This component is not involved in the definition of material constitutive laws such as stress-strain relationships or hyperelastic potentials. 3. **Kinematic and Constraint Handling**: - While it does not define any kinematic constraints, the component interacts with other components by propagating events that can influence the simulation state indirectly through interactions (e.g., moving objects via mouse input). 4. **Role in Global FEM Pipeline**: - The `InputEventReader` operates outside the core FEM pipeline but provides external inputs necessary for interactive simulations. - It reads events and converts them into SOFA-specific event types (`MouseEvent`, `KeypressedEvent`, or `KeyreleasedEvent`) that can be processed by other components within the simulation framework. 5. **Numerical Methods**: - The component does not involve any numerical discretization methods such as FEM spatial discretization, time integration schemes, or iterative solvers. 6. **Integration into Variational / Lagrangian Mechanics Framework**: - This component is orthogonal to the variational and Lagrangian mechanics framework since it solely handles event propagation rather than contributing to the formulation of mechanical systems or their numerical simulation. ### Data Fields - `inverseSense`: A boolean flag that inverts the sense of movement (default: false). - `printEvent`: A boolean flag for printing event information during runtime (default: false). - `key1` and `key2`: Characters representing key events generated when left or right pedals are pressed, respectively (defaults: '0' and '1'). - `writeEvents`: Determines whether to write incoming events to a file or read from it (default: false). If writing is enabled, the output filename can be specified through `outputFilename`. ### Practical Usage The component allows for integration of external device inputs into simulations, enhancing interactivity and control over the simulation environment. It reads input events from a specified file and converts them into SOFA event types to influence various aspects of the simulation such as object movements or user interactions.
{
"name": "InputEventReader",
"main": {
"name": "InputEventReader",
"namespace": "sofa::component::playback",
"module": "Sofa.Component.Playback",
"include": "sofa/component/playback/InputEventReader.h",
"doc": "Read events from file.\n\nInputEventReader Class\nReads mouse Linux events from file /dev/input/eventX and propagate them as SOFA MouseEvents.",
"inherits": [
"BaseObject"
],
"templates": [],
"data_fields": [
{
"name": "d_inverseSense",
"type": "bool",
"xmlname": "inverseSense",
"help": "inverse the sense of the movement"
},
{
"name": "d_printEvent",
"type": "bool",
"xmlname": "printEvent",
"help": "Print event information"
},
{
"name": "d_key1",
"type": "char",
"xmlname": "key1",
"help": "Key event generated when the left pedal is pressed"
},
{
"name": "d_key2",
"type": "char",
"xmlname": "key2",
"help": "Key event generated when the right pedal is pressed"
},
{
"name": "d_writeEvents",
"type": "bool",
"xmlname": "writeEvents",
"help": "If true, write incoming events ; if false, read events from that file (if an output filename is provided)"
}
],
"links": [],
"methods": [
{
"name": "init",
"return_type": "void",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "handleEvent",
"return_type": "void",
"params": [
{
"name": "event",
"type": "core::objectmodel::Event *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
}
]
},
"desc": {
"description": "The `InputEventReader` component in SOFA reads input events from a specified file (e.g., `/dev/input/eventX`) and propagates them as SOFA MouseEvents within the simulation framework. It is part of the Sofa.Component.Playback module and inherits from `BaseObject`. This component allows for the integration of external mouse or pedal inputs into simulations, enhancing interactivity and control over the simulation environment.\n\n### Interactions with Other Components\n- **Propagation of Events**: The `InputEventReader` interacts with other SOFA components by propagating MouseEvents and Keypress/Keyrelease events through the scene graph. These events can influence various aspects of the simulation such as object movements or user interactions.\n- **Initialization**: It utilizes the `init()` method to set up file streams for reading from an input file, if specified.\n\n### Practical Usage Guidance\n- **Data Fields**:\n - `inverseSense`: Inverts the sense of movement (default: false).\n - `printEvent`: Prints event information during runtime (default: false).\n - `key1` and `key2`: Define key events for left and right pedal actions, respectively (defaults: '0' and '1').\n - `writeEvents`: Determines whether to write incoming events to a file or read from it (default: false). The filename can be specified through the `outputFilename` data field.\n\n- **Usage**: This component is particularly useful for scenarios requiring external device input integration, such as haptic feedback devices or custom control interfaces."
},
"maths": {
"maths": "The `InputEventReader` component in the SOFA framework is primarily responsible for reading input events from an external file (e.g., `/dev/input/eventX`) and propagating them as `MouseEvent`, `KeypressedEvent`, or `KeyreleasedEvent` within the simulation environment. This component does not directly contribute to any governing equations, constitutive laws, or numerical discretization methods associated with finite element simulations. Instead, its role is limited to the handling of external input events and their conversion into appropriate SOFA event types for interaction with other components in the scene graph.\n\n### Mathematical and Physical Description\n\n1. **Governing Equations**:\n - The `InputEventReader` component does not implement or contribute to any governing equations related to mechanics, continuum physics, or numerical integration schemes.\n \n2. **Constitutive Laws**:\n - This component is not involved in the definition of material constitutive laws such as stress-strain relationships or hyperelastic potentials.\n\n3. **Kinematic and Constraint Handling**:\n - While it does not define any kinematic constraints, the component interacts with other components by propagating events that can influence the simulation state indirectly through interactions (e.g., moving objects via mouse input).\n\n4. **Role in Global FEM Pipeline**:\n - The `InputEventReader` operates outside the core FEM pipeline but provides external inputs necessary for interactive simulations.\n - It reads events and converts them into SOFA-specific event types (`MouseEvent`, `KeypressedEvent`, or `KeyreleasedEvent`) that can be processed by other components within the simulation framework.\n\n5. **Numerical Methods**:\n - The component does not involve any numerical discretization methods such as FEM spatial discretization, time integration schemes, or iterative solvers.\n\n6. **Integration into Variational / Lagrangian Mechanics Framework**:\n - This component is orthogonal to the variational and Lagrangian mechanics framework since it solely handles event propagation rather than contributing to the formulation of mechanical systems or their numerical simulation.\n\n### Data Fields\n- `inverseSense`: A boolean flag that inverts the sense of movement (default: false).\n- `printEvent`: A boolean flag for printing event information during runtime (default: false).\n- `key1` and `key2`: Characters representing key events generated when left or right pedals are pressed, respectively (defaults: '0' and '1').\n- `writeEvents`: Determines whether to write incoming events to a file or read from it (default: false). If writing is enabled, the output filename can be specified through `outputFilename`.\n\n### Practical Usage\nThe component allows for integration of external device inputs into simulations, enhancing interactivity and control over the simulation environment. It reads input events from a specified file and converts them into SOFA event types to influence various aspects of the simulation such as object movements or user interactions."
},
"summary": {
"abstract": "The `InputEventReader` reads input events from a specified file (e.g., `/dev/input/eventX`) and propagates them as SOFA MouseEvents within the simulation framework.",
"sheet": "# InputEventReader\n\n## Overview\n\nThe `InputEventReader` component in SOFA reads input events from an external file, such as `/dev/input/eventX`, and converts these events into SOFA MouseEvents. This allows for integration of external device inputs into simulations, enhancing interactivity.\n\n## Parameters and Data\n\n- **inverseSense**: Inverts the sense of movement (default: false).\n- **printEvent**: Prints event information during runtime (default: false).\n- **key1**: Key event generated when the left pedal is pressed (default: '0').\n- **key2**: Key event generated when the right pedal is pressed (default: '1').\n- **writeEvents**: Determines whether to write incoming events to a file or read from it (default: false). If writing is enabled, the output filename can be specified through `outputFilename`.\n\n## Practical Notes\n\nThe component is particularly useful for scenarios requiring external device input integration, such as haptic feedback devices or custom control interfaces. Ensure that the input file path is correctly set and that the simulation environment has appropriate permissions to read from it."
}
}