Back

JoystickEvent

sofa::core::objectmodel::JoystickEvent
Event
Doc (from source)

JoystickEvent Class

Abstract (AI generated)

`JoystickEvent` manages events from joystick axes, buttons, and directional hats, facilitating input handling within the SOFA simulation framework.

Metadata
module
Sofa.framework.Core
namespace
sofa::core::objectmodel
include
sofa/core/objectmodel/JoystickEvent.h
inherits
  • Event
No description data.

The JoystickEvent class in the SOFA framework does not contribute to any mathematical or physical models directly related to computational mechanics, variational principles, or finite element methods. Instead, it serves as an event handling mechanism for input devices such as joysticks. It is responsible for managing and reporting changes in the state of joystick axes, buttons, and directional hats.

Mathematical and Physical Description:

  1. Governing Equations / Operators
  2. The JoystickEvent does not implement any governing equations or operators typically associated with FEM simulations such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, residual $R$, etc.

  3. Constitutive or Kinematic Laws Involved

  4. There are no constitutive laws (e.g., strain measures, stress tensors, hyperelastic potentials) or kinematic laws involved in the JoystickEvent. It is purely an input event handler and does not deal with material properties or mechanical behavior.

  5. Role in FEM Pipeline

  6. The JoystickEvent does not have a role in the global FEM pipeline (assembly, time integration, nonlinear solve, linear solve, constraint handling, mapping) as it is not related to any numerical simulation process.

  7. Numerical Methods or Discretization Choices

  8. Since this component deals with joystick events, there are no discretization choices or numerical methods involved in its operation.

  9. Variational / Lagrangian Mechanics Framework

  10. The JoystickEvent is not part of the variational or Lagrangian mechanics framework as it is an event handling mechanism and does not contribute to the physical simulation process.

Summary:

The JoystickEvent class serves purely for input management in the SOFA framework. It handles events related to joystick axes, buttons, and directional hats but does not play any role in mathematical or physical simulations such as those performed using FEM techniques.

Methods
int getEventTypeIndex ()
bool checkEventType (const Event * event)
const AxisEvent * getAxisEvent (const int )
const int & getAxisEvents ()
unsigned int getAxisEventsSize ()
void addAxisEvent (AxisEvent * )
ButtonEvent * getButtonEvent ()
bool getButton (unsigned int )
void setButtonEvent (ButtonEvent * )
const HatEvent * getHatEvent (const int )
const int & getHatEvents ()
unsigned int getHatEventsSize ()
void addHatEvent (HatEvent * )
const char * GetClassName ()
{
  "name": "JoystickEvent",
  "namespace": "sofa::core::objectmodel",
  "module": "Sofa.framework.Core",
  "include": "sofa/core/objectmodel/JoystickEvent.h",
  "doc": "JoystickEvent Class",
  "inherits": [
    "Event"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "getEventTypeIndex",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "checkEventType",
      "return_type": "bool",
      "params": [
        {
          "name": "event",
          "type": "const Event *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "getAxisEvent",
      "return_type": "const AxisEvent *",
      "params": [
        {
          "name": "",
          "type": "const int"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getAxisEvents",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getAxisEventsSize",
      "return_type": "unsigned int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addAxisEvent",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "AxisEvent *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getButtonEvent",
      "return_type": "ButtonEvent *",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getButton",
      "return_type": "bool",
      "params": [
        {
          "name": "",
          "type": "unsigned int"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "setButtonEvent",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "ButtonEvent *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHatEvent",
      "return_type": "const HatEvent *",
      "params": [
        {
          "name": "",
          "type": "const int"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHatEvents",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getHatEventsSize",
      "return_type": "unsigned int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "addHatEvent",
      "return_type": "void",
      "params": [
        {
          "name": "",
          "type": "HatEvent *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "GetClassName",
      "return_type": "const char *",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    }
  ],
  "component_description": "The JoystickEvent class is part of the SOFA (Simulation Open-Framework Architecture) framework and is designed to handle events generated by joystick inputs. This class extends the functionality of event handling in simulations or applications that use joysticks as input devices, allowing for a structured approach to manage axis movements, button presses, and directional hat changes.\n\n### Key Components:\n- **AxisEvent**: Represents the state of an analog joystick axis. Each AxisEvent contains an index (identifying which axis it is) and a value ranging from -1 to 1, representing the position of the axis.\n- **ButtonEvent**: Captures the state of the buttons on a joystick. It supports up to 32 buttons with a bitmask for their states.\n- **HatEvent**: Represents changes in the directional hat (a small device that can be moved in several directions). Each HatEvent includes an index and a defined state, indicating its orientation (e.g., UP, RIGHT, DOWN, LEFT).\n\n### Functionality:\n1. **Axis Event Management**:\n   - `getAxisEvent(index)`: Retrieves the AxisEvent corresponding to a given axis index.\n   - `getAxisEvents()`: Provides access to all AxisEvent instances in a vector.\n   - `addAxisEvent(event)`: Adds a new AxisEvent instance to the collection of events managed by JoystickEvent.\n\n2. **Button Event Management**:\n   - `getButtonEvent()`: Retrieves the ButtonEvent representing the state of the joystick buttons.\n   - `setButtonEvent(event)`: Sets the ButtonEvent instance that will manage button states.\n   - `getButton(index)`: Checks if a specific button is pressed, given its index.\n\n3. **Hat Event Management**:\n   - `getHatEvent(index)`: Retrieves the HatEvent corresponding to a given hat index.\n   - `getHatEvents()`: Provides access to all HatEvent instances in a vector.\n   - `addHatEvent(event)`: Adds a new HatEvent instance to the collection of events managed by JoystickEvent.\n\n4. **General Management**:\n   - Constructor and Destructor: Properly initialize and clean up resources associated with AxisEvents, ButtonEvents, and HatEvents.\n   - `GetClassName()`: Returns the name 'JoystickEvent' for identification purposes.\n\n### Usage Scenarios:\n- Simulations requiring precise joystick input handling.\n- Game development where joystick inputs need to be mapped accurately.\n- Robotics projects that interface with joysticks for control purposes.\n\nOverall, JoystickEvent provides a comprehensive mechanism for managing various aspects of joystick interaction within applications built on the SOFA framework.",
  "maths": "The `JoystickEvent` class in the SOFA framework does not contribute to any mathematical or physical models directly related to computational mechanics, variational principles, or finite element methods. Instead, it serves as an event handling mechanism for input devices such as joysticks. It is responsible for managing and reporting changes in the state of joystick axes, buttons, and directional hats.\n\n### Mathematical and Physical Description:\n\n1. **Governing Equations / Operators**\n   - The `JoystickEvent` does not implement any governing equations or operators typically associated with FEM simulations such as mass matrix $M$, stiffness matrix $K$, internal force $f_{int}$, residual $R$, etc.\n\n2. **Constitutive or Kinematic Laws Involved**\n   - There are no constitutive laws (e.g., strain measures, stress tensors, hyperelastic potentials) or kinematic laws involved in the `JoystickEvent`. It is purely an input event handler and does not deal with material properties or mechanical behavior.\n\n3. **Role in FEM Pipeline**\n   - The `JoystickEvent` does not have a role in the global FEM pipeline (assembly, time integration, nonlinear solve, linear solve, constraint handling, mapping) as it is not related to any numerical simulation process.\n\n4. **Numerical Methods or Discretization Choices**\n   - Since this component deals with joystick events, there are no discretization choices or numerical methods involved in its operation.\n\n5. **Variational / Lagrangian Mechanics Framework**\n   - The `JoystickEvent` is not part of the variational or Lagrangian mechanics framework as it is an event handling mechanism and does not contribute to the physical simulation process.\n\n### Summary:\n\nThe `JoystickEvent` class serves purely for input management in the SOFA framework. It handles events related to joystick axes, buttons, and directional hats but does not play any role in mathematical or physical simulations such as those performed using FEM techniques.",
  "abstract": "`JoystickEvent` manages events from joystick axes, buttons, and directional hats, facilitating input handling within the SOFA simulation framework.",
  "sheet": "# JoystickEvent\n\n## Overview\nThe `JoystickEvent` class in the SOFA framework is responsible for managing and reporting changes in the state of joystick axes, buttons, and directional hats. It inherits from the `Event` class and does not contribute to any mathematical or physical models directly related to computational mechanics.\n\n## Parameters and Data\nThe `JoystickEvent` class does not expose significant data fields as it primarily handles events through its methods. The methods allow for querying axis events, button states, and hat events, as well as adding new events to the event list."
}