Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2189 - 1
#ifndef CONSTANTS_h
2
#define CONSTANTS_h
3
 
4
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
5
#define PI 3.1415926535897932384626433832795
6
#define DEG_TO_RAD 0.017453292519943295769236907684886
7
#define RAD_TO_DEG 57.295779513082320876798154814105
8
#define ToRad(x) ((x)*DEG_TO_RAD)  // *pi/180
9
#define degrees(rad) ((rad)*RAD_TO_DEG)
10
#define INT16DEG_PI_FACTOR ((1L<<15) / PI)
11
 
12
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
13
/*
14
 * rotations.h
15
 * Copyright (C) Andrew Tridgell 2012
16
 *
17
 * This file is free software: you can redistribute it and/or modify it
18
 * under the terms of the GNU General Public License as published by the
19
 * Free Software Foundation, either version 3 of the License, or
20
 * (at your option) any later version.
21
 *
22
 * This file is distributed in the hope that it will be useful, but
23
 * WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
25
 * See the GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License along
28
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
29
 */
30
 
31
// these rotations form a full set - every rotation in the following
32
// list when combined with another in the list forms an entry which is
33
// also in the list. This is an important property. Please run the
34
// rotations test suite if you add to the list.
35
 
36
// these rotation values are stored to EEPROM, so be careful not to
37
// change the numbering of any existing entry when adding a new entry.
38
enum Rotation {
39
        ROTATION_NONE = 0,
40
        ROTATION_YAW_45,
41
        ROTATION_YAW_90,
42
        ROTATION_YAW_135,
43
        ROTATION_YAW_180,
44
        ROTATION_YAW_225,
45
        ROTATION_YAW_270,
46
        ROTATION_YAW_315,
47
        ROTATION_ROLL_180,
48
        ROTATION_ROLL_180_YAW_45,
49
        ROTATION_ROLL_180_YAW_90,
50
        ROTATION_ROLL_180_YAW_135,
51
        ROTATION_PITCH_180,
52
        ROTATION_ROLL_180_YAW_225,
53
        ROTATION_ROLL_180_YAW_270,
54
        ROTATION_ROLL_180_YAW_315,
55
    ROTATION_MAX
56
};
57
 
58
#endif