mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-05 15:30:08 +08:00
simulation with the joystick
This commit is contained in:
@@ -237,7 +237,7 @@ ap.srcs += nav_survey_rectangle.c snav.c
|
|||||||
ap.srcs += light.c
|
ap.srcs += light.c
|
||||||
ap.CFLAGS += -DUSE_LIGHT
|
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.srcs += nav_survey_rectangle.c nav_line.c light.c snav.c
|
||||||
sim.CFLAGS += -DUSE_LIGHT
|
sim.CFLAGS += -DUSE_LIGHT
|
||||||
|
|
||||||
sim.CFLAGS += -DNAV_JOYSTICK
|
sim.CFLAGS += -DUSE_ADC_GENERIC
|
||||||
|
|
||||||
|
sim.srcs += joystick.c
|
||||||
|
sim.CFLAGS += -DUSE_JOYSTICK
|
||||||
|
|
||||||
|
|
||||||
</makefile>
|
</makefile>
|
||||||
|
|||||||
@@ -1,9 +1,3 @@
|
|||||||
#include "joystick.h"
|
#include "joystick.h"
|
||||||
|
|
||||||
float joystick_x;
|
uint8_t joystick_block;
|
||||||
float joystick_y;
|
|
||||||
|
|
||||||
void joystick_init(void) {
|
|
||||||
joystick_x = 0.;
|
|
||||||
joystick_y = 0.;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#ifndef JOYSTICK_H
|
#ifndef JOYSTICK_H
|
||||||
#define JOYSTICK_H
|
#define JOYSTICK_H
|
||||||
|
|
||||||
extern float joystick_x;
|
#include "std.h"
|
||||||
extern float joystick_y;
|
#include "fw_h_ctl.h"
|
||||||
|
|
||||||
extern void joystick_init(void);
|
extern uint8_t joystick_block;
|
||||||
|
|
||||||
#define JoystickHandeDatalink(_roll_int8, _pitch_int8, _throttle_int8) { \
|
#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_roll_setpoint = _roll_int8 * (AUTO1_MAX_ROLL / 0x7f); \
|
||||||
h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
|
h_ctl_pitch_setpoint = _pitch_int8 * (AUTO1_MAX_PITCH / 0x7f); \
|
||||||
v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
|
v_ctl_throttle_setpoint = (MAX_PPRZ/0x7f) * _throttle_int8; \
|
||||||
|
|||||||
Reference in New Issue
Block a user