PilotController — abstract interface that produces VehicleControls from input. Subclasses read from InputSubsystem and apply context-appropriate response curves.
| 10 | // PilotController — abstract interface that produces VehicleControls from input. |
| 11 | // Subclasses read from InputSubsystem and apply context-appropriate response curves. |
| 12 | class PilotController |
| 13 | { |
| 14 | public: |
| 15 | virtual ~PilotController() = default; |
| 16 | |
| 17 | // Produce controls for this frame |
| 18 | virtual VehicleControls Poll(float deltaT) = 0; |
| 19 | |
| 20 | // Which input context this controller serves |
| 21 | virtual InputContext GetContext() const = 0; |
| 22 | |
| 23 | // Response curve configuration |
| 24 | void SetSteeringCurve(ResponseCurve curve) { steeringCurve_ = curve; } |
| 25 | void SetThrottleCurve(ResponseCurve curve) { throttleCurve_ = curve; } |
| 26 | void SetPitchCurve(ResponseCurve curve) { pitchCurve_ = curve; } |
| 27 | void SetRollCurve(ResponseCurve curve) { rollCurve_ = curve; } |
| 28 | void SetYawCurve(ResponseCurve curve) { yawCurve_ = curve; } |
| 29 | |
| 30 | const ResponseCurve& GetSteeringCurve() const { return steeringCurve_; } |
| 31 | const ResponseCurve& GetThrottleCurve() const { return throttleCurve_; } |
| 32 | const ResponseCurve& GetPitchCurve() const { return pitchCurve_; } |
| 33 | const ResponseCurve& GetRollCurve() const { return rollCurve_; } |
| 34 | const ResponseCurve& GetYawCurve() const { return yawCurve_; } |
| 35 | |
| 36 | protected: |
| 37 | ResponseCurve steeringCurve_ = ResponseCurve::Stick(); |
| 38 | ResponseCurve throttleCurve_ = ResponseCurve::Trigger(); |
| 39 | ResponseCurve pitchCurve_ = ResponseCurve::Stick(); |
| 40 | ResponseCurve rollCurve_ = ResponseCurve::Stick(); |
| 41 | ResponseCurve yawCurve_ = ResponseCurve::Stick(); |
| 42 | }; |
| 43 | } // namespace Poseidon |
| 44 |