53f09ff6a5
""" - ground properties (e.g. feel bumpiness and the reduced friction of grass or go swimming with the beaver) - initial load for yasim gears (to get rid of the jitter the beaver has on ground) - glider/winch/aerotow (do winch start with YASim glider or do aerotow over the net) I will place a how-to on the wiki soon, here very short: use the sgs233y (or the bocian if you have AJ (up ot now) non-GPL bocian) winch start: Ctrl-w for placing the winch, hold w to winch, press Shift-w to release the tow aerotow: Place the glider within 60m to a MP-aircraft, press Ctrl-t to tow to this aircraft. If the MP-aircraft is the J3 and the patch is installed on both sides, the J3 feels the forces, too. The J3-pilot has to taxi very slow up to the moment, the glider starts moving. Increase the throttle gently. Don't lift the J3 early, wait for the glider being lifted, lift gently. """
87 lines
3 KiB
C++
87 lines
3 KiB
C++
#ifndef _CONTROL_MAP_HPP
|
|
#define _CONTROL_MAP_HPP
|
|
|
|
#include "Vector.hpp"
|
|
|
|
namespace yasim {
|
|
|
|
class ControlMap {
|
|
public:
|
|
~ControlMap();
|
|
|
|
enum OutputType { THROTTLE, MIXTURE, CONDLEVER, STARTER, MAGNETOS,
|
|
ADVANCE, REHEAT, PROP,
|
|
BRAKE, STEER, EXTEND, HEXTEND, LEXTEND,
|
|
INCIDENCE, FLAP0, FLAP1, SLAT, SPOILER, VECTOR,
|
|
BOOST, CASTERING, PROPPITCH, PROPFEATHER,
|
|
COLLECTIVE, CYCLICAIL, CYCLICELE, ROTORENGINEON,
|
|
ROTORBRAKE,
|
|
REVERSE_THRUST, WASTEGATE,
|
|
WINCHRELSPEED, HITCHOPEN, PLACEWINCH, FINDAITOW};
|
|
|
|
enum { OPT_SPLIT = 0x01,
|
|
OPT_INVERT = 0x02,
|
|
OPT_SQUARE = 0x04 };
|
|
|
|
// Returns a new, not-yet-used "input handle" for addMapping and
|
|
// setInput. This typically corresponds to one user axis.
|
|
int newInput();
|
|
|
|
// Adds a mapping to between input handle and a particular setting
|
|
// on an output object. The value of output MUST match the type
|
|
// of object!
|
|
void addMapping(int input, int output, void* object, int options=0);
|
|
|
|
// An additional form to specify a mapping range. Input values
|
|
// outside of [src0:src1] are clamped, and are then mapped to
|
|
// [dst0:dst1] before being set on the object.
|
|
void addMapping(int input, int output, void* object, int options,
|
|
float src0, float src1, float dst0, float dst1);
|
|
|
|
// Resets our accumulated input values. Call before any
|
|
// setInput() invokations.
|
|
void reset();
|
|
|
|
// Sets the specified input (as returned by newInput) to the
|
|
// specified value.
|
|
void setInput(int input, float value);
|
|
|
|
// Calculates and applies the settings received since the last reset().
|
|
void applyControls(float dt);
|
|
|
|
// Returns the input/output range appropriate for the given
|
|
// control. Ailerons go from -1 to 1, while throttles are never
|
|
// lower than zero, etc...
|
|
static float rangeMin(int type);
|
|
static float rangeMax(int type);
|
|
|
|
// Each output record is identified by both an object/type tuple
|
|
// and a numeric handle.
|
|
int getOutputHandle(void* obj, int type);
|
|
|
|
// Sets the transition time for the control output to swing
|
|
// through its full range.
|
|
void setTransitionTime(int handle, float time);
|
|
|
|
// Retrieves the current value of the control output. Controls
|
|
// with OPT_SPLIT settable on inputs will have a separately
|
|
// computed "right side" value.
|
|
float getOutput(int handle);
|
|
float getOutputR(int handle);
|
|
|
|
private:
|
|
struct OutRec { int type; void* object; Vector maps;
|
|
float oldL, oldR, time; };
|
|
struct MapRec { OutRec* out; int idx; int opt; float val;
|
|
float src0; float src1; float dst0; float dst1; };
|
|
|
|
// A list of (sub)Vectors containing a bunch of MapRec objects for
|
|
// each input handle.
|
|
Vector _inputs;
|
|
|
|
// An unordered list of output settings.
|
|
Vector _outputs;
|
|
};
|
|
|
|
}; // namespace yasim
|
|
#endif // _CONTROL_MAP_HPP
|