xyControl
0.1
Quadrotor Flight Controller on AVR Basis
Main Page
Modules
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
include
config.h
Go to the documentation of this file.
1
/*
2
* config.h
3
*
4
* Copyright (c) 2013, Thomas Buck <xythobuz@me.com>
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
10
*
11
* - Redistributions of source code must retain the above copyright notice,
12
* this list of conditions and the following disclaimer.
13
*
14
* - Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in the
16
* documentation and/or other materials provided with the distribution.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
*/
30
#ifndef _config_h
31
#define _config_h
32
42
// -----------------
43
// | Filtering |
44
// -----------------
45
46
#define FILTER_KALMAN 0
47
#define FILTER_COMPLEMENTARY 1
48
#define ORIENTATION_FILTER FILTER_KALMAN
55
#define COMPLEMENTARY_TAU 0.5
56
57
// 1 has no effect, bigger numbers dampen the signal more
58
#define SOFTWARELOWPASS 1
59
#define ACCFILTERFACTOR SOFTWARELOWPASS
60
#define GYROFILTERFACTOR SOFTWARELOWPASS
62
#define PID_OUTMAX 256
63
#define PID_OUTMIN -256
64
#define PID_INTMAX PID_OUTMAX
65
#define PID_INTMIN PID_OUTMIN
67
// -----------------
68
// | Kalman |
69
// -----------------
70
72
#define DT 0.01f // 100Hz
73
74
// Q (3x3 Matrix) with these elements on diagonal
75
#define Q1 5.0f
76
#define Q2 100.0f
77
#define Q3 0.01f
79
// R (2x2 Matrix) with these elements on diagonal
80
#define R1 1000.0f
81
#define R2 1000.0f
83
// -----------------
84
// | Set |
85
// -----------------
86
87
#define SET_ROLLPLUS 1
88
#define SET_ROLLMINUS 3
89
#define SET_PITCHPLUS 0
90
#define SET_PITCHMINUS 2
92
// -----------------
93
// | PID |
94
// -----------------
95
96
#define PID_P 5.0
97
#define PID_I 0.03
98
#define PID_D -13.0
100
// -----------------
101
// | Motor |
102
// -----------------
103
104
#define MOTORCOUNT 4
106
// -----------------
107
// | ADC |
108
// -----------------
109
110
#define BATT_MAX 15
111
#define BATT_CHANNEL 0
113
// -----------------
114
// | TWI |
115
// -----------------
116
117
#define ACC_ADDRESS 0x32
118
#define GYRO_ADDRESS 0xD6
119
#define MAG_ADDRESS 0x3C
120
#define MOTOR_BASEADDRESS 0x52
122
// -----------------
123
// | xyControl |
124
// -----------------
125
126
#define LED0PORT PORTL
127
#define LED0DDR DDRL
128
#define LED0PIN PL6
129
#define LED1PORT PORTL
130
#define LED1DDR DDRL
131
#define LED1PIN PL7
132
#define LED2PORT PORTG
133
#define LED2DDR DDRG
134
#define LED2PIN PG5
135
#define LED3PORT PORTE
136
#define LED3DDR DDRE
137
#define LED3PIN PE2
139
// -----------------
140
// | XMEM |
141
// -----------------
142
143
#define BANK0PORT PORTG
144
#define BANK0DDR DDRG
145
#define BANK0PIN PG3
146
#define BANK1PORT PORTG
147
#define BANK1DDR DDRG
148
#define BANK1PIN PG4
149
#define BANK2PORT PORTL
150
#define BANK2DDR DDRL
151
#define BANK2PIN PL5
153
// -----------------
154
// | SPI |
155
// -----------------
156
157
#define SPIDDR DDRB
158
#define SPIMOSI PB2
159
#define SPISCK PB1
160
#define SPISS PB0
162
// -----------------
163
// | Serial |
164
// -----------------
165
166
#define RX_BUFFER_SIZE 64
167
#define TX_BUFFER_SIZE 64
169
#endif
170
Generated by
1.8.3.1