mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-28 09:58:23 +08:00
rc telemetry tests
This commit is contained in:
@@ -12,8 +12,8 @@
|
|||||||
<!-- commands section -->
|
<!-- commands section -->
|
||||||
<servos>
|
<servos>
|
||||||
<servo name="MOTOR" no="0" min="1000" neutral="1000" max="2000"/>
|
<servo name="MOTOR" no="0" min="1000" neutral="1000" max="2000"/>
|
||||||
<servo name="AILEVON_LEFT" no="2" min="1720" neutral="1316" max="1000"/>
|
<servo name="AILEVON_LEFT" no="2" min="1720" neutral="1341" max="1000"/>
|
||||||
<servo name="AILEVON_RIGHT" no="6" min="1220" neutral="1542" max="1840"/>
|
<servo name="AILEVON_RIGHT" no="6" min="1220" neutral="1523" max="1840"/>
|
||||||
</servos>
|
</servos>
|
||||||
|
|
||||||
<commands>
|
<commands>
|
||||||
@@ -172,10 +172,6 @@
|
|||||||
<define name="DEVICE_ADDRESS" value="...."/>
|
<define name="DEVICE_ADDRESS" value="...."/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="SIMU">
|
|
||||||
<define name="YAW_RESPONSE_FACTOR" value="0.5"/>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<makefile>
|
<makefile>
|
||||||
CONFIG = \"tiny_2_1.h\"
|
CONFIG = \"tiny_2_1.h\"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- $Id: mc24.xml 3610 2009-07-02 16:35:18Z poine $
|
||||||
|
--
|
||||||
|
-- (c) 2003 Pascal Brisset, Antoine Drouin
|
||||||
|
--
|
||||||
|
-- This file is part of paparazzi.
|
||||||
|
--
|
||||||
|
-- paparazzi is free software; you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
-- any later version.
|
||||||
|
--
|
||||||
|
-- paparazzi is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with paparazzi; see the file COPYING. If not, write to
|
||||||
|
-- the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
|
-- Boston, MA 02111-1307, USA.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
-- Attributes of root (Radio) tag :
|
||||||
|
-- name: name of RC
|
||||||
|
-- data_min: min width of a pulse to be considered as a data pulse
|
||||||
|
-- data_max: max width of a pulse to be considered as a data pulse
|
||||||
|
-- sync_min: min width of a pulse to be considered as a synchro pulse
|
||||||
|
-- sync_max: max width of a pulse to be considered as a synchro pulse
|
||||||
|
-- min, max and sync are expressed in micro-seconds
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
-- Attributes of channel tag :
|
||||||
|
-- ctl: name of the command on the transmitter - only for displaying
|
||||||
|
-- no: order in the PPM frame
|
||||||
|
-- function: logical command
|
||||||
|
-- averaged: channel filtered through several frames (for discrete commands)
|
||||||
|
-- min: minimum pulse length (micro-seconds)
|
||||||
|
-- max: maximum pulse length (micro-seconds)
|
||||||
|
-- neutral: neutral pulse length (micro-seconds)
|
||||||
|
-- Note: a command may be reversed by exchanging min and max values
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!DOCTYPE radio SYSTEM "radio.dtd">
|
||||||
|
<radio name="generic" data_min="800" data_max="2200" sync_min="5000" sync_max="15000" pulse_type="POSITIVE">
|
||||||
|
<channel ctl="D" function="THROTTLE" min="1000" neutral="1000" max="2000" average="0"/>
|
||||||
|
<channel ctl="C" function="ROLL" min="1000" neutral="1500" max="2000" average="0"/>
|
||||||
|
<channel ctl="B" function="PITCH" min="2000" neutral="1500" max="1000" average="0"/>
|
||||||
|
<channel ctl="A" function="YAW" min="1000" neutral="1500" max="2000" average="0"/>
|
||||||
|
<channel ctl="G" function="SWITCH1" min="1000" neutral="1500" max="2000" average="1"/>
|
||||||
|
<channel ctl="E" function="GAIN1" min="1000" neutral="1500" max="2000" average="1"/>
|
||||||
|
<channel ctl="F" function="CALIB" min="1000" neutral="1500" max="2000" average="0"/>
|
||||||
|
<channel ctl="H" function="MODE" min="1000" neutral="1500" max="2000" average="1"/>
|
||||||
|
<channel ctl="I" function="SWITCH2" min="1000" neutral="1500" max="2000" average="1"/>
|
||||||
|
</radio>
|
||||||
|
|
||||||
@@ -45,6 +45,10 @@
|
|||||||
#include "joystick.h"
|
#include "joystick.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_RC_TELEMETRY
|
||||||
|
#include "ppm.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_USB_SERIAL
|
#ifdef USE_USB_SERIAL
|
||||||
#include "usb_serial.h"
|
#include "usb_serial.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -165,6 +169,14 @@ void dl_parse_msg(void) {
|
|||||||
DL_JOYSTICK_RAW_throttle(dl_buffer));
|
DL_JOYSTICK_RAW_throttle(dl_buffer));
|
||||||
} else
|
} else
|
||||||
#endif // USE_JOYSTICK
|
#endif // USE_JOYSTICK
|
||||||
|
#ifdef USE_RC_TELEMETRY
|
||||||
|
if (msg_id == DL_RC_3CH /*&& DL_RC_3CH_ac_id(dl_buffer) == TX_ID*/) {
|
||||||
|
LED_TOGGLE(3);
|
||||||
|
ppm_datalink(DL_RC_3CH_throttle_mode(dl_buffer),
|
||||||
|
DL_RC_3CH_roll(dl_buffer),
|
||||||
|
DL_RC_3CH_pitch(dl_buffer));
|
||||||
|
} else
|
||||||
|
#endif // USE_RC_TELEMETRY
|
||||||
{ /* Last else */
|
{ /* Last else */
|
||||||
#ifdef USE_MODULES
|
#ifdef USE_MODULES
|
||||||
/* Parse modules datalink */
|
/* Parse modules datalink */
|
||||||
|
|||||||
@@ -32,7 +32,11 @@
|
|||||||
extern uint16_t ppm_pulses[ PPM_NB_PULSES ];
|
extern uint16_t ppm_pulses[ PPM_NB_PULSES ];
|
||||||
extern volatile bool_t ppm_valid;
|
extern volatile bool_t ppm_valid;
|
||||||
|
|
||||||
|
#ifdef USE_RC_TELEMETRY
|
||||||
|
#include "ppm_telemetry.h"
|
||||||
|
#else
|
||||||
#include "ppm_hw.h"
|
#include "ppm_hw.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* RADIO_CONTROL */
|
#endif /* RADIO_CONTROL */
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
|
||||||
|
#include "ppm.h"
|
||||||
|
#include "std.h"
|
||||||
|
|
||||||
|
#define PPM_NB_CHANNEL PPM_NB_PULSES
|
||||||
|
|
||||||
|
uint16_t ppm_pulses[PPM_NB_CHANNEL];
|
||||||
|
volatile bool_t ppm_valid;
|
||||||
|
|
||||||
|
|
||||||
|
void ppm_datalink( uint8_t throttle_mode,
|
||||||
|
int8_t roll,
|
||||||
|
int8_t pitch)
|
||||||
|
{
|
||||||
|
int throttle = throttle_mode & 0xFC;
|
||||||
|
int mode = throttle_mode & 0x03;
|
||||||
|
|
||||||
|
ppm_pulses[RADIO_ROLL] = (roll * 4 + 1500) * 15;
|
||||||
|
ppm_pulses[RADIO_PITCH] = (pitch * 4 + 1500) * 15;
|
||||||
|
ppm_pulses[RADIO_THROTTLE] = (throttle * 4 + 1000) * 15;
|
||||||
|
ppm_pulses[RADIO_MODE] = (1000 + mode * 500) * 15;
|
||||||
|
|
||||||
|
ppm_valid = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef PPM_TELEMETRY_H
|
||||||
|
#define PPM_TELEMETRY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include BOARD_CONFIG
|
||||||
|
|
||||||
|
|
||||||
|
static inline void ppm_init ( void ) {
|
||||||
|
ppm_valid = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PPM_ISR() {}
|
||||||
|
|
||||||
|
#define PPM_IT 0x00
|
||||||
|
|
||||||
|
void ppm_datalink( uint8_t throttle_mode,
|
||||||
|
int8_t roll,
|
||||||
|
int8_t pitch)
|
||||||
|
;
|
||||||
|
|
||||||
|
#endif /* PPM_TELEMETRY_H */
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define DBG 1
|
#define DBG 1
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -62,19 +62,23 @@
|
|||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
// e-sky 0905A simulator fms
|
// e-sky 0905A simulator fms
|
||||||
#define AXIS_YAW ABS_X
|
//#define AXIS_YAW ABS_X
|
||||||
#define AXIS_PITCH ABS_Y
|
//#define AXIS_ROLL ABS_Z
|
||||||
#define AXIS_ROLL ABS_Z
|
//#define AXIS_THROTTLE ABS_RY
|
||||||
#define AXIS_THROTTLE ABS_RY
|
//#define AXIS_PITCH ABS_Y
|
||||||
|
#define AXIS_YAW ABS_RY
|
||||||
|
#define AXIS_ROLL ABS_Y
|
||||||
|
#define AXIS_THROTTLE ABS_X
|
||||||
|
#define AXIS_PITCH ABS_Z
|
||||||
|
|
||||||
#define THROTTLE_MIN (-90)
|
#define THROTTLE_MIN (-90)
|
||||||
#define THROTTLE_NEUTRAL (0)
|
#define THROTTLE_NEUTRAL (0)
|
||||||
#define THROTTLE_MAX (90)
|
#define THROTTLE_MAX (90)
|
||||||
#define ROLL_MIN (-122)
|
#define ROLL_MIN (-122)
|
||||||
#define ROLL_NEUTRAL (-2)
|
#define ROLL_NEUTRAL (-13)
|
||||||
#define ROLL_MAX (113)
|
#define ROLL_MAX (113)
|
||||||
#define PITCH_MIN (-109)
|
#define PITCH_MIN (-109)
|
||||||
#define PITCH_NEUTRAL (2)
|
#define PITCH_NEUTRAL (-2)
|
||||||
#define PITCH_MAX (109)
|
#define PITCH_MAX (109)
|
||||||
#define YAW_MIN (125)
|
#define YAW_MIN (125)
|
||||||
#define YAW_NEUTRAL (-13
|
#define YAW_NEUTRAL (-13
|
||||||
@@ -315,8 +319,8 @@ static gboolean joystick_periodic(gpointer data __attribute__ ((unused))) {
|
|||||||
{
|
{
|
||||||
dbgprintf(stdout, "pos %d %d %d %d\n", position[0], position[1], position[2], position[3]);
|
dbgprintf(stdout, "pos %d %d %d %d\n", position[0], position[1], position[2], position[3]);
|
||||||
|
|
||||||
if (position[3] > 125) mode = 1;
|
if (position[3] > 125) mode = 2;
|
||||||
else if (position[3] < -125) mode = 2;
|
else if (position[3] < -125) mode = 1;
|
||||||
else mode = 0;
|
else mode = 0;
|
||||||
|
|
||||||
throttle = ((position[0] - THROTTLE_NEUTRAL -THROTTLE_MIN) * 63) / (THROTTLE_MAX-THROTTLE_MIN);
|
throttle = ((position[0] - THROTTLE_NEUTRAL -THROTTLE_MIN) * 63) / (THROTTLE_MAX-THROTTLE_MIN);
|
||||||
|
|||||||
Reference in New Issue
Block a user