[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[paparazzi-commits] [6242] temporarily fix radio control feed with nps
From: |
Felix Ruess |
Subject: |
[paparazzi-commits] [6242] temporarily fix radio control feed with nps |
Date: |
Mon, 25 Oct 2010 21:57:40 +0000 |
Revision: 6242
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=6242
Author: flixr
Date: 2010-10-25 21:57:40 +0000 (Mon, 25 Oct 2010)
Log Message:
-----------
temporarily fix radio control feed with nps
Modified Paths:
--------------
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h
paparazzi3/trunk/sw/simulator/nps/nps_autopilot_booz.c
Modified: paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile
===================================================================
--- paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile
2010-10-25 21:57:32 UTC (rev 6241)
+++ paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/fdm_nps.makefile
2010-10-25 21:57:40 UTC (rev 6242)
@@ -20,7 +20,7 @@
sim.ARCHDIR = $(ARCH)
-sim.CFLAGS += -DSITL
+sim.CFLAGS += -DSITL -DNPS
sim.CFLAGS += `pkg-config glib-2.0 --cflags` -I /usr/include/meschach
sim.LDFLAGS += `pkg-config glib-2.0 --libs` -lm -lmeschach -lpcre -lglibivy
sim.CFLAGS += -I$(NPSDIR) -I$(SRC_FIRMWARE) -I$(SRC_BOOZ) -I$(SRC_BOOZ_SIM)
-I$(SRC_BOARD) -I../simulator -I$(PAPARAZZI_HOME)/conf/simulator/nps
Modified:
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
===================================================================
---
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
2010-10-25 21:57:32 UTC (rev 6241)
+++
paparazzi3/trunk/conf/autopilot/subsystems/rotorcraft/radio_control_ppm.makefile
2010-10-25 21:57:40 UTC (rev 6242)
@@ -16,8 +16,8 @@
sim.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
sim.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
sim.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
- $(SRC_BOOZ)/subsystems/radio_control/ppm.c \
- $(SRC_BOOZ_SIM)/subsystems/radio_control/ppm_arch.c
+ $(SRC_SUBSYSTEMS)/radio_control/ppm.c \
+ $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
#
# test_rc_ppm
Modified:
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c
2010-10-25 21:57:32 UTC (rev 6241)
+++ paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.c
2010-10-25 21:57:40 UTC (rev 6242)
@@ -28,6 +28,10 @@
#include <inttypes.h>
#include <caml/mlvalues.h>
+#ifdef NPS
+#include "nps_radio_control.h"
+#endif
+
uint8_t ppm_cur_pulse;
uint32_t ppm_last_pulse_time;
bool_t ppm_data_valid;
@@ -51,6 +55,35 @@
return unit;
}
+#ifdef NPS
+#define PPM_OF_NPS(_nps, _neutral, _min, _max) \
+ ((_nps) >= 0 ? (_neutral) + (_nps) * ((_max)-(_neutral)) : (_neutral) +
(_nps) * ((_neutral)- (_min)))
+
+void radio_control_feed(void) {
+ ppm_pulses[RADIO_ROLL] = PPM_OF_NPS(nps_radio_control.roll, \
+ RADIO_ROLL_NEUTRAL, \
+ RADIO_ROLL_MIN, \
+ RADIO_ROLL_MAX);
+ ppm_pulses[RADIO_PITCH] = PPM_OF_NPS(nps_radio_control.pitch, \
+ RADIO_PITCH_NEUTRAL, \
+ RADIO_PITCH_MIN, \
+ RADIO_PITCH_MAX);
+ ppm_pulses[RADIO_YAW] = PPM_OF_NPS(nps_radio_control.yaw, \
+ RADIO_YAW_NEUTRAL, \
+ RADIO_YAW_MIN, \
+ RADIO_YAW_MAX);
+ ppm_pulses[RADIO_THROTTLE] = PPM_OF_NPS(nps_radio_control.throttle, \
+ RADIO_THROTTLE_NEUTRAL, \
+ RADIO_THROTTLE_MIN, \
+ RADIO_THROTTLE_MAX);
+ ppm_pulses[RADIO_MODE] = PPM_OF_NPS(nps_radio_control.mode, \
+ RADIO_MODE_NEUTRAL, \
+ RADIO_MODE_MIN, \
+ RADIO_MODE_MAX);
+ ppm_frame_available = TRUE;
+}
+#endif
+
#else // RADIO_CONTROL
value update_rc_channel(value c __attribute__ ((unused)), value v
__attribute__ ((unused))) {
@@ -61,4 +94,8 @@
return unit;
}
+#ifdef NPS
+void radio_control_feed(void) {}
+#endif
+
#endif // RADIO_CONTROL
Modified:
paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h
===================================================================
--- paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h
2010-10-25 21:57:32 UTC (rev 6241)
+++ paparazzi3/trunk/sw/airborne/arch/sim/subsystems/radio_control/ppm_arch.h
2010-10-25 21:57:40 UTC (rev 6242)
@@ -36,4 +36,8 @@
#define PPM_NB_CHANNEL RADIO_CONTROL_NB_CHANNEL
+#ifdef NPS
+extern void radio_control_feed(void);
+#endif
+
#endif /* PPM_ARCH_H */
Modified: paparazzi3/trunk/sw/simulator/nps/nps_autopilot_booz.c
===================================================================
--- paparazzi3/trunk/sw/simulator/nps/nps_autopilot_booz.c 2010-10-25
21:57:32 UTC (rev 6241)
+++ paparazzi3/trunk/sw/simulator/nps/nps_autopilot_booz.c 2010-10-25
21:57:40 UTC (rev 6242)
@@ -37,7 +37,7 @@
void nps_autopilot_run_step(double time __attribute__ ((unused))) {
if (nps_radio_control_available(time)) {
- booz_radio_control_feed();
+ radio_control_feed();
main_event();
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [paparazzi-commits] [6242] temporarily fix radio control feed with nps,
Felix Ruess <=