Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
orxonox::JoyStick Class Reference

Wraps around an OIS::JoyStick and forwards the input events to a list of input states. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/input/JoyStick.h>

Inheritance diagram for orxonox::JoyStick:
orxonox::Configurable orxonox::InputDeviceTemplated< JoyStickTraits > OIS::JoyStickListener orxonox::Listable orxonox::InputDevice orxonox::Identifiable

Public Member Functions

 JoyStick (unsigned int id, OIS::InputManager *oisInputManager)
 Assigns a generated ID string and loads the calibration (if present) More...
 
 ~JoyStick ()=default
 
const std::string & getDeviceName () const
 Returns the name generated from the number of knobs and the device name. More...
 
void setConfigValues ()
 
- Public Member Functions inherited from orxonox::Configurable
 Configurable ()
 
void setConfigValues ()
 Function to collect the SetConfigValue-macro calls. More...
 
- Public Member Functions inherited from orxonox::Listable
 Listable ()
 Constructor: Allocates space in the element list. More...
 
 Listable (Context *context)
 Constructor: Allocates space in the element list and assigns the context. More...
 
virtual ~Listable ()
 Destructor: Removes the object from the object-lists. More...
 
ContextgetContext () const
 
void setContext (Context *context)
 Changes the context. More...
 
void unregisterObject ()
 Removes this object from the object-lists. More...
 
- Public Member Functions inherited from orxonox::Identifiable
 Identifiable ()
 Constructor: Sets the default values. More...
 
virtual ~Identifiable ()
 
ORX_FORCEINLINE voidgetDerivedPointer (unsigned int classID)
 Returns a valid pointer of any derived type that is registered in the class hierarchy. More...
 
template<class T >
ORX_FORCEINLINE T * getDerivedPointer (unsigned int classID)
 Version of getDerivedPointer with template. More...
 
template<class T >
ORX_FORCEINLINE const T * getDerivedPointer (unsigned int classID) const
 Const version of getDerivedPointer with template. More...
 
IdentifiergetIdentifier () const
 Returns the Identifier of the object. More...
 
bool isA (const Identifier *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
template<class B >
bool isA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isA (const Identifiable *object)
 Returns true if the object's class is of the given type or a derivative. More...
 
bool isChildOf (const Identifier *identifier)
 Returns true if the object's class is a child of the given type. More...
 
template<class B >
bool isChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a child of the given type. More...
 
bool isChildOf (const Identifiable *object)
 Returns true if the object's class is a child of the given type. More...
 
bool isDirectChildOf (const Identifier *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
template<class B >
bool isDirectChildOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectChildOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isDirectParentOf (const Identifier *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
template<class B >
bool isDirectParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a direct parent of the given type. More...
 
bool isDirectParentOf (const Identifiable *object)
 Returns true if the object's class is a direct child of the given type. More...
 
bool isExactlyA (const Identifier *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
template<class B >
bool isExactlyA (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is exactly of the given type. More...
 
bool isExactlyA (const Identifiable *object)
 Returns true if the object's class is exactly of the given type. More...
 
bool isParentOf (const Identifier *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
template<class B >
bool isParentOf (const SubclassIdentifier< B > *identifier)
 Returns true if the object's class is a parent of the given type. More...
 
bool isParentOf (const Identifiable *object)
 Returns true if the object's class is a parent of the given type. More...
 
- Public Member Functions inherited from orxonox::InputDeviceTemplated< JoyStickTraits >
 InputDeviceTemplated (unsigned int id, OIS::InputManager *oisInputManager)
 Creates the OIS device. More...
 
virtual ~InputDeviceTemplated ()
 Destroys the OIS device. More...
 
virtual void clearBuffers () override
 Clears the list of pressed buttons and calls the derived class's method. More...
 
virtual std::string getClassName () const override
 Returns the device class (derived) name as string. More...
 
OISDeviceClassgetOISDevice ()
 
virtual void update (const Clock &time) override
 Captures OIS events (which then get distributed to the derived class) and creates the button held events. More...
 
- Public Member Functions inherited from orxonox::InputDevice
 InputDevice (unsigned int id)
 Only resets the members. More...
 
virtual ~InputDevice ()=default
 
unsigned int getDeviceID () const
 Returns the ID of the device (the same as in InputDeviceEnumerator for mouse and keyboard) More...
 
std::vector< InputState * > & getStateListRef ()
 Returns a reference to the internal input state vector. Use with care! More...
 
bool isCalibrating () const
 Tells whether the device is in calibration mode. More...
 
void startCalibration ()
 Start calibrating (only useful for joy sticks) More...
 
void stopCalibration ()
 Stop calibrating and evaluate the data (only useful for joy sticks) More...
 
- Public Member Functions inherited from OIS::JoyStickListener
virtual ~JoyStickListener ()
 

Private Types

typedef InputDeviceTemplated< JoyStickTraitssuper
 Super class alias. More...
 

Private Member Functions

virtual bool axisMoved (const OIS::JoyStickEvent &arg, int axis) override
 OIS joy stick axis event handler. More...
 
virtual bool buttonPressed (const OIS::JoyStickEvent &arg, int button) override
 OIS event handler. More...
 
virtual bool buttonReleased (const OIS::JoyStickEvent &arg, int button) override
 OIS event handler. More...
 
void calibrationFileCallback ()
 Callback for the joy stick calibration config file. More...
 
virtual void calibrationStarted () override
 Called by InputDevice when calibration mode has started. More...
 
virtual void calibrationStopped () override
 Called by InputDevice when calibration mode has stopped. More...
 
void clearBuffersImpl ()
 Resets the pov states. More...
 
void evaluateCalibration ()
 Evaluates the accumulated values during calibration. More...
 
void fireAxis (int axis, int value)
 Generic method to forward axis events. More...
 
virtual bool povMoved (const OIS::JoyStickEvent &arg, int id) override
 A POV is the big button that can point in all directions (but only in one at once) More...
 
virtual bool sliderMoved (const OIS::JoyStickEvent &arg, int id) override
 A Slider always has an X and an Y direction! More...
 
virtual bool vector3Moved (const OIS::JoyStickEvent &arg, int id) override
 OIS event handler (don't remove that because of OIS version issues!) More...
 

Static Private Member Functions

static std::string getClassNameImpl ()
 Returns the class name as string. More...
 

Private Attributes

std::string calibrationFilename_
 Joy stick calibration ini filename. More...
 
std::vector< int > configMaxValues_
 Config file stored maximum axis values. More...
 
std::vector< int > configMinValues_
 Config file stored minimum axis values. More...
 
std::vector< int > configZeroValues_
 Config file stored axis values when the knob is in the middle. More...
 
std::string deviceName_
 Name generated by the number of knobs and the device name. More...
 
float negativeCoeffs_ [24]
 Maps the positive part of an axis to a 0.0 to 1.0 floating range. More...
 
float positiveCoeffs_ [24]
 Maps the negative part of an axis to a 0.0 to 1.0 floating range. More...
 
int povStates_ [4]
 Internal states for the POVs. More...
 
int sliderStates_ [4][2]
 Internal states for the Sliders (each slider has X and Y!) More...
 
int zeroValues_ [24]
 Axes values when the knob is in the middle. More...
 

Static Private Attributes

static std::vector< std::string > deviceNames_s
 Contains a list of all names to avoid duplicates. More...
 
static const unsigned int sliderAxes_s = 8
 

Friends

class InputDeviceTemplated< JoyStickTraits >
 

Additional Inherited Members

- Protected Member Functions inherited from orxonox::InputDeviceTemplated< JoyStickTraits >
ORX_FORCEINLINE void buttonPressed (ButtonTypeParam button)
 Common code for all button pressed events (updates pressed buttons list and calls the input states) More...
 
ORX_FORCEINLINE void buttonReleased (ButtonTypeParam button)
 Common code for all button released events (updates pressed buttons list and calls the input states) More...
 
- Protected Attributes inherited from orxonox::InputDeviceTemplated< JoyStickTraits >
OISDeviceClassoisDevice_
 Managed pointer to the OIS device. More...
 
- Protected Attributes inherited from orxonox::InputDevice
std::vector< InputState * > inputStates_
 List of all input states that receive events from this device. More...
 

Detailed Description

Wraps around an OIS::JoyStick and forwards the input events to a list of input states.

The class also supports joy stick calibration and stores the values in an ini-file.

Member Typedef Documentation

Super class alias.

Constructor & Destructor Documentation

orxonox::JoyStick::JoyStick ( unsigned int  id,
OIS::InputManager oisInputManager 
)

Assigns a generated ID string and loads the calibration (if present)

orxonox::JoyStick::~JoyStick ( )
default

Member Function Documentation

bool orxonox::JoyStick::axisMoved ( const OIS::JoyStickEvent arg,
int  axis 
)
overrideprivatevirtual

OIS joy stick axis event handler.

Implements OIS::JoyStickListener.

virtual bool orxonox::JoyStick::buttonPressed ( const OIS::JoyStickEvent arg,
int  button 
)
inlineoverrideprivatevirtual

OIS event handler.

Implements OIS::JoyStickListener.

virtual bool orxonox::JoyStick::buttonReleased ( const OIS::JoyStickEvent arg,
int  button 
)
inlineoverrideprivatevirtual

OIS event handler.

Implements OIS::JoyStickListener.

void orxonox::JoyStick::calibrationFileCallback ( )
private

Callback for the joy stick calibration config file.

void orxonox::JoyStick::calibrationStarted ( )
overrideprivatevirtual

Called by InputDevice when calibration mode has started.

Reimplemented from orxonox::InputDevice.

void orxonox::JoyStick::calibrationStopped ( )
overrideprivatevirtual

Called by InputDevice when calibration mode has stopped.

Reimplemented from orxonox::InputDevice.

void orxonox::JoyStick::clearBuffersImpl ( )
private

Resets the pov states.

void orxonox::JoyStick::evaluateCalibration ( )
private

Evaluates the accumulated values during calibration.

void orxonox::JoyStick::fireAxis ( int  axis,
int  value 
)
private

Generic method to forward axis events.

static std::string orxonox::JoyStick::getClassNameImpl ( )
inlinestaticprivate

Returns the class name as string.

const std::string& orxonox::JoyStick::getDeviceName ( ) const
inline

Returns the name generated from the number of knobs and the device name.

bool orxonox::JoyStick::povMoved ( const OIS::JoyStickEvent arg,
int  id 
)
overrideprivatevirtual

A POV is the big button that can point in all directions (but only in one at once)

Reimplemented from OIS::JoyStickListener.

void orxonox::JoyStick::setConfigValues ( void  )
bool orxonox::JoyStick::sliderMoved ( const OIS::JoyStickEvent arg,
int  id 
)
overrideprivatevirtual

A Slider always has an X and an Y direction!

Reimplemented from OIS::JoyStickListener.

virtual bool orxonox::JoyStick::vector3Moved ( const OIS::JoyStickEvent arg,
int  id 
)
inlineoverrideprivatevirtual

OIS event handler (don't remove that because of OIS version issues!)

Reimplemented from OIS::JoyStickListener.

Friends And Related Function Documentation

friend class InputDeviceTemplated< JoyStickTraits >
friend

Member Data Documentation

std::string orxonox::JoyStick::calibrationFilename_
private

Joy stick calibration ini filename.

std::vector<int> orxonox::JoyStick::configMaxValues_
private

Config file stored maximum axis values.

std::vector<int> orxonox::JoyStick::configMinValues_
private

Config file stored minimum axis values.

std::vector<int> orxonox::JoyStick::configZeroValues_
private

Config file stored axis values when the knob is in the middle.

std::string orxonox::JoyStick::deviceName_
private

Name generated by the number of knobs and the device name.

std::vector< std::string > orxonox::JoyStick::deviceNames_s
staticprivate

Contains a list of all names to avoid duplicates.

Maximum number of slider axes

float orxonox::JoyStick::negativeCoeffs_[24]
private

Maps the positive part of an axis to a 0.0 to 1.0 floating range.

float orxonox::JoyStick::positiveCoeffs_[24]
private

Maps the negative part of an axis to a 0.0 to 1.0 floating range.

int orxonox::JoyStick::povStates_[4]
private

Internal states for the POVs.

const unsigned int orxonox::JoyStick::sliderAxes_s = 8
staticprivate
int orxonox::JoyStick::sliderStates_[4][2]
private

Internal states for the Sliders (each slider has X and Y!)

int orxonox::JoyStick::zeroValues_[24]
private

Axes values when the knob is in the middle.


The documentation for this class was generated from the following files: