diff --git a/conf/airframes/fraser_lisa_m_rotorcraft.xml b/conf/airframes/fraser_lisa_m_rotorcraft.xml
index a98a586d54..d88a3716a6 100644
--- a/conf/airframes/fraser_lisa_m_rotorcraft.xml
+++ b/conf/airframes/fraser_lisa_m_rotorcraft.xml
@@ -225,6 +225,7 @@
+
diff --git a/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml b/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml
index 221cd780b1..25310f3dbc 100644
--- a/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml
+++ b/conf/simulator/jsbsim/aircraft/Quad_LisaM_2.xml
@@ -3,10 +3,10 @@
- Gustavo Violato & Antoine Drouin
- 24-02-2009
- Version 0.9 - beta
- Simple Quadrotor without rotor dynamic
+ Gustavo Violato & Antoine Drouin
+ 24-02-2009
+ Version 0.9 - beta
+ Simple Quadrotor without rotor dynamic (front/back motors turning CW, left/right CCW)
diff --git a/conf/simulator/jsbsim/aircraft/fraser.xml b/conf/simulator/jsbsim/aircraft/fraser.xml
new file mode 100644
index 0000000000..97b994c4a0
--- /dev/null
+++ b/conf/simulator/jsbsim/aircraft/fraser.xml
@@ -0,0 +1,396 @@
+
+
+
+
+
+ Gustavo Violato & Antoine Drouin
+ 24-02-2009
+ Version 0.9 - beta
+ Simple Quadrotor without rotor dynamic (front/back motors turning CCW, left/right CW)
+
+
+
+ 78.53
+ 10
+ 6.89
+ 0
+ 0
+ 0
+ 0
+
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+
+
+ 0
+ 0
+ 0
+
+
+
+
+ 0.005
+ 0.005
+ 0.010
+ 0.
+ 0.
+ 0.
+ 0.84
+
+ 0
+ 0
+ 0
+
+
+
+
+
+
+ -0.15
+ 0
+ -0.1
+
+ 0.8
+ 0.5
+ 500
+ 100
+ 1000
+ 0.0
+ NONE
+ 0
+
+
+
+
+ 0.15
+ 0
+ -0.1
+
+ 0.8
+ 0.5
+ 500
+ 100
+ 1000
+ 0.0
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
+
+
+
+ -1.9685
+ -6.89
+ 0
+
+
+ 0
+ -1
+ 0
+
+
+
+
+
+
+ fcs/left_motor
+ 0.84
+
+
+
+ 1.9685
+ -6.89
+ 0
+
+
+ 0
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+ Drag
+
+ aero/qbar-psf
+ 47.9
+ 0.0151
+ 0.224808943
+
+
+
+
+
+
diff --git a/sw/simulator/nps/nps_radio_control_joystick.c b/sw/simulator/nps/nps_radio_control_joystick.c
index 035e72636f..746c04aed4 100644
--- a/sw/simulator/nps/nps_radio_control_joystick.c
+++ b/sw/simulator/nps/nps_radio_control_joystick.c
@@ -33,6 +33,9 @@
#include "nps_radio_control.h"
#include "nps_radio_control_joystick.h"
+// for NPS_JS_MODE_AXIS
+#include "generated/airframe.h"
+
#include
#include
#include
@@ -43,13 +46,22 @@
#define JS_PITCH 1
#define JS_YAW 2
#define JS_THROTTLE 3
+
+#ifndef NPS_JS_MODE_AXIS
#define JS_NB_AXIS 4
+#else
+#define JS_NB_AXIS 5
+#endif
// buttons to switch modes
-#define JS_MODE_MANUAL 4
-#define JS_MODE_AUTO1 5
-#define JS_MODE_AUTO2 6
+#define JS_BUTTON_MODE_MANUAL 4
+#define JS_BUTTON_MODE_AUTO1 5
+#define JS_BUTTON_MODE_AUTO2 6
+#ifndef NPS_JS_MODE_AXIS
#define JS_NB_BUTTONS 3
+#else
+#define JS_NB_BUTTONS 0
+#endif
NpsJoystick nps_joystick;
SDL_Joystick *sdl_joystick;
@@ -126,6 +138,7 @@ int nps_radio_control_joystick_init(const char* device) {
else if (SDL_JoystickNumButtons(sdl_joystick) < JS_NB_BUTTONS)
{
printf("Selected joystick does not support enough buttons!\n");
+ printf("Buttons supported: %d needed: %d\n", SDL_JoystickNumButtons(sdl_joystick), JS_NB_BUTTONS);
SDL_JoystickClose(sdl_joystick);
exit(-1);
}
@@ -146,43 +159,48 @@ void nps_radio_control_joystick_update(void) {
nps_joystick.roll = (float)(SDL_JoystickGetAxis(sdl_joystick,JS_ROLL))/32767.;
nps_joystick.pitch = (float)(SDL_JoystickGetAxis(sdl_joystick,JS_PITCH))/32767.;
nps_joystick.yaw = (float)(SDL_JoystickGetAxis(sdl_joystick,JS_YAW))/32767.;
+ // if an axis is asigned to the mode, use it instead of the buttons
+#ifdef NPS_JS_MODE_AXIS
+ nps_joystick.mode = (float)(SDL_JoystickGetAxis(sdl_joystick,NPS_JS_MODE_AXIS))/32767.;
+#endif
while(SDL_PollEvent(&sdl_event))
{
switch(sdl_event.type)
{
case SDL_JOYBUTTONDOWN:
- {
- switch(sdl_event.jbutton.button)
- {
- case JS_MODE_MANUAL:
- nps_joystick.mode = MODE_SWITCH_MANUAL;
- break;
+ {
+ switch(sdl_event.jbutton.button)
+ {
+#ifndef NPS_JS_MODE_AXIS
+ case JS_BUTTON_MODE_MANUAL:
+ nps_joystick.mode = MODE_SWITCH_MANUAL;
+ break;
- case JS_MODE_AUTO1:
- nps_joystick.mode = MODE_SWITCH_AUTO1;
- break;
+ case JS_BUTTON_MODE_AUTO1:
+ nps_joystick.mode = MODE_SWITCH_AUTO1;
+ break;
- case JS_MODE_AUTO2:
- nps_joystick.mode = MODE_SWITCH_AUTO2;
- break;
-
- default:
- //ignore
- break;
+ case JS_BUTTON_MODE_AUTO2:
+ nps_joystick.mode = MODE_SWITCH_AUTO2;
+ break;
+#endif
+ default:
+ //ignore
+ break;
+ }
}
- }
- break;
+ break;
case SDL_QUIT:
- printf("Quitting...\n");
- exit(-1);
- break;
+ printf("Quitting...\n");
+ exit(-1);
+ break;
default:
- //do nothing
- printf("unknown SDL event!!!\n");
- break;
+ //do nothing
+ printf("unknown SDL event!!!\n");
+ break;
}
}
}