File: sfmmodel.h

package info (click to toggle)
searchandrescue 0.8.2-10
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,656 kB
  • ctags: 6,111
  • sloc: ansic: 89,072; cpp: 7,691; sh: 90; makefile: 80
file content (173 lines) | stat: -rw-r--r-- 5,993 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
		 SAR Flight Model - Flight Dynamics Model

	Contains the flight dyanmics parameters for simulation of
	each model.

	When adding a parameter, make sure the functions;
	SFMModelChangeValues() and SFMModelUndefineValue() get updated
	to support the new parameter.
 */

#ifndef SFMMODEL_H
#define SFMMODEL_H

#include "sfmtypes.h"


/*
 *	Flight model defined parameter flags:
 */
#define SFMFlagFlightModelType		((SFMFlags)1 << 0)
#define SFMFlagPosition			((SFMFlags)1 << 1)
#define SFMFlagDirection		((SFMFlags)1 << 2)
#define SFMFlagVelocityVector		((SFMFlags)1 << 3)
#define SFMFlagSpeed			((SFMFlags)1 << 4)
#define SFMFlagSpeedStall		((SFMFlags)1 << 5)
#define SFMFlagDragMin			((SFMFlags)1 << 6)
#define SFMFlagSpeedMax			((SFMFlags)1 << 7)	/* And overspeed_expected and overspeed. */
#define SFMFlagAccelResponsiveness	((SFMFlags)1 << 8)
#define SFMFlagGroundElevation		((SFMFlags)1 << 9)
#define SFMFlagServiceCeiling		((SFMFlags)1 << 10)
#define SFMFlagBellyHeight		((SFMFlags)1 << 11)
#define SFMFlagGearState		((SFMFlags)1 << 12)	/* Landing gear state. */
#define SFMFlagGearType			((SFMFlags)1 << 13)
#define SFMFlagGearHeight               ((SFMFlags)1 << 14)
#define SFMFlagGearBrakesState		((SFMFlags)1 << 15)
#define SFMFlagGearTurnVelocityOptimul	((SFMFlags)1 << 16)
#define SFMFlagGearTurnVelocityMax	((SFMFlags)1 << 17)
#define SFMFlagGearTurnRate		((SFMFlags)1 << 18)
#define SFMFlagLandedState		((SFMFlags)1 << 19)
#define SFMFlagGroundContactType	((SFMFlags)1 << 20)
#define SFMFlagHeadingControlCoeff	((SFMFlags)1 << 21)
#define SFMFlagBankControlCoeff		((SFMFlags)1 << 22)
#define SFMFlagPitchControlCoeff	((SFMFlags)1 << 23)
#define SFMFlagThrottleCoeff		((SFMFlags)1 << 24)
#define SFMFlagAfterBurnerState		((SFMFlags)1 << 25)
#define SFMFlagAfterBurnerPowerCoeff	((SFMFlags)1 << 26)
#define SFMFlagEnginePower		((SFMFlags)1 << 27)
#define SFMFlagTotalMass		((SFMFlags)1 << 28)
#define SFMFlagAttitudeChangeRate	((SFMFlags)1 << 29)
#define SFMFlagAttitudeLevelingRate	((SFMFlags)1 << 30)
#define SFMFlagAirBrakesState		((SFMFlags)1 << 31)
#define SFMFlagAirBrakesRate		((SFMFlags)1 << 32)
#define SFMFlagCanCrashIntoOther	((SFMFlags)1 << 33)
#define SFMFlagCanCauseCrash		((SFMFlags)1 << 34)
#define SFMFlagCrashContactShape	((SFMFlags)1 << 35)
#define SFMFlagCrashableSizeRadius	((SFMFlags)1 << 36)
#define SFMFlagCrashableSizeZMin	((SFMFlags)1 << 37)
#define SFMFlagCrashableSizeZMax	((SFMFlags)1 << 38)
#define SFMFlagTouchDownCrashResistance	((SFMFlags)1 << 39)
#define SFMFlagCollisionCrashResistance ((SFMFlags)1 << 40)


/*
 *	Flight model types:
 */
#define SFMFlightModelAirplane		0
#define SFMFlightModelHelicopter	1
#define SFMFlightModelSlew		2


/*
 *	Landing gear types:
 */
#define SFMGearTypeWheels		0
#define SFMGearTypeSkis			1
#define SFMGearTypeFloats		2


/*
 *	Ground types:
 */
#define SFMGroundTypeLandUnpaved	0
#define SFMGroundTypeLandPaved		1
#define SFMGroundTypeWaterCalm		2
#define SFMGroundTypeWaterRough		3

/*
 *	Crash contact shapes:
 */
#define SFMCrashContactShapeSpherical	0
#define SFMCrashContactShapeCylendrical	1



/*
 *	Flight Dynamics Model structure:
 *
 *	Generally, units for position are in meters and
 *	velocity/speed/rate are in meters per cycle.
 */
typedef struct {

	/* Flags indicating which parameters (members in the
	 * structure) are defined (non-garbage). Since the
	 * SFMFlags type has up to 64 bits, we can have up to
	 * 64 defineable members in this structure, use them
	 * wisely! Members marked as `internal' do not have
	 * an associated flag.
	 */
	SFMFlags	flags;

	int			type;		/* One of SFMFlightModel*. */
	SFMPositionStruct	position;	/* Meters. */
	SFMDirectionStruct	direction;	/* Radians. */
	SFMPositionStruct	velocity_vector;	/* Meters/cycle. */
	SFMPositionStruct	slew_velocity_vector;	/* Internal, used only
							 * when type is set to
							 * SFMFlightModelSlew.
							 */
	double			speed;		/* Meters/cycle. */
	double			speed_stall,	/* Meters/cycle. */
				stall_coeff;	/* Internal. */
	double			drag_min;	/* Meters/cycle. */
	double			speed_max;	/* Meters/cycle. */
	double			overspeed_expected;	/* Meters/cycle. */
	double			overspeed;	/* Meters/cycle. */
	SFMPositionStruct	accel_responsiveness;
	double			ground_elevation_msl;	/* Meters. */
	double			service_ceiling;	/* Meters. */
	double			belly_height;	/* Undercarrage to center, meters. */
	SFMBoolean		gear_state;	/* True when down. */
	int			gear_type;	/* One of SFMGearType*. */
	double			gear_height;	/* Meters. */
	SFMBoolean		gear_brakes_state;
	double			gear_turn_velocity_optimul;	/* Meters/cycle. */
	double			gear_turn_velocity_max;	/* Meters/cycle. */
	double			gear_turn_rate;
	SFMBoolean		landed_state;	/* True if landed. */
	int			ground_contact_type;	/* One of SFMGroundType*. */
	double			center_to_ground_height;	/* Internal, center of
								 * object to touchable
								 * ground height,
								 * in meters.
								 */
	double			heading_control_coeff;	/* -1.0 to 1.0. */
	double			pitch_control_coeff;	/* -1.0 to 1.0. */
	double			bank_control_coeff;	/* -1.0 to 1.0. */
	double			elevator_trim_coeff;	/* -1.0 to 1.0. */
	double			throttle_coeff;		/* 0.0 to 1.0. */
	SFMBoolean		after_burner_state;
	double			after_burner_power_coeff;	/* Times engine power. */
	double			engine_power;		/* In kg * m / cycle^2. */
	double			total_mass;		/* In kg. */
	SFMDirectionStruct	attitude_change_rate;	/* Radians/cycle, */
	SFMDirectionStruct	attitude_leveling_rate;	/* Radians/cycle. */
	SFMBoolean		air_brakes_state;
	double			air_brakes_rate;	/* In meters per cycle. */
	SFMBoolean		can_crash_into_other;
	SFMBoolean		can_cause_crash;
	int			crash_contact_shape;	/* One of SFMCrashContactShape*. */
	double			crashable_size_radius;	/* Meters. */
	double			crashable_size_z_min;	/* Meters. */
	double			crashable_size_z_max;	/* Meters. */
	double			touch_down_crash_resistance;	/* Meters/cycle. */
	double			collision_crash_resistance;	/* Meters/cycle. */

} SFMModelStruct;




#endif	/* SFMMODEL_H */