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

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

?? entity.cc

?? 一個機器人平臺
?? CC
?? 第 1 頁 / 共 3 頁
字號:
/* *  Stage : a multi-robot simulator. *  Copyright (C) 2001, 2002 Richard Vaughan, Andrew Howard and Brian Gerkey. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *//* * Desc: Base class for every entity. * Author: Richard Vaughan, Andrew Howard * Date: 7 Dec 2000 * CVS info: $Id: entity.cc,v 1.96.2.2 2003/05/24 01:11:19 inspectorg Exp $ */#if HAVE_CONFIG_H  #include <config.h>#endif#include <math.h>#include <string.h>#include <stdio.h>#include <stdlib.h>#include <sys/time.h>#include <unistd.h>#include <float.h> // for FLT_MAX#include <sys/mman.h>#include <sys/types.h>#include <fcntl.h>#include <errno.h>#include <sys/stat.h>#include <sys/file.h>#include <iostream>//#define DEBUG//#define VERBOSE//#undef DEBUG//#undef VERBOSE//#define RENDER_INITIAL_BOUNDING_BOXES#include "entity.hh"#include "raytrace.hh"#include "world.hh"#include "worldfile.hh"#include "gui.hh"#include "library.hh"///////////////////////////////////////////////////////////////////////////// main constructor// Requires a pointer to the parent and a pointer to the world.CEntity::CEntity(LibraryItem* libit, CWorld *world, CEntity *parent_entity ){  assert( world );    this->m_world = world;   this->m_parent_entity = parent_entity;  this->m_default_entity = this;    // store the library's entry for this type  this->lib_entry = libit;  // get the default color  this->color = lib_entry->color;  // attach to my parent  if( m_parent_entity )    m_parent_entity->AddChild( this );  else    PRINT_DEBUG1( "ROOT ENTITY %p\n", this );    // register with the world to receive our unique id  this->stage_id = m_world->RegisterEntity( this );  // init the child list data  this->child_list = this->prev = this->next = NULL;  // Set our default name  this->name[0] = 0;  // Set default pose  this->local_px = this->local_py = this->local_pth = 0;  // Set global velocity to stopped  this->vx = this->vy = this->vth = 0;  // unmoveably MASSIVE! by default  this->mass = 1000.0;      // Set the default shape and geometry  this->shape = ShapeNone;  this->size_x = this->size_y = 0;  this->origin_x = this->origin_y = 0;  // set the default worldfile section to be 0 (top-level)  this->worldfile_section = 0;  m_local = false;     // by default, entities don't show up in any sensors  // these must be enabled explicitly in each subclass  obstacle_return = false;  sonar_return = false;  puck_return = false;  vision_return = false;  laser_return = LaserTransparent;  idar_return = IDARTransparent;  fiducial_return = FiducialNone; // not a recognized fiducial  gripper_return = GripperDisabled;  // Set the initial mapped pose to a dummy value  this->map_px = this->map_py = this->map_pth = 0;  m_dependent_attached = false;  // we start out NOT dirty - no one gets deltas unless they ask for 'em.  SetDirty( 0 );    m_last_pixel_x = m_last_pixel_y = m_last_degree = 0;  m_interval = 0.1; // update interval in seconds   m_last_update = -FLT_MAX; // initialized   // init the ptr to GUI-specific data  this->gui_data = NULL;#ifdef INCLUDE_RTK2  // Default figures for drawing the entity.  this->fig = NULL;  this->fig_label = NULL;  // By default, we can both translate and rotate the entity.  this->movemask = RTK_MOVE_TRANS | RTK_MOVE_ROT;#endif}///////////////////////////////////////////////////////////////////////////// DestructorCEntity::~CEntity(){}void CEntity::AddChild( CEntity* child ){  //printf( "appending entity %p to parent %p\n", child, this );    STAGE_LIST_APPEND( this->child_list, child ); }// returns true if this object is a child of ancestor, or a child// of a child of ancestor, etc, recursively./*bool CEntity::IsDescendent( CEntity* ancestor ){  if( m_parent_entity == NULL )    return false;    if( m_parent_entity == ancestor )    return true;    // recurse  return( m_parent_entity->IsDescendent( ancestor ) );}*/void CEntity::GetBoundingBox( double &xmin, double &ymin,			      double &xmax, double &ymax ){  double x[4];  double y[4];  double dx = size_x / 2.0;  double dy = size_y / 2.0;  double dummy = 0.0;    x[0] = origin_x + dx;  y[0] = origin_y + dy;  this->LocalToGlobal( x[0], y[0], dummy );  x[1] = origin_x + dx;  y[1] = origin_y - dy;  this->LocalToGlobal( x[1], y[1], dummy );  x[2] = origin_x - dx;  y[2] = origin_y + dy;  this->LocalToGlobal( x[2], y[2], dummy );  x[3] = origin_x - dx;  y[3] = origin_y - dy;  this->LocalToGlobal( x[3], y[3], dummy );  //double ox, oy, oth;  //GetGlobalPose( ox, oy, oth );  //printf( "origin: %.2f,%.2f,%.2f \n", ox, oy, oth );  //printf( "corners: \n" );  //for( int c=0; c<4; c++ )  //printf( "\t%.2f,%.2f\n", x[c], y[c] );    // find the smallest values and we're done  //xmin = xmax = x[0];  for( int c=0; c<4; c++ )    {      if( x[c] < xmin ) xmin = x[c];      if( x[c] > xmax ) xmax = x[c];    }  //ymin = ymax = y[0];  for( int c=0; c<4; c++ )    {      if( y[c] < ymin ) ymin = y[c];      if( y[c] > ymax ) ymax = y[c];    }   //printf( "before children: %.2f %.2f %.2f %.2f\n",  //  xmin, ymin, xmax, ymax );  CHILDLOOP( ch )    ch->GetBoundingBox(xmin, ymin, xmax, ymax );   //printf( "after children: %.2f %.2f %.2f %.2f\n",  //  xmin, ymin, xmax, ymax );}// this is called very rapidly from the main loop// it allows the entity to perform some actions between clock increments// (such handling config requests to increase synchronous IO performance)void CEntity::Sync(){   // default - do nothing but call the children  CHILDLOOP( ch ) ch->Sync(); };// return a pointer to this or a child if it matches the worldfile sectionCEntity* CEntity::FindSectionEntity( int section ){  //PRINT_DEBUG2( "find section %d. my section %d\n",   //	section, this->worldfile_section );  CEntity* found = NULL;    if( section == this->worldfile_section )    found  = this;    //int f=0;  // otherwise, recursively check our children  if( found == NULL ) CHILDLOOP( ch )    {      //printf( "looking in child %d\n", f++ );       found = ch->FindSectionEntity( section );       if( found ) break;    }    //printf( "found %s\n", found ? "true" : "false" );    return found;  }///////////////////////////////////////////////////////////////////////////// Load the entity from the world filebool CEntity::Load(CWorldFile *worldfile, int section){  // Read the name  strcpy( this->name, worldfile->ReadString(section, "name", "") );        // Read the pose  this->init_px = worldfile->ReadTupleLength(section, "pose", 0, 0);  this->init_py = worldfile->ReadTupleLength(section, "pose", 1, 0);  this->init_pth = worldfile->ReadTupleAngle(section, "pose", 2, 0);  SetPose(this->init_px, this->init_py, this->init_pth);  // Read the shape  const char *shape_desc = worldfile->ReadString(section, "shape", NULL);  if (shape_desc)  {    if (strcmp(shape_desc, "rect") == 0)      this->shape = ShapeRect;    else if (strcmp(shape_desc, "circle") == 0)      this->shape = ShapeCircle;    else      PRINT_WARN1("invalid shape desc [%s]; using default", shape_desc);  }  // Read the size  this->size_x = worldfile->ReadTupleLength(section, "size", 0, this->size_x);  this->size_y = worldfile->ReadTupleLength(section, "size", 1, this->size_y);  // Read the origin offsets (for moving center of rotation)  this->origin_x = worldfile->ReadTupleLength(section, "offset", 0, this->origin_x);  this->origin_y = worldfile->ReadTupleLength(section, "offset", 1, this->origin_y);  // Read the entity color  this->color = worldfile->ReadColor(section, "color", this->color);  // read the desired update interval  this->m_interval =     worldfile->ReadFloat( section, "interval", this->m_interval );   const char *rvalue;    // Obstacle return values  if (this->obstacle_return)    rvalue = "visible";  else    rvalue = "invisible";  rvalue = worldfile->ReadString(section, "obstacle_return", rvalue);  if (strcmp(rvalue, "visible") == 0)    this->obstacle_return = true;  else    this->obstacle_return = false;  // Sonar return values  if (this->sonar_return)    rvalue = "visible";  else    rvalue = "invisible";  rvalue = worldfile->ReadString(section, "sonar_return", rvalue);  if (strcmp(rvalue, "visible") == 0)    this->sonar_return = true;  else    this->sonar_return = false;  // Vision return values  if (this->vision_return)    rvalue = "visible";  else    rvalue = "invisible";  rvalue = worldfile->ReadString(section, "vision_return", rvalue);  if (strcmp(rvalue, "visible") == 0)    this->vision_return = true;  else    this->vision_return = false;  // Gripper return values  if (this->gripper_return)    rvalue = "visible";  else    rvalue = "invisible";  rvalue = worldfile->ReadString(section, "gripper_return", rvalue);  if (strcmp(rvalue, "visible") == 0)    this->gripper_return = GripperEnabled;  else    this->gripper_return = GripperDisabled;  // Read the beacon id  this->fiducial_return \    = worldfile->ReadInt(section, "fiducial_id", this->fiducial_return );  // Use the beacon id as a name if there is no name set  if ( strlen(this->name) == 0 && this->fiducial_return != FiducialNone )    snprintf( this->name, 64, "id %d", this->fiducial_return );    // Laser return values  if (this->laser_return == LaserBright)    rvalue = "bright";  else if (this->laser_return == LaserVisible)    rvalue = "visible";  else    rvalue = "invisible";  rvalue = worldfile->ReadString(section, "laser_return", rvalue);  if (strcmp(rvalue, "bright") == 0)    this->laser_return = LaserBright;  else if (strcmp(rvalue, "visible") == 0)    this->laser_return = LaserVisible;  else    this->laser_return = LaserTransparent;      return true;}///////////////////////////////////////////////////////////////////////////// Save the entity to the world filebool CEntity::Save(CWorldFile *worldfile, int section){  // Write the pose (but only if it has changed)  double px, py, pth;  GetPose(px, py, pth);  //printf( "pose: %.2f %.2f %.2f   init:  %.2f %.2f %.2f\n",  //  px, py, pth, init_px, init_py, init_pth );  // TODO - save out any other changed properties  if (px != this->init_px || py != this->init_py || pth != this->init_pth)  {    worldfile->WriteTupleLength(section, "pose", 0, px);    worldfile->WriteTupleLength(section, "pose", 1, py);    worldfile->WriteTupleAngle(section, "pose", 2, pth);  }  CHILDLOOP( ch ) ch->Save( worldfile, ch->worldfile_section );    return true;}///////////////////////////////////////////////////////////////////////////// Startup routine// A virtual function that lets entities do some initialization after// everything has been loaded.bool CEntity::Startup( void ){  PRINT_DEBUG2("ENTITY STARTUP %s %s",          this->lib_entry->token,         m_parent_entity ? "" : "- ROOT" );    // use the generic hook  if( m_world->enable_gui )    GuiEntityStartup( this );   CHILDLOOP( ch )    ch->Startup();  return true;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲精品一区二区三区四区高清| 91网站在线观看视频| 欧美一级久久久| 秋霞午夜鲁丝一区二区老狼| 制服丝袜av成人在线看| 免费欧美在线视频| 26uuu国产在线精品一区二区| 狠狠色狠狠色合久久伊人| 国产午夜精品美女毛片视频| 成人av电影在线网| 亚洲在线免费播放| 91麻豆精品国产| 国产一区二区主播在线| 国产欧美在线观看一区| 一本久道久久综合中文字幕 | 国产一区高清在线| 成人欧美一区二区三区黑人麻豆| 91久久国产最好的精华液| 香蕉久久夜色精品国产使用方法 | 国产中文字幕精品| **欧美大码日韩| 欧美日韩国产在线观看| 久久国产精品无码网站| 国产精品国产三级国产普通话99| 日本高清不卡视频| 激情另类小说区图片区视频区| 中文字幕亚洲视频| 日韩午夜三级在线| av电影天堂一区二区在线 | 椎名由奈av一区二区三区| 欧美色图免费看| 国产在线播放一区三区四| 亚洲另类一区二区| 2017欧美狠狠色| 欧美午夜在线观看| 成人污视频在线观看| 午夜在线电影亚洲一区| 国产欧美视频一区二区| 欧美精品自拍偷拍| 91视频com| 国产成人一区在线| 免费观看一级特黄欧美大片| 亚洲精品视频在线观看免费| 精品国内二区三区| 欧美日韩国产一级| 99视频精品在线| 久久99热这里只有精品| 亚洲无人区一区| 国产精品蜜臀av| 精品国产一区久久| 欧美精选一区二区| 欧美日韩中文字幕一区二区| 成人免费视频视频| 国产一区二区久久| 日韩国产欧美在线播放| 亚洲激情自拍视频| 亚洲欧洲制服丝袜| 亚洲欧洲精品一区二区精品久久久| 日韩欧美成人一区二区| 91精品国产91久久久久久一区二区| 色爱区综合激月婷婷| 成人av资源在线观看| 国产91精品精华液一区二区三区| 麻豆91在线看| 首页综合国产亚洲丝袜| 亚洲国产精品麻豆| 亚洲电影中文字幕在线观看| 亚洲欧美日韩国产另类专区 | 亚洲精选视频免费看| 国产精品国产三级国产a| 国产人久久人人人人爽| 久久综合久色欧美综合狠狠| 欧美不卡一区二区三区四区| 日韩色视频在线观看| 日韩欧美综合在线| 欧美tickling挠脚心丨vk| 日韩精品一区在线| 精品国产91九色蝌蚪| 亚洲精品一区二区在线观看| 精品久久五月天| 久久蜜桃av一区精品变态类天堂| 26uuu精品一区二区| 国产偷v国产偷v亚洲高清| 国产香蕉久久精品综合网| 国产精品全国免费观看高清| 国产精品久久久久久福利一牛影视| 国产精品区一区二区三区| 国产精品理论在线观看| 亚洲另类春色国产| 五月综合激情网| 国内不卡的二区三区中文字幕| 国内成人自拍视频| av综合在线播放| 在线观看日韩高清av| 在线不卡免费av| 26uuu久久天堂性欧美| 国产精品久久久久久久久久久免费看 | 日韩高清不卡在线| 国产在线精品不卡| 91免费版在线看| 欧美猛男男办公室激情| 精品日韩99亚洲| 国产精品国产三级国产三级人妇| 亚洲另类一区二区| 久久精品噜噜噜成人av农村| 国产成人精品aa毛片| 一本色道久久综合精品竹菊| 91精品国产综合久久福利软件| 欧美精品一区二区三区一线天视频| 欧美经典三级视频一区二区三区| 亚洲人成精品久久久久久 | 久久综合色8888| 亚洲人成小说网站色在线| 日韩av成人高清| 国产成人亚洲综合色影视| 欧美色倩网站大全免费| 亚洲精品一区在线观看| 一区二区三区四区不卡在线| 久久国产婷婷国产香蕉| 99久久久免费精品国产一区二区| 91精品福利在线一区二区三区| 欧美激情一区在线| 日韩av在线发布| 99久久婷婷国产| 久久夜色精品一区| 亚洲大片一区二区三区| 丰满少妇在线播放bd日韩电影| 91久久免费观看| 国产亚洲欧美中文| 欧美aaa在线| 欧美亚洲一区二区三区四区| 久久久精品免费免费| 日韩av中文字幕一区二区三区| 99久久综合99久久综合网站| 日韩女优制服丝袜电影| 亚洲一卡二卡三卡四卡 | 精品一区二区三区视频在线观看| 日本精品一级二级| 国产精品免费视频观看| 激情丁香综合五月| 制服.丝袜.亚洲.另类.中文| 亚洲三级小视频| 国产精品18久久久久久久久| 日韩女优av电影| 亚洲成av人影院| 欧美午夜在线观看| 亚洲精品欧美在线| 91在线免费看| 国产精品美女久久久久高潮| 国产精品资源在线观看| 精品国产三级电影在线观看| 9l国产精品久久久久麻豆| 69成人精品免费视频| 亚洲成人一区二区在线观看| 在线看国产日韩| 亚洲色图欧洲色图婷婷| 99re这里只有精品首页| 中文字幕第一区第二区| 国产一区二区三区免费在线观看| 欧美成va人片在线观看| 青青草成人在线观看| 在线综合+亚洲+欧美中文字幕| 亚洲资源中文字幕| 欧美视频你懂的| 午夜亚洲福利老司机| 欧美日韩小视频| 亚洲chinese男男1069| 欧美日韩精品高清| 秋霞电影网一区二区| 欧美一区永久视频免费观看| 美女在线观看视频一区二区| 欧美一区二区三区日韩| 免费一级欧美片在线观看| 日韩欧美国产1| 国产精品一级片在线观看| 中文字幕 久热精品 视频在线| 不卡av在线免费观看| 亚洲图片激情小说| 欧洲另类一二三四区| 天天影视色香欲综合网老头| 欧美一二三四区在线| 九九**精品视频免费播放| 国产亚洲一区二区三区四区| 福利电影一区二区三区| 亚洲女爱视频在线| 欧美亚洲综合色| 麻豆国产一区二区| 国产精品美女一区二区三区 | 亚洲成人午夜影院| 日韩区在线观看| 国产成人免费9x9x人网站视频| 中文字幕一区二区三区四区| 91成人免费在线视频| 天天操天天综合网| 26uuu久久天堂性欧美| 99re在线精品| 天天操天天综合网| 中文字幕国产一区| 欧美精品免费视频| 国产成人超碰人人澡人人澡|