| 1 | /* |
| 2 | * groundreactions.hxx |
| 3 | * caclulate ground reactions based on ground properties and weather scenarios |
| 4 | * |
| 5 | * SPDX-FileCopyrightText: (C) 2023 Erik Hofman <erik@ehof,am.com> |
| 6 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | #pragma once |
| 11 | |
| 12 | # include <float.h> |
| 13 | |
| 14 | #include <simgear/math/SGMath.hxx> |
| 15 | |
| 16 | class GroundReactions |
| 17 | { |
| 18 | public: |
| 19 | GroundReactions(); |
| 20 | ~GroundReactions() = default; |
| 21 | |
| 22 | // call once before processing all gear locations |
| 23 | bool update(simgear::BVHMaterial const*& material); |
| 24 | |
| 25 | // first set the gear position in local frame |
| 26 | void setPosition(const double pt[3]); |
| 27 | |
| 28 | // and the true heading in radians |
| 29 | inline void setHeading(float h) { heading = h; }; |
| 30 | |
| 31 | // then get the bum height at that position |
| 32 | float getGroundDisplacement(); |
| 33 | |
| 34 | inline float getPressure() { return pressure; } |
| 35 | inline float getBumpiness() { return bumpiness; } |
| 36 | inline float getStaticFrictionFactor() { return static_friction_factor; } |
| 37 | inline float getRolingFrictionFactor() { return roling_friction_factor; } |
| 38 | |
| 39 | inline bool getSolid() { return solid; } |
| 40 | |
| 41 | private: |
| 42 | SGPropertyNode_ptr precipitation; |
| 43 | SGPropertyNode_ptr temperature; |
| 44 | SGPropertyNode_ptr dew_point; |
| 45 | SGPropertyNode_ptr ground_wind; |
| 46 | SGPropertyNode_ptr turbulence_gain; |
| 47 | SGPropertyNode_ptr turbulence_rate; |
| 48 | SGPropertyNode_ptr turbulence_model; |
| 49 | |
| 50 | SGPropertyNode_ptr wind_from_north; |
| 51 | SGPropertyNode_ptr wind_from_east; |
| 52 | SGPropertyNode_ptr wind_from_down; |
| 53 | |
| 54 | SGVec3d pos; |
| 55 | float heading; |
| 56 | |
| 57 | float random = 0.0f; |
| 58 | float bumpiness = 0.0f; |
| 59 | float static_friction_factor = 1.0f; |
| 60 | float roling_friction_factor = 1.0f; |
| 61 | float pressure = FLT_MAX; |
| 62 | |
| 63 | bool wet = false; // is it wet? |
| 64 | bool snow = false; // is it snowed over? |
| 65 | bool solid = true; // is it solid ground or water? |
| 66 | bool water_body = false; // if water, can it ge frozen over? |
| 67 | bool frozen = false; // is it actuall frozen? |
| 68 | bool mud = false; // is it mud? |
| 69 | }; |
| 70 |