[Gcblue-commits] gcb_wx/src/sim tcAeroAirObject.cpp,1.18,1.19 tcFlightPort.cpp,1.21,1.22 tcGuidanceS
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2005-07-20 16:25:04
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4256/src/sim Modified Files: tcAeroAirObject.cpp tcFlightPort.cpp tcGuidanceState.cpp tcHeloObject.cpp tcMapData.cpp tcPlatformObject.cpp tcSensorMapTrack.cpp tcSubObject.cpp Log Message: Index: tcSubObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSubObject.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** tcSubObject.cpp 14 Jul 2005 23:42:24 -0000 1.13 --- tcSubObject.cpp 20 Jul 2005 16:24:55 -0000 1.14 *************** *** 610,620 **** UpdateFormationGuidance(); // formation heading/speed calculation - UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ApplyRestrictions(); // crash check Move(dt_s); --- 610,629 ---- UpdateFormationGuidance(); // formation heading/speed calculation ! /* In multiplayer mode, skip command based updates for client objects not controlled ! ** by client. This will cause object to jump more but avoids having to broadcast command ! ** changes to all alliance clients. The controller of the object will see smoother ! ** behavior. ! */ ! if (!IsClientMode() || IsControlled()) ! { ! UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ! ApplyRestrictions(); // crash check ! } Move(dt_s); Index: tcHeloObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcHeloObject.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** tcHeloObject.cpp 28 Jun 2005 02:51:35 -0000 1.5 --- tcHeloObject.cpp 20 Jul 2005 16:24:54 -0000 1.6 *************** *** 145,149 **** void tcHeloObject::UpdateSpeed(float dt_s) { ! tcPlatformObject::UpdateSpeed(dt_s); } --- 145,173 ---- void tcHeloObject::UpdateSpeed(float dt_s) { ! float ds_kts = mcGS.mfGoalSpeed_kts - mcKin.mfSpeed_kts; ! float ds_max = mpDBObject->mfAccel_ktsps*dt_s; ! float ds_min = -ds_max; ! ! if (ds_kts < ds_min) {ds_kts = ds_min;} // restrict to acceleration ! else if (ds_kts > ds_max) {ds_kts = ds_max;} ! mcKin.mfSpeed_kts += ds_kts; ! ! if (mcKin.mfSpeed_kts < 0) mcKin.mfSpeed_kts = 0; ! ! // if a fuel capacity is indicated then update fuel consumption ! if (mpDBObject->mfFuelCapacity_kg > 0) ! { ! // do not allow fuel consumption to be less than a minimum value (hover consumes fuel) ! float fuelConsumptionSpeed = max(mcKin.mfSpeed_kts, 50.0f); ! ! fuel_kg -= dt_s * mpDBObject->GetFuelConsumptionConstant() * fuelConsumptionSpeed; ! if (fuel_kg < 0) fuel_kg = 0; ! ! if (fuel_kg == 0) ! { ! if (mcKin.mfSpeed_kts > 0) mcKin.mfSpeed_kts -= 2*ds_max; ! if (mcKin.mfAlt_m > 0) mcKin.mfAlt_m -= dt_s * 10; ! } ! } } *************** *** 171,182 **** UpdateFormationGuidance(); // formation heading/speed calculation ! // don't use air method since we don't care about roll ! tcPlatformObject::UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ApplyRestrictions(); // crash check Move(dt_s); --- 195,214 ---- UpdateFormationGuidance(); // formation heading/speed calculation ! /* In multiplayer mode, skip command based updates for client objects not controlled ! ** by client. This will cause object to jump more but avoids having to broadcast command ! ** changes to all alliance clients. The controller of the object will see smoother ! ** behavior. ! */ ! if (!IsClientMode() || IsControlled()) ! { ! // don't use air method since we don't care about roll ! tcPlatformObject::UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ApplyRestrictions(); // crash check ! } Move(dt_s); Index: tcGuidanceState.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcGuidanceState.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** tcGuidanceState.cpp 2 Nov 2004 04:23:56 -0000 1.4 --- tcGuidanceState.cpp 20 Jul 2005 16:24:54 -0000 1.5 *************** *** 37,42 **** file.Read(&mfGoalSpeed_kts,sizeof(mfGoalSpeed_kts)); file.Read(&mfGoalAltitude_m,sizeof(mfGoalAltitude_m)); - mcKinIntercept.Serialize(file, true); - file.Read(&mbIntercept,sizeof(mbIntercept)); } else --- 37,40 ---- *************** *** 45,50 **** file.Write(&mfGoalSpeed_kts,sizeof(mfGoalSpeed_kts)); file.Write(&mfGoalAltitude_m,sizeof(mfGoalAltitude_m)); - mcKinIntercept.Serialize(file, false); - file.Write(&mbIntercept,sizeof(mbIntercept)); } } --- 43,46 ---- *************** *** 68,73 **** stream >> mfGoalSpeed_kts; stream >> mfGoalAltitude_m; - mcKinIntercept << stream; - stream >> mbIntercept; return stream; --- 64,67 ---- *************** *** 82,87 **** stream << mfGoalSpeed_kts; stream << mfGoalAltitude_m; - mcKinIntercept >> stream; - stream << mbIntercept; return stream; --- 76,79 ---- Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tcMapData.cpp 16 Jul 2005 23:12:38 -0000 1.23 --- tcMapData.cpp 20 Jul 2005 16:24:54 -0000 1.24 *************** *** 1033,1036 **** --- 1033,1039 ---- { pval = (anMapID==0) ? maGlobal[m][n] : maTheater[m][n]; + + if (pval > 1000) pval = 1000; + if (pval <= 0) { Index: tcFlightPort.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcFlightPort.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** tcFlightPort.cpp 22 Jun 2005 01:22:09 -0000 1.21 --- tcFlightPort.cpp 20 Jul 2005 16:24:54 -0000 1.22 *************** *** 32,35 **** --- 32,37 ---- #include "tcFlightportDBObject.h" #include "tcGenericDBObject.h" + #include "ai/BlackboardInterface.h" + #include "ai/Brain.h" #include "common/tcStream.h" #include "common/tcObjStream.h" *************** *** 971,974 **** --- 973,980 ---- } + /** + * Update the kinematics of entities in launch queue. Called once + * when moving to launch queue. + */ void tcFlightPort::UpdateUnitKin(tcAirState *airstate) { *************** *** 989,1007 **** unit->mcKin.mfLon_rad = childPos.mfLon_rad; - // correct latitude and longitude for relative position on parent - /* - float parent_hdg = parent->mcKin.mfHeading_rad; - float cos_parent_hdg = cosf(parent_hdg); - float sin_parent_hdg = sinf(parent_hdg); - float delta_x_rad = unit->rel_pos.dx*C_MTORAD; - float delta_z_rad = -unit->rel_pos.dz*C_MTORAD; - double delta_lat = delta_z_rad*cos_parent_hdg - delta_x_rad*sin_parent_hdg; - double delta_lon = delta_z_rad*sin_parent_hdg + delta_x_rad*cos_parent_hdg; - delta_lon = delta_lon/cosf((float)parent->mcKin.mfLat_rad); // correct for latitude - unit->mcKin.mfLat_rad += delta_lat; - unit->mcKin.mfLon_rad += delta_lon; - */ ! if (tcAeroAirObject* aa_unit = dynamic_cast<tcAeroAirObject*>(unit)) { aa_unit->mcKin.mfSpeed_kts += 200.0f; --- 995,1013 ---- unit->mcKin.mfLon_rad = childPos.mfLon_rad; ! ! tcAirObject* air_unit = dynamic_cast<tcAirObject*>(unit); ! ! // write base name to unit blackboard to allow it to RTB when mission complete ! if (air_unit != 0) ! { ! ai::Brain* brain = air_unit->GetBrain(); ! wxASSERT(brain); ! ai::BlackboardInterface bb = brain->GetBlackboardInterface(); ! ! bb.Write("Home", parent->mzUnit.mz); ! } ! ! if (tcAeroAirObject* aa_unit = dynamic_cast<tcAeroAirObject*>(air_unit)) { aa_unit->mcKin.mfSpeed_kts += 200.0f; *************** *** 1010,1014 **** aa_unit->SetLandingState(0); } ! else if (tcHeloObject* helo_unit = dynamic_cast<tcHeloObject*>(unit)) { helo_unit->mcKin.mfClimbAngle_rad = 1.5f; --- 1016,1020 ---- aa_unit->SetLandingState(0); } ! else if (tcHeloObject* helo_unit = dynamic_cast<tcHeloObject*>(air_unit)) { helo_unit->mcKin.mfClimbAngle_rad = 1.5f; *************** *** 1017,1021 **** helo_unit->SetLandingState(0); } ! else if (tcAirObject *air_unit = dynamic_cast<tcAirObject*>(unit)) { air_unit->mcKin.mfSpeed_kts += 200.0f; --- 1023,1027 ---- helo_unit->SetLandingState(0); } ! else if (air_unit != 0) { air_unit->mcKin.mfSpeed_kts += 200.0f; Index: tcPlatformObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcPlatformObject.cpp,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** tcPlatformObject.cpp 2 Jul 2005 16:51:12 -0000 1.52 --- tcPlatformObject.cpp 20 Jul 2005 16:24:55 -0000 1.53 *************** *** 226,230 **** if (mpDBObject->mfFuelCapacity_kg > 0) { ! fuel_kg -= dt_s * mpDBObject->GetFuelConsumptionConstant(); if (fuel_kg < 0) fuel_kg = 0; --- 226,230 ---- if (mpDBObject->mfFuelCapacity_kg > 0) { ! fuel_kg -= dt_s * mpDBObject->GetFuelConsumptionConstant() * mcKin.mfSpeed_kts; if (fuel_kg < 0) fuel_kg = 0; *************** *** 699,710 **** stream >> mcGS.mfGoalSpeed_kts; stream >> mcGS.mfGoalAltitude_m; - stream >> mcGS.mbIntercept; - if (mcGS.mbIntercept) - { - mcGS.mcKinIntercept << stream; - } - } - if (updateMask & UPDATE_LAUNCHERS) { --- 699,704 ---- stream >> mcGS.mfGoalSpeed_kts; stream >> mcGS.mfGoalAltitude_m; + } if (updateMask & UPDATE_LAUNCHERS) { *************** *** 782,791 **** stream << mcGS.mfGoalSpeed_kts; stream << mcGS.mfGoalAltitude_m; - - stream << mcGS.mbIntercept; - if (mcGS.mbIntercept) - { - mcGS.mcKinIntercept >> stream; - } } --- 776,779 ---- Index: tcSensorMapTrack.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcSensorMapTrack.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tcSensorMapTrack.cpp 28 Jun 2005 02:51:35 -0000 1.3 --- tcSensorMapTrack.cpp 20 Jul 2005 16:24:55 -0000 1.4 *************** *** 67,72 **** --- 67,74 ---- { stream >> maSensorReport[n].mfTimestamp; + stream >> maSensorReport[n].mnSensorPlatformID; } + stream >> mnDatabaseID; stream >> sensorFlags; *************** *** 85,90 **** --- 87,94 ---- { stream << maSensorReport[n].mfTimestamp; + stream << maSensorReport[n].mnSensorPlatformID; } + stream << mnDatabaseID; stream << sensorFlags; Index: tcAeroAirObject.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcAeroAirObject.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** tcAeroAirObject.cpp 1 Jun 2005 00:13:32 -0000 1.18 --- tcAeroAirObject.cpp 20 Jul 2005 16:24:54 -0000 1.19 *************** *** 50,53 **** --- 50,56 ---- stream >> throttleFraction; + fprintf(stdout, "received aero guidance update, id: %d, HSA %f, %f, %f\n", mnID, + mcGS.mfGoalHeading_deg, mcGS.mfGoalSpeed_kts, mcGS.mfGoalAltitude_m); + return stream; } *************** *** 59,62 **** --- 62,67 ---- stream << throttleFraction; + fprintf(stdout, "sending aero guidance update, id: %d, HSA %f, %f, %f\n", mnID, + mcGS.mfGoalHeading_deg, mcGS.mfGoalSpeed_kts, mcGS.mfGoalAltitude_m); return stream; } *************** *** 200,212 **** } ! UpdateFormationGuidance(); // formation heading/speed calculation ! UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ApplyRestrictions(); // crash check Move(dt_s); --- 205,225 ---- } ! /* In multiplayer mode, skip command based updates for client objects not controlled ! ** by client. This will cause object to jump more but avoids having to broadcast command ! ** changes to all alliance clients. The controller of the object will see smoother ! ** behavior. ! */ ! if (!IsClientMode() || IsControlled()) ! { ! UpdateHeading(dt_s); ! UpdateSpeed(dt_s); ! UpdateClimb(dt_s); ! ApplyRestrictions(); ! } ! UpdateFormationGuidance(); // formation heading/speed calculation Move(dt_s); |