@@ -37,7 +37,6 @@ This file is part of the PIXHAWK project
*
* @author Lorenz Meier <mavteam@student.ethz.ch>
* @author Andreas Romer <mavteam@student.ethz.ch>
* @author Julian Oes <julian@oes.ch>
*/
#ifndef _JOYSTICKINPUT_H_
...
...
@@ -57,8 +56,6 @@ This file is part of the PIXHAWK project
structJoystickSettings{
QMap<int,bool>axesInverted;///< Whether each axis should be used inverted from what was reported.
QMap<int,bool>axesLimited;///< Whether each axis should be limited to only the positive range. Currently this only applies to the throttle axis, but is kept generic here to possibly support other axes.
QMap<int,float>axesMaxRange;///< The maximum values per axis
QMap<int,float>axesMinRange;///< The minimum values per axis
QMap<int,int>buttonActions;///< The index of the action associated with every button.
};
Q_DECLARE_METATYPE(JoystickSettings)
...
...
@@ -89,17 +86,6 @@ public:
JOYSTICK_INPUT_MAPPING_THROTTLE=4
};
/**
* @brief The JOYSTICK_MODE enum stores the values for each item in the mode combobox.
* This should match the order of items in the mode combobox in JoystickWidget.ui.
*/
enumJOYSTICK_MODE
{
JOYSTICK_MODE_ATTITUDE=0,
JOYSTICK_MODE_POSITION=1,
JOYSTICK_MODE_FORCE=2
};
/**
* @brief Load joystick-specific settings.
*/
...
...
@@ -123,11 +109,6 @@ public:
returnisEnabled;
}
boolcalibrating()const
{
returnisCalibrating;
}
intgetMappingThrottleAxis()const
{
returnthrottleAxis;
...
...
@@ -173,11 +154,6 @@ public:
returnnumJoysticks;
}
JOYSTICK_MODEgetMode()const
{
returnmode;
}
QStringgetJoystickNameById(intid)const
{
returnQString(SDL_JoystickName(id));
...
...
@@ -186,17 +162,16 @@ public:
floatgetCurrentValueForAxis(intaxis)const;
boolgetInvertedForAxis(intaxis)const;
boolgetRangeLimitForAxis(intaxis)const;
floatgetAxisRangeLimitMinForAxis(intaxis)const;
floatgetAxisRangeLimitMaxForAxis(intaxis)const;
intgetActionForButton(intbutton)const;
constdoublesdlJoystickMin;
constdoublesdlJoystickMax;
protected:
doublecalibrationPositive[10];
doublecalibrationNegative[10];
boolisEnabled;///< Track whether the system should emit the higher-level signals: joystickChanged & actionTriggered.
boolisCalibrating;///< Track if calibration in progress
booldone;
SDL_Joystick*joystick;
...
...
@@ -219,9 +194,6 @@ protected:
intjoystickNumAxes;
intjoystickNumButtons;
// mode of joystick (attitude, position, force, ... (see JOYSTICK_MODE enum))
JOYSTICK_MODEmode;
// Track axis/button settings based on a Joystick/AutopilotType/SystemType triplet.
// This is only a double-map, because settings are stored/loaded based on joystick
// name first, so only the settings for the current joystick need to be stored at any given time.
...
...
@@ -251,9 +223,8 @@ signals:
* @param throttle Throttle, -100%:-1.0, 0%: 0.0, 100%: 1.0. If the roll axis isn't defined, NaN is transmit instead.
* @param xHat hat vector in forward-backward direction, +1 forward, 0 center, -1 backward
* @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right
* @param mode (setpoint type) see JOYSTICK_MODE enum
staticquint8countSinceLastTransmission=0;// Track how many calls to this function have occurred since the last MAVLink transmission
// Transmit the external setpoints only if they've changed OR if it's been a little bit since they were last transmit. To make sure there aren't issues with
// response rate, we make sure that a message is transmit when the commands have changed, then one more time, and then switch to the lower transmission rate
// if no command inputs have changed.
// The default transmission rate is 25Hz, but when no inputs have changed it drops down to 5Hz.
// Ensure that another message will be sent the next time this function is called
countSinceLastTransmission=10;
}
// Transmit the manual commands only if they've changed OR if it's been a little bit since they were last transmit. To make sure there aren't issues with
// response rate, we make sure that a message is transmit when the commands have changed, then one more time, and then switch to the lower transmission rate
// if no command inputs have changed.
// The default transmission rate is 50Hz, but when no inputs have changed it drops down to 5Hz.