亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sensehandler.c

?? 機器足球2D比賽程序 對trlen_base_2002的改進
?? C
?? 第 1 頁 / 共 3 頁
字號:
/*Copyright (c) 2000-2002, Jelle Kok, University of AmsterdamAll rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University of Amsterdam nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*//*! \file SenseHandler.C<pre><b>File:</b>          SenseHandler.C<b>Project:</b>       Robocup Soccer Simulation Team: UvA Trilearn<b>Authors:</b>       Jelle Kok<b>Created:</b>       28/11/2000<b>Last Revision:</b> $ID$<b>Contents:</b>      This file contains the class SenseHandler that is used               to process the information coming from the server.<hr size=2><h2><b>Changes</b></h2><b>Date</b>             <b>Author</b>          <b>Comment</b>28/11/2000       Jelle Kok       Initial version created</pre>*/#include "SenseHandler.h"#include "ActHandler.h"  // sigalarmHandler#include "Parse.h"#include <signal.h>   // needed for SIGALARM#include <string.h>   // needed for strlen#include <stdio.h>    // needed for printf#include <iostream>   // needed for cout/******************************************************************************//********************** CLASS SENSEHANDLER ************************************//******************************************************************************//*! This function is needed to start the Sense Thread (thread that continually    waits for input and parses the input). This function is needed since it is    not possible to call a method from a class using a thread. So this function    calls handleMessagesFromServer from the SenseHandler class.    \param v pointer to a SenseHandler class.*/void* sense_callback( void *v ){  Log.log( 1, "Starting to listen for server messages" );  SenseHandler* s = (SenseHandler*)v;  s->handleMessagesFromServer( );  return NULL;}/*! Constructor for the SenseHandler. It needs a reference to a connection and    a reference to a worldmodel.    \param c Connection from which input is received    \param wm WorldModel to which new information will be sent for processing    \param ss ServerSettings that contain the parameters used by the server    \param ps PlayerSettings that determine how to interact with messages. */SenseHandler::SenseHandler( Connection *c, WorldModel *wm, ServerSettings *ss,                            PlayerSettings *ps ){  connection             = c;  SS                     = ss;  PS                     = ps;  WM                     = wm;  iSimStep               = SS->getSimulatorStep()*1000;  iTimeSignal            = (int)(iSimStep*0.85);    struct sigaction sigact;  sigact.sa_flags = SA_RESTART; // primitives (recvfrom) should not be unblocked  sigact.sa_handler = (void (*)(int))sigalarmHandler;  sigaction( SIGALRM, &sigact, NULL );  // set timer signal to indicate when ActHandler should sent commands to the  // server, this structure will later be filled with exact timing values  itv.it_interval.tv_sec  = 0;  itv.it_interval.tv_usec = 0;  itv.it_value.tv_sec     = 0;  itv.it_value.tv_usec    = 0;}/*! This is the main routine of this class. It loops forever (till the thread    is destroyed) and receives and parses the incoming messages.   */void SenseHandler::handleMessagesFromServer( ){  char strBuf[MAX_MSG];  int i=0;  while( 1 )  {    strBuf[0]='\0';    if( i != -1 )                                         // if no error      i = connection->receiveMessage( strBuf, MAX_MSG );  // get message    if( strBuf[0] != '\0' )                               // if not empty      analyzeMessage( strBuf );                           // parse message  }}/*! This method sets the time signal. This is the time that should be waited    before the next action should be sent to the server. As soon as a sense    message arrives this method is called. Using the information from the member    variable 'iTriCounter' which denotes when the see message will arrive in    this cycle (0=first half, 1=2nd half, 2=no see, all for the default view    frequency) the timer is set. The values that denote the fraction of the    simulation step that is waited are all defined in PlayerSettings, such that    they can be easily changed. */void SenseHandler::setTimeSignal( ){  if( WM->getAgentViewFrequency() == 1.0 ) // VA_NORMAL AND VQ_HIGH (default)  {    if( iTriCounter % 3 == 0 )             // see will arrive first half cycle    {      iTimeSignal = (int)(iSimStep * PS->getFractionWaitSeeBegin() );      iTriCounter = 0;    }    else if( iTriCounter % 3 == 1 )        // see will arrive 2nd half of cycle    {      iTimeSignal = (int)(iSimStep * PS->getFractionWaitSeeEnd() );    }    else                                   // no see will arrive      iTimeSignal = (int)(iSimStep * PS->getFractionWaitNoSee( ) );  }  else if( WM->getAgentViewFrequency() == 2.0 ) // VA_WIDE AND VQ_HIGH  {    if( iTriCounter % 3 == 0 )              // see will arrive    {      iTimeSignal = (int)(iSimStep * PS->getFractionWaitSeeEnd() );      iTriCounter = 0;    }    else                                   // no see will arrive      iTimeSignal = (int)(iSimStep * PS->getFractionWaitNoSee() );  }  else                                     // VA_NARROW AND VQ_HIGH    iTimeSignal = (int)(iSimStep * PS->getFractionWaitSeeEnd() );  iTriCounter++;  itv.it_value.tv_usec = iTimeSignal;  setitimer( ITIMER_REAL, &itv, NULL );}/*! This method analyzes the type of the incoming message and calls the    message that corresponds to this message.    \param strMsg message that should be parsed.    \return bool indicating whether the message was parsed or not */bool SenseHandler::analyzeMessage( char *strMsg ){  switch( strMsg[1] )  {    case 'c':        return analyzeChangePlayerTypeMessage( strMsg );      // ( c hange_    case 'o':                                                 // ( o k        if( strlen(strMsg) > 14 && strMsg[4] == 'c' && strMsg[10] == 'b' )          analyzeCheckBall( strMsg );                         // (ok check_ball        return true;    case 's':    {      switch( strMsg[3] )      {        case 'e':             if( strMsg[5] == 'g' )                  return analyzeSeeGlobalMessage  ( strMsg ); // (se e_g             else                  return analyzeSeeMessage        ( strMsg ); // (se e        case 'n': return analyzeSenseMessage      ( strMsg ); // (se n se        case 'r': return analyzeServerParamMessage( strMsg ); // (se r ver_param        default : break;      }    }    case 'i':     return analyzeInitMessage       ( strMsg ); // ( i nit    case 'h':     return analyzeHearMessage       ( strMsg ); // ( h ear    case 'p':     return ( strMsg[8] == 't')                  ? analyzePlayerTypeMessage ( strMsg )  // (player_ t ype                  : analyzePlayerParamMessage( strMsg ); // (player_ p aram    case 'e':     printf("%s", strMsg);                  // ( error    default:      cerr << "(" << WM->getCurrentTime() << ", " <<                        WM->getPlayerNumber()                        << ") (SenseHandler::analyzeMessage) " <<                     "ignored message: " << strMsg << endl;                  return false;  }  return false;}/*! This method analyzes a see Message. It gets the time from the message and    tries to synchronize with the server. Then the message is stored in the    world model, which processes it when it performs an update.     \return bool indicating whether the message was parsed correctly. */bool SenseHandler::analyzeSeeMessage( char *strMsg ){  // store the message for later processing  strcpy( WM->strLastSeeMessage, strMsg );  Log.logWithTime( 2, " incoming see message" );  Log.logWithTime( 2, " %s",strMsg );  if( WM->getRelativeDistance( OBJECT_BALL ) < SS->getVisibleDistance() )    Log.logWithTime( 560, "%s", WM->strLastSeeMessage );    Time    time = WM->getTimeLastSenseMessage();  int iTime = Parse::parseFirstInt( &strMsg );         // get the time  if( time.getTime() != iTime )  {    cerr << "(SenseHandler:analyzeSeeMessage) see with different time as sense:"         << time.getTime() << " vs. " << iTime << endl;    return false;  }  // count number of see message in this cycle  if( WM->getTimeLastSeeMessage() == time )    m_iSeeCounter++;  else    m_iSeeCounter = 1;  // do nothing with second see, since it adds nothings  if( m_iSeeCounter >= 2 )  {    Log.logWithTime( 4, "second see message in cycle; do nothing " );    return true;  }  // reset the send pattern when previous cycle(s) no see arrived  if( WM->getAgentViewFrequency() == 1.0 && // VA_NORMAL; previous cycle no see      time.getTimeDifference( WM->getTimeLastSeeMessage() )== 2 )    iTriCounter = 1;                // see will arive in 2nd half in next cycle  else if( WM->getAgentViewFrequency() == 2.0 && // VA_WIDE; two cycles no see           time.getTimeDifference( WM->getTimeLastSeeMessage() ) == 3 )    iTriCounter = 1;                // no see will arrive next two cycles  WM->setTimeLastSeeMessage( time );   // set time of last see message	                                     // this will activate main thread  return true;}/*! This method analyzes a see Message. All information from the different    objects that is stored in a see message is send to worldmodel.    A see message looks like(see 0 ((g r) 64.1 13) ((f r t) 65.4 -16) ....

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲小说春色综合另类电影| 国产欧美日韩另类视频免费观看| 国产综合色精品一区二区三区| 亚洲图片欧美综合| 久久免费精品国产久精品久久久久| 欧美性生活一区| 欧美三级电影在线观看| 欧美中文字幕一区二区三区| 欧美在线观看视频在线| 欧美日韩和欧美的一区二区| 欧美日韩精品高清| 欧美草草影院在线视频| 久久综合一区二区| 国产欧美日韩综合精品一区二区| 欧美精品一区二区三区视频 | 欧美国产日韩在线观看| 精品国产乱子伦一区| 久久久www成人免费毛片麻豆| 2020国产精品| 亚洲精品免费在线播放| 亚洲国产精品久久人人爱| 91视频免费播放| 99re成人精品视频| 欧美男人的天堂一二区| 日韩一级免费观看| 中文在线一区二区| 亚洲高清一区二区三区| 国产综合久久久久久鬼色| www.视频一区| 制服视频三区第一页精品| 精品播放一区二区| 亚洲欧洲av一区二区三区久久| 亚洲一区在线观看免费观看电影高清| 午夜视黄欧洲亚洲| 国产精品一区二区三区网站| 一本色道久久加勒比精品| 日韩一区二区免费在线观看| 中文字幕欧美日本乱码一线二线 | 色狠狠一区二区| 日韩美女天天操| 亚洲欧美日韩一区二区| 久久精品72免费观看| 色哟哟国产精品| www成人在线观看| 亚洲一区av在线| 成人精品视频一区二区三区| 欧美理论在线播放| 亚洲婷婷综合色高清在线| 麻豆传媒一区二区三区| 91在线云播放| 久久久亚洲精华液精华液精华液| 一区二区三区不卡在线观看 | 欧美性色aⅴ视频一区日韩精品| 2020国产成人综合网| 午夜不卡av在线| 91国产免费看| 亚洲欧洲成人精品av97| 亚洲一区二区在线观看视频| 国产精品1024| 欧美成人r级一区二区三区| 亚洲午夜视频在线观看| 99久久精品免费看国产| 国产精品网站一区| 国产一区二区三区在线观看精品| 337p亚洲精品色噜噜噜| 亚洲综合偷拍欧美一区色| 91在线精品一区二区| 国产精品美女一区二区在线观看| 国内外精品视频| 精品久久久久99| 裸体在线国模精品偷拍| 91精选在线观看| 日韩精品免费视频人成| 欧美日韩国产在线观看| 亚洲国产欧美日韩另类综合| av电影在线观看完整版一区二区| 国产欧美日韩在线| 国产成人丝袜美腿| 国产精品午夜免费| 99视频国产精品| 亚洲男人的天堂一区二区| 91在线视频播放地址| 亚洲免费观看高清完整版在线观看 | 欧美电影在哪看比较好| 亚洲成人激情综合网| 在线不卡中文字幕| 蜜臀av性久久久久av蜜臀妖精| 91精品国产综合久久精品图片| 日韩精品一二三四| 精品久久久久一区| 国产成人免费9x9x人网站视频| 中文字幕第一区综合| bt欧美亚洲午夜电影天堂| 亚洲最新视频在线观看| 51精品秘密在线观看| 国产一区二区美女诱惑| 亚洲欧洲www| 欧美高清视频不卡网| 成人一区二区三区中文字幕| 色视频欧美一区二区三区| 五月婷婷久久丁香| 亚洲精品一区二区三区精华液| 成人黄色电影在线| 亚洲午夜免费视频| 26uuu另类欧美| 91网上在线视频| 青青青伊人色综合久久| 日本一区二区三区四区在线视频| 色诱视频网站一区| 久久99国产精品麻豆| 中文字幕欧美日韩一区| 3d动漫精品啪啪| a美女胸又www黄视频久久| 日韩激情在线观看| 国产精品你懂的| 欧美一区二区三区性视频| 懂色av一区二区夜夜嗨| 日本最新不卡在线| 亚洲欧美日韩国产综合在线| 555夜色666亚洲国产免| 91在线看国产| 国产成人啪免费观看软件| 香蕉成人伊视频在线观看| 国产日韩欧美不卡在线| 欧美一区二区性放荡片| 日本丶国产丶欧美色综合| 国产精品亚洲一区二区三区妖精| 亚洲福利一区二区| 亚洲人成人一区二区在线观看| 精品蜜桃在线看| 91精品国产综合久久婷婷香蕉| 色嗨嗨av一区二区三区| 成人污视频在线观看| 久久丁香综合五月国产三级网站 | 欧美综合亚洲图片综合区| 国产一区二区三区电影在线观看 | 国产宾馆实践打屁股91| 蜜臀av一区二区在线免费观看| 一区二区激情小说| 日韩一区在线看| 国产精品免费av| 国产欧美日韩一区二区三区在线观看| 国产欧美日韩一区二区三区在线观看| 夜夜嗨av一区二区三区| 日本一区二区视频在线| 亚洲精品在线网站| 欧美变态tickle挠乳网站| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 成人午夜电影网站| 成人网在线免费视频| 国产寡妇亲子伦一区二区| 国产一区二区视频在线| 狠狠狠色丁香婷婷综合激情| 久久激情综合网| 麻豆国产精品官网| 国产乱人伦精品一区二区在线观看| 奇米888四色在线精品| 日韩av在线发布| 另类小说色综合网站| 精品夜夜嗨av一区二区三区| 经典一区二区三区| 国内精品国产三级国产a久久 | 粉嫩aⅴ一区二区三区四区五区| 黑人精品欧美一区二区蜜桃 | 在线亚洲免费视频| 欧美日韩一区国产| 日韩欧美一区在线观看| 欧美mv和日韩mv的网站| 国产午夜精品一区二区| 国产精品区一区二区三区| 亚洲三级小视频| 无码av免费一区二区三区试看| 日本怡春院一区二区| 国产一区二区三区免费看| 91亚洲国产成人精品一区二区三 | 亚洲午夜日本在线观看| 美女网站在线免费欧美精品| 国产在线视频一区二区三区| 成人中文字幕在线| 欧美日韩精品专区| 精品国产髙清在线看国产毛片| 国产日韩精品久久久| 一区二区成人在线| 国产综合色在线视频区| 成人av资源在线| 精品视频在线视频| 精品久久一二三区| 91精品国产色综合久久久蜜香臀| 日韩欧美专区在线| 成人欧美一区二区三区黑人麻豆| 亚洲综合999| 国产精品一二一区| 欧美视频一区二| 久久久99精品免费观看不卡| 亚洲乱码中文字幕| 国产在线视视频有精品| 在线观看91精品国产麻豆| 亚洲色欲色欲www在线观看| 美日韩一级片在线观看| 在线观看一区不卡|