/branches/V0.76g-acid/T-Rex_450.mkm |
---|
2,24 → 2,11 |
Name=T-Rex 450 |
Version=1 |
[Gas] |
Motor1=1 |
Motor2=20 |
Motor3=113 |
Motor4=1 |
Motor5=4 |
Motor6=4 |
Motor7=4 |
Motor8=4 |
Motor9=0 |
Motor10=0 |
Motor11=0 |
Motor12=0 |
[Nick] |
Motor1=16 |
Motor2=-5 |
Motor1=0 |
Motor2=0 |
Motor3=0 |
Motor4=70 |
Motor5=50 |
Motor4=0 |
Motor5=0 |
Motor6=0 |
Motor7=0 |
Motor8=0 |
27,12 → 14,38 |
Motor10=0 |
Motor11=0 |
Motor12=0 |
[Nick] |
Motor1=0 |
#define HELI_THROTTLE_DEADBAND |
Motor2=113 |
#define HELI_THROTTLE_SENSITIVITY |
Motor3=1 |
#define HELI_MAX_THROTTLE |
Motor4=70 |
#define HELI_PITCH_SENSITIVITY |
Motor5=2 |
#define HELI_PITCH_BASE |
Motor6=12 |
#define HELI_MAX_PITCH |
Motor7=50 |
#define HELI_NICK_SENSITIVITY |
Motor8=2 |
#define HELI_ROLL_SENSITIVITY |
Motor9=2 |
#define HELI_NICK_GYRO_SENSITIVITY |
Motor10=16 |
#define HELI_ROLL_GYRO_SENSITIVITY |
Motor11=8 |
#define HELI_YAW_SENSITIVITY |
Motor12=4 |
[Roll] |
Motor1=8 |
#define HELI_YAW_GYRO_SENSITIVITY |
Motor1=55 |
#define HELI_YAW_BASE |
Motor2=0 |
Motor3=0 |
Motor4=0 |
Motor5=12 |
Motor5=0 |
Motor6=0 |
Motor7=0 |
Motor8=0 |
41,11 → 54,17 |
Motor11=0 |
Motor12=0 |
[Yaw] |
Motor1=45 |
#define HELI_SERVO1_TRIM |
Motor1=0 |
#define HELI_SERVO2_TRIM |
Motor2=0 |
#define HELI_SERVO3_TRIM |
Motor3=0 |
#define HELI_SERVO4_TRIM |
Motor4=0 |
#define HELI_SERVO5_TRIM |
Motor5=0 |
#define HELI_SERVO6_TRIM |
Motor6=0 |
Motor7=0 |
Motor8=0 |
/branches/V0.76g-acid/fc.c |
---|
162,14 → 162,7 |
#define LIMIT_MIN(value, min) {if(value < min) value = min;} |
#define LIMIT_MAX(value, max) {if(value > max) value = max;} |
#define LIMIT_MIN_MAX(value, min, max) {if(value < min) value = min; else if(value > max) value = max;} |
uint8_t servoValues[6] = { 127, 127, 127, 127, 127 , 127 }; |
uint8_t MakeByte(int16_t i) { |
if (i < 0) return 0; |
if (i > 255) return 255; |
return i; |
} |
int MotorSmoothing(int neu, int alt) |
{ |
int motor; |
478,10 → 471,21 |
{ |
unsigned char i; |
if(!MotorenEin) |
{ |
MikroKopterFlags &= ~(FLAG_MOTOR_RUN | FLAG_FLY); |
else |
MikroKopterFlags |= FLAG_MOTOR_RUN; |
for(i=0;i<MAX_MOTORS;i++) |
{ |
if(!PC_MotortestActive) MotorTest[i] = 0; |
Motor[i] = MotorTest[i]; |
} |
if(PC_MotortestActive) PC_MotortestActive--; |
} |
else MikroKopterFlags |= FLAG_MOTOR_RUN; |
/* DebugOut.Analog[12] = Motor[0]; |
DebugOut.Analog[13] = Motor[1]; |
DebugOut.Analog[14] = Motor[3]; |
DebugOut.Analog[15] = Motor[2];*/ |
//Start I2C Interrupt Mode |
twi_state = 0; |
534,6 → 538,7 |
MIN_GAS = EE_Parameter.Gas_Min; |
} |
//############################################################################ |
// |
void MotorRegler(void) |
592,7 → 597,6 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(SenderOkay > 140) |
{ |
MikroKopterFlags &= ~FLAG_NOTLANDUNG; |
RcLostTimer = EE_Parameter.NotGasZeit * 50; |
if(GasMischanteil > 40 && MotorenEin) |
1164,7 → 1168,7 |
DebugOut.Analog[3] = Mittelwert_AccRoll / 4; |
DebugOut.Analog[4] = MesswertGier; |
DebugOut.Analog[5] = HoehenWert/5; |
//DebugOut.Analog[6] = Aktuell_az;//(Mess_Integral_Hoch / 512);//Aktuell_az; |
DebugOut.Analog[6] = Aktuell_az;//(Mess_Integral_Hoch / 512);//Aktuell_az; |
DebugOut.Analog[8] = KompassValue; |
DebugOut.Analog[9] = UBat; |
DebugOut.Analog[10] = SenderOkay; |
1525,7 → 1529,7 |
modell_fliegt = 1; |
GasMischanteil = MIN_GAS; |
} |
/*// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Mischer und PI-Regler |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
DebugOut.Analog[7] = GasMischanteil; |
1573,69 → 1577,39 |
pd_ergebnis_roll = DiffRoll + SummeRoll / Ki; // PI-Regler für Roll |
tmp_int = (long)((long)Parameter_DynamicStability * (long)(GasMischanteil + abs(GierMischanteil)/2)) / 64; |
if(pd_ergebnis_roll > tmp_int) pd_ergebnis_roll = tmp_int; |
if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int;*/ |
if(pd_ergebnis_roll < -tmp_int) pd_ergebnis_roll = -tmp_int; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Servo Mixer |
// Universal Mixer |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
{ |
int16_t nick, roll, tmp, pitch, throttle; |
int16_t servo[6]; |
#if 1 |
// throttle |
throttle = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + Mixer.Motor[2][0]; |
if (throttle < 0) throttle = 0; |
#include "helimixer.inc"; |
tmp = throttle / Mixer.Motor[3][0]; |
if (tmp > Mixer.Motor[3][1] * 2) tmp = Mixer.Motor[3][1] * 2; |
DebugOut.Analog[7] = tmp; |
if (MotorenEin == 0 || MikroKopterFlags & FLAG_NOTLANDUNG) { |
tmp = 0; |
} |
servo[4] = tmp; |
#else |
// pitch |
pitch = throttle / Mixer.Motor[4][0] + Mixer.Motor[4][2]; |
if (pitch > Mixer.Motor[4][1]) pitch = Mixer.Motor[4][1]; |
servo[0] = -pitch; |
servo[1] = pitch; |
servo[2] = pitch; |
nick = IntegralNick / (EE_Parameter.GyroAccFaktor * 4); |
roll = IntegralRoll / (EE_Parameter.GyroAccFaktor * 4); |
// nick |
nick /= Mixer.Motor[0][1]; |
nick -= PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] / Mixer.Motor[5][0]; |
servo[0] += 127 + Mixer.Motor[0][0] - nick; |
servo[1] += 127 + Mixer.Motor[0][0] + nick; |
servo[2] += 127 + Mixer.Motor[0][0] - nick; |
// roll |
roll /= Mixer.Motor[0][2]; |
roll -= PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] / Mixer.Motor[6][0]; |
servo[0] += roll; |
servo[1] += roll; |
// gier |
tmp = MesswertGier / Mixer.Motor[0][3]; |
servo[3] = 127 + Mixer.Motor[1][1] + tmp + (PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] / Mixer.Motor[7][0]); |
// not used |
servo[5] = 127; |
for(tmp = 0; tmp < 6; tmp++) { |
servoValues[tmp] = MakeByte(servo[tmp]); |
for(i=0; i<MAX_MOTORS; i++) |
{ |
signed int tmp_int; |
if(Mixer.Motor[i][0] > 0) |
{ |
tmp_int = ((long)GasMischanteil * Mixer.Motor[i][0]) / 64L; |
tmp_int += ((long)pd_ergebnis_nick * Mixer.Motor[i][1]) / 64L; |
tmp_int += ((long)pd_ergebnis_roll * Mixer.Motor[i][2]) / 64L; |
tmp_int += ((long)GierMischanteil * Mixer.Motor[i][3]) / 64L; |
tmp_motorwert[i] = MotorSmoothing(tmp_int,tmp_motorwert[i]); // Filter |
tmp_int = tmp_motorwert[i] / STICK_GAIN; |
CHECK_MIN_MAX(tmp_int,MIN_GAS,MAX_GAS); |
Motor[i] = tmp_int; |
} |
DebugOut.Analog[12] = servo[0]; |
DebugOut.Analog[13] = servo[1]; |
DebugOut.Analog[14] = servo[2]; |
DebugOut.Analog[15] = servo[3]; |
DebugOut.Analog[6] = pitch; |
else Motor[i] = 0; |
} |
/* |
if(Poti1 > 20) Motor1 = 0; |
if(Poti1 > 90) Motor6 = 0; |
if(Poti1 > 140) Motor2 = 0; |
//if(Poti1 > 200) Motor7 = 0; |
*/ |
#endif |
} |
/branches/V0.76g-acid/heli.c |
---|
0,0 → 1,4 |
#include <stdio.h> |
uint8_t servoValues[6] = { 127, 127, 127, 127, 127, 127 }; |
/branches/V0.76g-acid/heli.h |
---|
0,0 → 1,23 |
extern uint8_t servoValues[6]; |
#define HELI_NICK_GYRO_SENSITIVITY Mixer.Motor[9][1] |
#define HELI_ROLL_GYRO_SENSITIVITY Mixer.Motor[10][1] |
#define HELI_YAW_GYRO_SENSITIVITY Mixer.Motor[0][2] |
#define HELI_YAW_SENSITIVITY Mixer.Motor[11][1] |
#define HELI_THROTTLE_SENSITIVITY Mixer.Motor[2][1] |
#define HELI_PITCH_SENSITIVITY Mixer.Motor[4][1] |
#define HELI_NICK_SENSITIVITY Mixer.Motor[7][1] |
#define HELI_ROLL_SENSITIVITY Mixer.Motor[8][1] |
#define HELI_MAX_THROTTLE Mixer.Motor[3][1] |
#define HELI_MAX_PITCH Mixer.Motor[6][1] |
#define HELI_THROTTLE_DEADBAND Mixer.Motor[1][1] |
#define HELI_PITCH_BASE Mixer.Motor[5][1] |
#define HELI_YAW_BASE Mixer.Motor[1][2] |
#define HELI_SERVO1_TRIM Mixer.Motor[0][3] |
#define HELI_SERVO2_TRIM Mixer.Motor[1][3] |
#define HELI_SERVO3_TRIM Mixer.Motor[2][3] |
#define HELI_SERVO4_TRIM Mixer.Motor[3][3] |
#define HELI_SERVO5_TRIM Mixer.Motor[4][3] |
#define HELI_SERVO6_TRIM Mixer.Motor[5][3] |
/branches/V0.76g-acid/helimixer.inc |
---|
0,0 → 1,78 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Servo Mixer |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#if 0 |
{ |
} |
#else |
{ |
int16_t nick, roll, tmp, pitch, throttle; |
int16_t servo[6]; |
// throttle |
throttle = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + HELI_THROTTLE_DEADBAND; |
if (throttle < 5) throttle = 0; |
tmp = throttle / HELI_THROTTLE_SENSITIVITY; |
if (tmp > HELI_MAX_THROTTLE * 2) tmp = HELI_MAX_THROTTLE * 2; |
DebugOut.Analog[7] = tmp; |
if (MotorenEin == 0 || MikroKopterFlags & FLAG_NOTLANDUNG) { |
tmp = 0; |
} |
servo[4] = tmp; |
// pitch |
pitch = throttle / HELI_PITCH_SENSITIVITY + HELI_PITCH_BASE; |
if (pitch > HELI_MAX_PITCH) pitch = HELI_MAX_PITCH; |
servo[0] = 127 - pitch; |
servo[1] = 127 + pitch; |
servo[2] = 127 + pitch; |
nick = IntegralNick / (EE_Parameter.GyroAccFaktor * 4); |
roll = IntegralRoll / (EE_Parameter.GyroAccFaktor * 4); |
// nick |
nick /= HELI_NICK_GYRO_SENSITIVITY; |
nick -= PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] / HELI_NICK_SENSITIVITY; |
servo[0] -= nick; |
servo[1] += nick; |
servo[2] -= nick; |
// roll |
roll /= HELI_ROLL_GYRO_SENSITIVITY; |
roll -= PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] / HELI_ROLL_SENSITIVITY; |
servo[0] += roll; |
servo[1] += roll; |
// yaw |
tmp = MesswertGier / HELI_YAW_GYRO_SENSITIVITY; |
servo[3] = 127 + HELI_YAW_BASE + tmp + (PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] * 4 / HELI_YAW_SENSITIVITY); |
// not used |
servo[5] = 127; |
for(tmp = 0; tmp < 6; tmp++) { |
int t; |
t = servo[tmp] + Mixer.Motor[tmp][3]; |
if (t < 0) t = 0; |
else if (t > 255) t = 255; |
servoValues[tmp] = t; |
} |
DebugOut.Analog[12] = servo[0]; |
DebugOut.Analog[13] = servo[1]; |
DebugOut.Analog[14] = servo[2]; |
DebugOut.Analog[15] = servo[3]; |
DebugOut.Analog[6] = pitch; |
} |
#endif |
/branches/V0.76g-acid/main.c |
---|
232,8 → 232,11 |
memcpy(Mixer.Name, "Quadro\0", 11); |
eeprom_write_block(&Mixer, &EEPromArray[EEPROM_ADR_MIXER_TABLE], sizeof(Mixer)); |
} |
printf("\n\rMixer-Config: '%s' (%u Motors)",Mixer.Name,RequiredMotors); |
for(int ii=0;ii<12;ii++) { |
printf("%d %d\n",ii,Mixer.Motor[1][ii]); |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Check Settings |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
342,7 → 345,7 |
GPS_Roll = 0; |
} |
} |
if(!--I2CTimeout) |
if(!--I2CTimeout || MissingMotor) |
{ |
if(!I2CTimeout) |
{ |
/branches/V0.76g-acid/main.h |
---|
86,7 → 86,6 |
extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
extern unsigned char PlatinenVersion; |
extern unsigned char SendVersionToNavi; |
extern unsigned char servoValues[6]; |
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
extern unsigned char GetActiveParamSetNumber(void); |
118,6 → 117,7 |
#include "gps.h" |
#include "spi.h" |
#include "led.h" |
#include "heli.h" |
#ifndef EEMEM |
#define EEMEM __attribute__ ((section (".eeprom"))) |
/branches/V0.76g-acid/makefile |
---|
104,7 → 104,7 |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c printf_P.c timer0.c analog.c menu.c |
SRC += twimaster.c rc.c fc.c GPS.c spi.c led.c Spectrum.c |
SRC += mymath.c |
SRC += mymath.c heli.c |
########################################################################################################## |
/branches/V0.76g-acid/servoboard/servoboard.c |
---|
11,11 → 11,12 |
uint8_t eeprom_neutral_pos[6] EEMEM; |
uint16_t eeprom_pwm_limit[6] EEMEM; |
volatile uint8_t pwm_signal[6]; |
volatile uint8_t pwm_neutral_position[6]; |
volatile uint8_t pwm_position[6]; |
volatile uint16_t pwm_limit[6]; |
volatile uint8_t pwm_active; |
uint8_t pwm_signal[6]; |
uint8_t pwm_neutral_position[6]; |
uint8_t pwm_position[6]; |
uint16_t pwm_limit[6]; |
uint8_t pwm_active; |
uint8_t pwm_status = 1; |
void pwm_init() { |
61,11 → 62,11 |
// check if pwm is configured |
pwm_active = (pwm_limit[0] != 0xffff) ? (1 << SERVO1) : 0; |
pwm_active |= (pwm_limit[1] != 0xffff) ? (2 << SERVO1) : 0; |
pwm_active |= (pwm_limit[2] != 0xffff) ? (3 << SERVO1) : 0; |
pwm_active |= (pwm_limit[3] != 0xffff) ? (4 << SERVO1) : 0; |
pwm_active |= (pwm_limit[4] != 0xffff) ? (5 << SERVO1) : 0; |
pwm_active |= (pwm_limit[5] != 0xffff) ? (6 << SERVO1) : 0; |
pwm_active |= (pwm_limit[1] != 0xffff) ? (1 << SERVO2) : 0; |
pwm_active |= (pwm_limit[2] != 0xffff) ? (1 << SERVO3) : 0; |
pwm_active |= (pwm_limit[3] != 0xffff) ? (1 << SERVO4) : 0; |
pwm_active |= (pwm_limit[4] != 0xffff) ? (1 << SERVO5) : 0; |
pwm_active |= (pwm_limit[5] != 0xffff) ? (1 << SERVO6) : 0; |
} |
130,14 → 131,21 |
if (pwm_active == 0) { // not configured |
blink = 50; |
pwm_status = 1; |
} else { |
if (I2C_timeout == 0) { // no i2c signal |
blink = 0; |
pwm_status = 2; |
} else { |
I2C_timeout--; |
if (I2C_timeout == 0) { |
set_pwm_neutral(); |
set_pwm(); |
} |
blink = 5; |
pwm_status = 0; |
} |
} |
/branches/V0.76g-acid/servoboard/servoboard.h |
---|
1,11 → 1,12 |
#define VERSION "0.3" |
#define VERSION "0.32" |
extern volatile uint8_t pwm_position[6]; |
extern volatile uint8_t pwm_neutral_position[6]; |
extern volatile uint16_t pwm_limit[6]; |
extern volatile uint8_t pwm_active; |
extern uint8_t pwm_position[6]; |
extern uint8_t pwm_neutral_position[6]; |
extern uint16_t pwm_limit[6]; |
extern uint8_t pwm_active; |
extern uint8_t pwm_status; |
void set_pwm(); |
/branches/V0.76g-acid/servoboard/twislave.c |
---|
33,7 → 33,7 |
Byte_Counter = 0; |
return; |
case SR_PREV_ACK: |
I2C_timeout = 5; |
I2C_timeout = 3; |
if (Byte_Counter < 32) { |
I2C_RXBuffer[Byte_Counter++] = TWDR; |
} |
/branches/V0.76g-acid/servoboard/uart.c |
---|
12,6 → 12,7 |
uint8_t rx_pos, tx_pos; |
uint8_t current_servo = 0; |
void uart_init() { |
rx_pos = 0; |
/branches/V0.76g-acid/version.txt |
---|
343,7 → 343,7 |
!!!ACHTUNG!!! - diese version ist experimentell und nicht fuer den mikrokopter geeignet |
HeliCTRL v0.0.1 |
HeliCTRL v0.2 |
Servo board I2C address 0x82 |
355,12 → 355,13 |
byte[2] - servo 3 |
byte[3] - servo 4 |
byte[4] - servo 5 |
byte[4] - servo 6 |
byte[5] - crc |
servo 1 nick |
servo 2 roll |
servo 3 pitch |
servo 4 gier |
servo 4 yaw |
servo 5 throttle |
servo 6 unused |
367,42 → 368,30 |
Mixer settings |
Nick |
motor 1 |
THROTTLE_DEADBAND Motor 2 |
THROTTLE_SENSITIVITY Motor 3 |
MAX_THROTTLE Motor 4 |
PITCH_SENSITIVITY Motor 5 |
PITCH_BASE Motor 6 |
MAX_PITCH Motor 7 |
NICK_SENSITIVITY Motor 8 |
ROLL_SENSITIVITY Motor 9 |
NICK_GYRO_SENSITIVITY Motor 10 |
ROLL_GYRO_SENSITIVITY Motor 11 |
YAW_SENSITIVITY Motor 12 |
1 nick/roll base value |
2 nick gyro sensitivity 32 |
3 roll gyro sensitivity 16 |
4 gier gyro sensitivity 20 |
Roll |
motor 2 |
YAW_GYRO_SENSITIVITY Motor 1 |
YAW_BASE Motor 2 |
1 gier smoothing 20 |
2 gier base 0 |
Yaw |
motor 3 |
1 throttle deadband 113 |
motor 4 |
1 throttle sensitivity 1 |
2 max throttle 75 |
motor 5 |
1 pitch sensitivity 6 |
2 max pitch 60 |
3 pitch base 30 |
motor 6 |
1 nick sensitivity 4 |
motor 7 |
1 roll sensitivity 4 |
motor 8 |
1 gier sensitivity 4 |
SERVO1_TRIM Motor 1 |
SERVO2_TRIM Motor 2 |
SERVO3_TRIM Motor 3 |
SERVO4_TRIM Motor 4 |
SERVO5_TRIM Motor 5 |
SERVO6_TRIM Motor 6 |