simulation with the joystick

This commit is contained in:
Pascal Brisset
2008-07-16 08:18:52 +00:00
parent 7aff72db66
commit e97cc2966c
3 changed files with 10 additions and 13 deletions
+5 -2
View File
@@ -237,7 +237,7 @@ ap.srcs += nav_survey_rectangle.c snav.c
ap.srcs += light.c
ap.CFLAGS += -DUSE_LIGHT
ap.CFLAGS += -DNAV_JOYSTICK
# ap.CFLAGS += -DUSE_JOYSTICK
@@ -254,7 +254,10 @@ sim.CFLAGS += -DCONFIG=\"classix.h\" -DAGR_CLIMB -DLOITER_TRIM
sim.srcs += nav_survey_rectangle.c nav_line.c light.c snav.c
sim.CFLAGS += -DUSE_LIGHT
sim.CFLAGS += -DNAV_JOYSTICK
sim.CFLAGS += -DUSE_ADC_GENERIC
sim.srcs += joystick.c
sim.CFLAGS += -DUSE_JOYSTICK
</makefile>
+1 -7
View File
@@ -1,9 +1,3 @@
#include "joystick.h"
float joystick_x;
float joystick_y;
void joystick_init(void) {
joystick_x = 0.;
joystick_y = 0.;
}
uint8_t joystick_block;
+4 -4
View File
@@ -1,13 +1,13 @@
#ifndef JOYSTICK_H
#define JOYSTICK_H
extern float joystick_x;
extern float joystick_y;
#include "std.h"
#include "fw_h_ctl.h"
extern void joystick_init(void);
extern uint8_t joystick_block;
#define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
if (pprz_mode == PPRZ_MODE_AUTO2) { \
if (pprz_mode == PPRZ_MODE_AUTO2 && nav_block == joystick_block) { \
h_ctl_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \