Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Representations/JoystickData.h

Go to the documentation of this file.

    00001 /**
    00002  * @file JoystickData.h
    00003  * Declaration of class JoystickData.
    00004  *
    00005  * @author <a href=mailto:dueffert@informatik.hu-berlin.de>Uwe Düffert</a>
    00006  */
    00007
    00008 #ifndef __JOYSTICKDATA_H__
    00009 #define __JOYSTICKDATA_H__
    00010
    00011 #include "Representations/Motion/MotionRequest.h"
    00012 #include "Tools/Streams/InOut.h"
    00013
    00014 /** the maximum number of configurable buttons */
    00015 static const int numOfJoystickButtons = 12;
    00016
    00017 /**
    00018  * @class JoystickData
    00019  * A class for holdung all data produced by a joystick or a key equivalent.
    00020  */
    00021 class JoystickData
    00022 {
    00023 public:
    00024   /** Constructor */
    00025   JoystickData();
    00026
    00027   /** The value of the three joystick axes in [-1,1] */
    00028   double x,y,z;
    00029
    00030   /** The value of the accelerator in [0,1] */
    00031   double accel;
    00032
    00033   /** Bit array of the pressed buttons */
    00034   int button;
    00035
    00036   /** The value of the coolie: 0 or 1..8 */
    00037   int coolie;
    00038
    00039   /** Boolean if a special-action is given to be executed */
    00040   bool directSpecialAction;
    00041
    00042   /** The id of the special-action to be executed directly */
    00043   SpecialActionRequest::SpecialActionID specialActionID;
    00044
    00045   /**
    00046   * The timestamp when the last data was received.
    00047   * Note that this value is set in the In streaming operator.
    00048   */
    00049   unsigned long timeStamp;
    00050 };
    00051
    00052 /**
    00053  * Streaming operator that reads a JoystickData from a stream.
    00054  * @param stream The stream from which is read.
    00055  * @param joystickData The JoystickData object.
    00056  * @return The stream.
    00057  */
    00058 In& operator>>(In& stream,JoystickData& joystickData);
    00059
    00060 /**
    00061  * Streaming operator that writes a JoystickData to a stream.
    00062  * @param stream The stream to write on.
    00063  * @param joystickData The JoystickData object.
    00064  * @return The stream.
    00065  */
    00066 Out& operator<<(Out& stream, const JoystickData& joystickData);
    00067
    00068 #endif // __JOYSTICKDATA_H__