亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美精品一卡二卡| 色综合天天视频在线观看| 日韩欧美激情一区| 久久99久久精品欧美| 久久精品欧美日韩精品| 成人午夜激情影院| 亚洲伦在线观看| 欧美美女一区二区| 激情综合色综合久久综合| 国产三级一区二区| 色综合久久久久综合| 日本欧美肥老太交大片| 国产亚洲va综合人人澡精品| 色婷婷综合久久久| 青椒成人免费视频| 中文字幕成人av| 欧美综合久久久| 国产乱码精品一区二区三区av| 国产精品传媒入口麻豆| 在线不卡一区二区| 成人av网站在线| 午夜精品久久久久久不卡8050| 久久先锋影音av鲁色资源网| 色偷偷久久人人79超碰人人澡| 蜜桃一区二区三区四区| 国产精品国产精品国产专区不片| 欧美剧情片在线观看| 成人网在线免费视频| 日韩一区精品视频| 亚洲欧洲成人精品av97| 精品日韩一区二区三区| 色综合久久久久网| 国产福利一区在线观看| 香蕉av福利精品导航| 国产欧美一区视频| 欧美一区二区精品在线| 99vv1com这只有精品| 国内精品视频一区二区三区八戒| 一区二区三区在线视频观看| 久久先锋影音av鲁色资源| 欧美日韩三级视频| av成人老司机| 国产成人免费视频一区| 琪琪久久久久日韩精品| 一区二区高清免费观看影视大全| 国产午夜一区二区三区| 欧美成人欧美edvon| 欧美视频精品在线| 91免费在线视频观看| 粉嫩绯色av一区二区在线观看 | 日日夜夜精品视频天天综合网| 国产日产精品一区| 精品久久久久99| 91精品国产一区二区三区| 色8久久精品久久久久久蜜| 成人一区在线看| 国产一区二区在线影院| 日本伊人色综合网| 亚洲成人黄色影院| 又紧又大又爽精品一区二区| 亚洲欧美一区二区在线观看| 久久久久久久久久久黄色| 精品国产亚洲一区二区三区在线观看| av高清不卡在线| 成人一区二区三区中文字幕| 国产在线精品一区二区三区不卡| 奇米色一区二区三区四区| 亚洲成人免费视频| 青青青伊人色综合久久| 成人av网址在线观看| 亚洲伊人色欲综合网| 国产视频亚洲色图| 久久久九九九九| 久久久久国产免费免费| 国产三级精品视频| 国产视频在线观看一区二区三区| 久久久久九九视频| 中文字幕精品在线不卡| 亚洲欧洲日韩一区二区三区| 亚洲啪啪综合av一区二区三区| 亚洲三级免费观看| 亚洲一卡二卡三卡四卡五卡| 舔着乳尖日韩一区| 美女免费视频一区二区| 国产精品伊人色| 懂色av一区二区夜夜嗨| 99国产欧美久久久精品| 欧美中文字幕不卡| 7777精品伊人久久久大香线蕉完整版| 亚洲私人黄色宅男| 夜夜揉揉日日人人青青一国产精品| 亚洲综合区在线| 免费xxxx性欧美18vr| 狠狠色丁香久久婷婷综合_中| 国产精品1024| caoporen国产精品视频| 在线中文字幕一区| 日韩午夜电影av| 日本一区二区综合亚洲| 亚洲精品中文字幕在线观看| 日韩精品乱码免费| 国产毛片精品国产一区二区三区| 99视频精品在线| 欧美精品色一区二区三区| 久久色.com| 亚洲欧美日韩国产成人精品影院 | 国产精品美女久久福利网站| 亚洲美女少妇撒尿| 捆绑变态av一区二区三区| 成人精品一区二区三区四区 | 日韩一区二区三区精品视频| 精品国产乱码久久久久久图片 | 亚洲午夜一二三区视频| 激情国产一区二区| 色综合天天狠狠| 精品国产一区二区国模嫣然| 亚洲精品一二三| 韩国精品免费视频| 欧洲生活片亚洲生活在线观看| 日韩美女在线视频| 亚洲精品成人悠悠色影视| 久久99国产精品尤物| 色激情天天射综合网| 精品处破学生在线二十三| 一区二区在线观看视频| 国产综合久久久久影院| 欧美丝袜丝nylons| 中文字幕不卡在线| 久久97超碰色| 欧美人体做爰大胆视频| 综合久久久久久| 国产精品18久久久久久久久久久久| 欧美日韩在线播放三区四区| 国产精品天干天干在观线| 美女视频一区二区| 欧美色爱综合网| 日韩美女精品在线| 国产成人亚洲综合a∨婷婷图片| 91精品在线免费观看| 亚洲人午夜精品天堂一二香蕉| 国产成人亚洲精品狼色在线 | 欧美午夜精品久久久| 国产欧美在线观看一区| 寂寞少妇一区二区三区| 欧美日韩电影在线播放| 一区二区三区四区av| 成人深夜在线观看| 久久久不卡影院| 国产一区二区三区av电影 | 成人小视频免费在线观看| 日韩精品在线看片z| 人人精品人人爱| 91精品国产综合久久福利软件| 亚洲一区二区三区四区在线观看| 91亚洲国产成人精品一区二区三 | 成人黄色在线看| 久久影院视频免费| 激情综合色播激情啊| 日韩你懂的电影在线观看| 日本特黄久久久高潮| 69堂国产成人免费视频| 日韩国产欧美视频| 日韩亚洲欧美中文三级| 蜜臀av性久久久久蜜臀aⅴ四虎| 欧美狂野另类xxxxoooo| 视频一区欧美日韩| 91精品福利在线一区二区三区| 亚洲高清一区二区三区| 欧美人伦禁忌dvd放荡欲情| 午夜久久电影网| 欧美精品视频www在线观看| 日本欧美久久久久免费播放网| 欧美丰满少妇xxxbbb| 开心九九激情九九欧美日韩精美视频电影| 制服丝袜亚洲网站| 久久精品国产澳门| 国产亚洲视频系列| 成人sese在线| 亚洲一区二区美女| 欧美一区二区高清| 国产成人精品亚洲日本在线桃色| 中文字幕va一区二区三区| 91日韩在线专区| 日本少妇一区二区| 久久久国产综合精品女国产盗摄| 国产成人午夜精品影院观看视频| 自拍偷拍欧美精品| 欧美私人免费视频| 狠狠久久亚洲欧美| 欧美激情一区二区三区四区| 91麻豆国产自产在线观看| 午夜视频在线观看一区| 精品美女一区二区| 91天堂素人约啪| 婷婷成人综合网| 国产精品免费人成网站| 欧美男男青年gay1069videost| 狠狠久久亚洲欧美| 亚洲精品高清视频在线观看| 日韩视频123|