41 #include "input_output/FGPropertyManager.h" 42 #include "models/FGSurface.h" 48 IDENT(IdSrc,
"$Id: FGSurface.cpp,v 1.5 2014/01/28 09:42:21 ehofman Exp $");
49 IDENT(IdHdr,ID_SURFACE);
59 FGSurface::FGSurface(
FGFDMExec* fdmex,
int number) :
62 eSurfaceType = ctBOGEY;
79 maximumForce = DBL_MAX;
86 void FGSurface::bind(
void)
88 if (!_PropertyManager)
return;
90 string base_property_name;
93 switch(eSurfaceType) {
95 base_property_name = _CreateIndexedPropertyName(
"gear/unit", contactNumber);
98 base_property_name = _CreateIndexedPropertyName(
"contact/unit", contactNumber);
101 base_property_name =
"ground";
107 property_name = base_property_name +
"/solid";
108 _PropertyManager->
Tie( property_name.c_str(), &isSolid);
109 property_name = base_property_name +
"/bumpiness";
110 _PropertyManager->
Tie( property_name.c_str(), &bumpiness);
111 property_name = base_property_name +
"/maximum-force-lbs";
112 _PropertyManager->
Tie( property_name.c_str(), &maximumForce);
113 property_name = base_property_name +
"/rolling_friction-factor";
114 _PropertyManager->
Tie( property_name.c_str(), &rollingFFactor);
115 property_name = base_property_name +
"/static-friction-factor";
116 _PropertyManager->
Tie( property_name.c_str(), &staticFFactor);
123 if (bumpiness < 0.001)
return 0.0f;
125 double x = pos[0]*0.1;
126 double y = pos[1]*0.1;
136 static const float maxGroundBumpAmplitude=0.4;
137 float h = sin(x)+sin(7*x)+sin(8*x)+sin(13*x);
138 h += sin(2*y)+sin(5*y)+sin(9*y*x)+sin(17*y);
140 return h*(1/8.)*bumpiness*maxGroundBumpAmplitude;
145 string FGSurface::_CreateIndexedPropertyName(
const string& Property,
int index)
147 std::ostringstream buf;
148 buf << Property <<
'[' << index <<
']';
154 string FGSurface::GetSurfaceStrings(
string delimeter)
const 156 std::ostringstream buf;
158 buf <<
"staticFFactor" << delimeter
159 <<
"rollingFFactor" << delimeter
160 <<
"maximumForce" << delimeter
161 <<
"bumpiness" << delimeter
169 string FGSurface::GetSurfaceValues(
string delimeter)
const 171 std::ostringstream buf;
173 buf << staticFFactor << delimeter
174 << rollingFFactor << delimeter
175 << maximumForce << delimeter
176 << bumpiness << delimeter
177 << (isSolid ?
"1" :
"0");
FGPropertyManager * GetPropertyManager(void)
Returns a pointer to the property manager object.
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
float GetBumpHeight()
Returns the height of the bump at the provided offset.
void resetValues(void)
Reset all surface values to a default.
Encapsulates the JSBSim simulation executive.