本文整理汇总了C++中Track::GetAngleOfArrival方法的典型用法代码示例。如果您正苦于以下问题:C++ Track::GetAngleOfArrival方法的具体用法?C++ Track::GetAngleOfArrival怎么用?C++ Track::GetAngleOfArrival使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Track
的用法示例。
在下文中一共展示了Track::GetAngleOfArrival方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
/******************************************************************************
*
* Name: Run
*
* Description: Performs the main function of the thread.
*
* Attributes: None
*
* Return: N/A
*
* Author: Austin Dionne
*
******************************************************************************/
void CMControllerThread::Run(void)
{
try
{
// This task loops forever, updating the CM.
while (true)
{
// This loop will search for the highest priority track. If expired
// tracks are found it will remove them and continue searching.
// The loop terminates when a valid track is found and the CM is
// directed at the track, or when there are no tracks left.
bool doneTrackLoop = false;
while (!doneTrackLoop)
{
// Get the highest priority threat.
Track* track = trackDatabase->GetFirstTrack();
if (track == NULL)
{
// There are no more tracks to jam. If the countermeasure was
// previously enabled, send the TurnOffCM message.
if (enabledCM)
{
enabledCM = false;
MCCMTransceiver::Instance()->SendTurnOffCMMessage();
}
// The track loop is done.
doneTrackLoop = true;
}
else
{
// Determine if the track is still a threat.
if (track->GetTimeOfArrival() > SystemClock::Instance()->GetCurrentTime())
{
// Look up the threat type in the threat database in order to determine
// the jam code to use.
Threat* threat = threatDatabase->FindThreatByID(track->GetThreatID());
// Determine the azimuth in platform coordinates to direct the CM.
float targetAzimuth = track->GetAngleOfArrival() -
PlatformOrientation::Instance()->GetCurrentAzimuth();
// Keep the calculated azimuth within the valid range.
if (targetAzimuth > 360.0)
{
targetAzimuth -= 360.0;
}
else if (targetAzimuth < 0.0)
{
targetAzimuth += 360.0;
}
// Send the AllocateCM message via the MCCMTransceiver.
enabledCM = true;
MCCMTransceiver::Instance()->SendAllocateCMMessage(targetAzimuth, threat->GetJamCode());
// The track loop is done.
doneTrackLoop = true;
}
else
{
// The track has expired. Remove it from the track database and the
// next iteration of the loop will attempt to find a valid track.
trackDatabase->RemoveFirstTrack();
}
}
}
/* The following code does not work with the current version of Mother,
because Mother can not respond to AllocateCM messages quickly enough.
// Determine whether or not the countermeasure will require updating
// faster than the normal rate. If the current angular velocity of the
// platform is great enough that we will not stay within the tolerable
// error, no delay will occur before the next CM update. Note that the
// default CM update delay is in milliseconds.
float expectedError = abs(PlatformOrientation::Instance()->GetCurrentAngularVelocity()
* DEFAULT_CM_UPDATE_DELAY / 1000.0);
if (expectedError < MAXIMUM_CM_ERROR_TOLERANCE)
{
Sleep(DEFAULT_CM_UPDATE_DELAY);
}
*/
Sleep(DEFAULT_CM_UPDATE_DELAY);
}
//.........这里部分代码省略.........