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

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

?? laserdevice.cc

?? 一個機器人平臺
?? CC
字號:
/* *  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: Simulates a scanning laser range finder (SICK LMS200) * Author: Andrew Howard, Richard Vaughan * Date: 28 Nov 2000 * CVS info: $Id: laserdevice.cc,v 1.6.4.5.2.1 2003/12/05 02:08:28 gerkey Exp $ */#define DEBUG#undef VERBOSE#include <iostream>#include <stage1p3.h>#include <math.h>#include "world.hh"#include "laserdevice.hh"#include "raytrace.hh"#define DEFAULT_RES 0.5#define DEFAULT_MIN -90#define DEFAULT_MAX +90///////////////////////////////////////////////////////////////////////////// Default constructorCLaserDevice::CLaserDevice(LibraryItem* libit, CWorld *world, CEntity *parent )    : CPlayerEntity(libit, world, parent ){  // set the Player IO sizes correctly for this type of Entity  m_data_len    = sizeof( player_laser_data_t );  m_command_len = 0;  m_config_len  = 1;  m_reply_len  = 1;    m_player.code = PLAYER_LASER_CODE; // from player's messages.h    // Default visibility settings  this->laser_return = LaserVisible;  this->sonar_return = 0;  this->obstacle_return = 0;    // Default laser simulation settings  this->scan_rate = 360 / 0.200; // 5Hz  this->min_res =  DTOR(0.25);  this->max_range = 8.0;  // Current laser data configuration  this->scan_res = DTOR(DEFAULT_RES);  this->scan_min = DTOR(DEFAULT_MIN);  this->scan_max = DTOR(DEFAULT_MAX);  this->scan_count = 361;  this->intensity = false;  m_last_update = 0;    // Dimensions of laser  this->shape = ShapeRect;  this->size_x = 0.155;  this->size_y = 0.155;  #ifdef INCLUDE_RTK2  this->scan_fig = NULL;#endif}///////////////////////////////////////////////////////////////////////////// Startup routine//bool CLaserDevice::Startup(){  if (!CPlayerEntity::Startup())    return false;  return true;}///////////////////////////////////////////////////////////////////////////// Load the entity from the world filebool CLaserDevice::Load(CWorldFile *worldfile, int section){  if (!CPlayerEntity::Load(worldfile, section))    return false;  // Read laser settings  this->min_res = worldfile->ReadAngle(section, "min_res", this->min_res);  this->max_range = worldfile->ReadLength(section, "max_range", this->max_range);  this->scan_rate = worldfile->ReadFloat(section, "scan_rate", this->scan_rate);    return true;}///////////////////////////////////////////////////////////////////////////// Update the laser datavoid CLaserDevice::Update( double sim_time ){  CPlayerEntity::Update( sim_time );  ASSERT(m_world != NULL);      // UPDATE OUR RENDERING  double x, y, th;  GetGlobalPose( x,y,th );      // if we've moved  ReMap(x, y, th);    // UPDATE OUR SENSOR DATA  // Check to see if it's time to update the laser scan  double interval = this->scan_count / this->scan_rate;  if( sim_time - m_last_update > interval )  {    m_last_update = sim_time;	    if( Subscribed() > 0 )    {      // Check to see if the configuration has changed      CheckConfig();            // Generate new scan data and copy to data buffer      player_laser_data_t scan_data;      GenerateScanData( &scan_data );      PutData( &scan_data, sizeof( scan_data) );	      // we may need to tell clients about this data      SetDirty( PropData, 1 );    }    else    {      // reset configuration to default.      this->scan_res = DTOR(DEFAULT_RES);      this->scan_min = DTOR(DEFAULT_MIN);      this->scan_max = DTOR(DEFAULT_MAX);      this->scan_count = 361;      this->intensity = false;	      // and indicate that the data is no longer available      //Lock();      //m_info_io->data_avail = 0;      //Unlock();	      // empty the laser beacon list      this->visible_beacons.clear();    }  }}///////////////////////////////////////////////////////////////////////////// Check to see if the configuration has changed// This currently emulates the behaviour of SICK laser range finder.bool CLaserDevice::CheckConfig(){  int len;  void* client;  char buffer[PLAYER_MAX_REQREP_SIZE];  player_laser_config_t config;  player_laser_geom_t geom;  while (true)  {    len = GetConfig(&client, &buffer, sizeof(buffer));    if (len <= 0)      break;    switch (buffer[0])    {      case PLAYER_LASER_SET_CONFIG:        if (len < (int)sizeof(config))        {          PRINT_WARN2("request has unexpected len (%d < %d)", len, sizeof(config));          break;        }                memcpy(&config, buffer, sizeof(config));        config.resolution = ntohs(config.resolution);        config.min_angle = ntohs(config.min_angle);        config.max_angle = ntohs(config.max_angle);        if (config.resolution == 25)        {          if (abs(config.min_angle) > 5000 || abs(config.max_angle) > 5000)          {            PRINT_MSG("warning: invalid laser configuration request");            PutReply(client, PLAYER_MSGTYPE_RESP_NACK);          }          else          {            this->scan_res = DTOR((double) config.resolution / 100.0);            this->scan_min = DTOR((double) config.min_angle / 100.0);            this->scan_max = DTOR((double) config.max_angle / 100.0);            this->scan_count = (int) ((this->scan_max - this->scan_min) / this->scan_res) + 1;            this->intensity = config.intensity;            PutReply(client, PLAYER_MSGTYPE_RESP_ACK);          }        }        else if (config.resolution == 50)        {          if (abs(config.min_angle) > 9000 || abs(config.max_angle) > 9000)          {            PRINT_MSG("warning: invalid laser configuration request");            PutReply(client, PLAYER_MSGTYPE_RESP_NACK);          }          else          {            this->scan_res = DTOR((double) config.resolution / 100.0);            this->scan_min = DTOR((double) config.min_angle / 100.0);            this->scan_max = DTOR((double) config.max_angle / 100.0);            this->scan_count = (int) ((this->scan_max - this->scan_min) / this->scan_res) + 1;            this->intensity = config.intensity;            PutReply(client, PLAYER_MSGTYPE_RESP_ACK);          }        }        else if (config.resolution == 100)        {          if (abs(config.min_angle) > 18000 || abs(config.max_angle) > 18000)          {            PRINT_MSG("warning: invalid laser configuration request");            PutReply(client, PLAYER_MSGTYPE_RESP_NACK);          }          else          {            this->scan_res = DTOR((double) config.resolution / 100.0);            this->scan_min = DTOR((double) config.min_angle / 100.0);            this->scan_max = DTOR((double) config.max_angle / 100.0);            this->scan_count = (int) ((this->scan_max - this->scan_min) / this->scan_res) + 1;            this->intensity = config.intensity;            PutReply(client, PLAYER_MSGTYPE_RESP_ACK);          }        }        else        {          PRINT_MSG("warning: invalid laser configuration request");          PutReply(client, PLAYER_MSGTYPE_RESP_NACK);        }        break;      case PLAYER_LASER_GET_CONFIG:        // Return the laser configuration        config.resolution = htons((int) (RTOD(this->scan_res) * 100));        config.min_angle = htons((unsigned int) (int) (RTOD(this->scan_min) * 100));        config.max_angle = htons((unsigned int) (int) (RTOD(this->scan_max) * 100));        config.intensity = this->intensity;        PutReply(client, PLAYER_MSGTYPE_RESP_ACK, NULL, &config, sizeof(config));        break;      case PLAYER_LASER_GET_GEOM:        // Return the laser geometry        geom.pose[0] = htons((short) (this->origin_x * 1000));        geom.pose[1] = htons((short) (this->origin_y * 1000));        geom.pose[2] = 0;        geom.size[0] = htons((short) (this->size_x * 1000));        geom.size[1] = htons((short) (this->size_y * 1000));        PutReply(client, PLAYER_MSGTYPE_RESP_ACK, NULL, &geom, sizeof(geom));        break;      default:        PRINT_WARN1("invalid laser configuration request [%c]", buffer[0]);        PutReply(client, PLAYER_MSGTYPE_RESP_NACK);        break;    }  }  return true;}///////////////////////////////////////////////////////////////////////////// Generate scan databool CLaserDevice::GenerateScanData( player_laser_data_t *data ){        // Get the pose of the laser in the global cs  //  double x, y, th;  GetGlobalPose(x, y, th);    // See how many scan readings to interpolate.  // To save time generating laser scans, we can  // generate a scan with lower resolution and interpolate  // the intermediate values.  // We will interpolate <skip> out of <skip+1> readings.  int skip = (int) (this->min_res / this->scan_res - 0.5);  // initialise our beacon detecting array  this->visible_beacons.clear();   // Set the header part of the data packet  data->range_count = htons(this->scan_count);  data->resolution = htons((int) (100 * RTOD(this->scan_res)));  data->min_angle = htons((int) (100 * RTOD(this->scan_min)));  data->max_angle = htons((int) (100 * RTOD(this->scan_max)));  data->range_res = htons(1);  // Make sure the data buffer is big enough  ASSERT(this->scan_count <= ARRAYSIZE(data->ranges));    // Do each scan  for (int s = 0; s < this->scan_count;)  {    double ox = x;    double oy = y;    double oth = th;    // Compute parameters of scan line    double bearing = s * this->scan_res + this->scan_min;    double pth = oth + bearing;    CLineIterator lit( ox, oy, pth, this->max_range,                        m_world->ppm, m_world->matrix, PointToBearingRange );	    CEntity* ent;    double range = this->max_range;	    while( (ent = lit.GetNextEntity()) )     {      // Ignore ourself, things which are attached to us,      // and things that we are attached to (except root)      // The latter is useful if you want to stack beacons      // on the laser or the laser on somethine else.      if (ent == this || this->IsDescendent(ent) || 	  (ent != m_world->root && ent->IsDescendent(this)))        continue;      // Construct a list of entities that have a fiducial value      if( ent->fiducial_return != FiducialNone )	{	  this->visible_beacons.push_front( (int)ent );	  	  // remove duplicates	  this->visible_beacons.sort();	  this->visible_beacons.unique();	}      // Stop looking when we see something      if(ent->laser_return != LaserTransparent)       {        range = lit.GetRange();        break;      }	    }	    // Construct the return value for the laser    uint16_t v = (uint16_t) (1000.0 * range);    data->ranges[s] = htons(v);    if (ent && ent->laser_return >= LaserBright)      data->intensity[s] = 1;    else      data->intensity[s] = 0;    s++;    // Skip some values to save time    for (int i = 0; i < skip && s < this->scan_count; i++)    {      data->ranges[s] = data->ranges[s - 1];      data->intensity[s] = data->intensity[s - 1];      s++;    }  }    // remove all duplicates from the beacon list  this->visible_beacons.unique();   return true;}#ifdef INCLUDE_RTK2///////////////////////////////////////////////////////////////////////////// Initialise the rtk guivoid CLaserDevice::RtkStartup(){  CPlayerEntity::RtkStartup();    // Create a figure representing this object  this->scan_fig = rtk_fig_create(m_world->canvas, NULL, 49);  // Set the color  rtk_fig_color_rgb32(this->scan_fig, this->color);}///////////////////////////////////////////////////////////////////////////// Finalise the rtk guivoid CLaserDevice::RtkShutdown(){  // Clean up the figure we created  rtk_fig_destroy(this->scan_fig);  CPlayerEntity::RtkShutdown();} ///////////////////////////////////////////////////////////////////////////// Update the rtk guivoid CLaserDevice::RtkUpdate(){  CPlayerEntity::RtkUpdate();   rtk_fig_clear(this->scan_fig);     // draw a figure from the data in the data buffer  // we might have put it there ourselves, or another stage  // might have generated it    // this is a good way to see the _real_ output of Stage, rather than  // some intermediate values. also it allows us to view data that was  // generated elsewhere, without this Stage being subscribed to a  // device.  so even though it does use a few more flops, i think  // it's the Right Thing to do - RTV.    //gth -= M_PI / 2.0;    // if a client is subscribed to this device  if( Subscribed() > 0 && m_world->ShowDeviceData( this->lib_entry->type_num) )  {    player_laser_data_t data;        // attempt to get the right size chunk of data from the mmapped buffer    if( GetData( &data, sizeof(data) ) == sizeof(data) )    {       // Get global pose      double gx, gy, gth;      GetGlobalPose(gx, gy, gth);      rtk_fig_origin( this->scan_fig, gx, gy, gth);            // we got it, so parse out the data and display it      short min_ang_deg = ntohs(data.min_angle);      short max_ang_deg = ntohs(data.max_angle);      unsigned short samples = ntohs(data.range_count); 	      double min_ang_rad = DTOR( (double)min_ang_deg ) / 100.0;      double max_ang_rad = DTOR( (double)max_ang_deg ) / 100.0;      double incr = (double)(max_ang_rad - min_ang_rad) / (double)samples;	      double lx = 0.0;      double ly = 0.0;      double bearing = min_ang_rad;      for( int i=0; i < (int)samples; i++ )      {        // get range, converting from mm to m        //unsigned short range_mm = ntohs(data.ranges[i]) & 0x1FFF;        unsigned short range_mm = ntohs(data.ranges[i]);        double range_m = (double)range_mm / 1000.0;	          //if( range_m == this->max_range ) range_m = 0;        bearing += incr;        //if( range_m < this->max_range )        //{        double px = range_m * cos(bearing);        double py = range_m * sin(bearing);	          //rtk_fig_line(this->scan_fig, 0.0, 0.0, px, py);	            rtk_fig_line( this->scan_fig, lx, ly, px, py );        lx = px;        ly = py;	            // add little boxes at high intensities (like in playerv)        if(data.intensity[i] > 0 )	      {          rtk_fig_rectangle(this->scan_fig, px, py, 0, 0.05, 0.05, 1);          //rtk_fig_line( this->scan_fig, 0,0,px, py );	      }	        }      // RTV - son demo      rtk_fig_line( this->scan_fig, 0.0, 0.0, lx, ly );	    }    //else    //  puts( "subscribed but no data avail!!!!!!!!!!!!!!" );  }}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产网站一区二区| 日韩视频免费观看高清完整版在线观看| 亚洲v日本v欧美v久久精品| 亚洲人妖av一区二区| 国产精品久久久久久久久免费丝袜| 精品久久人人做人人爰| 26uuu国产电影一区二区| 欧美电视剧在线观看完整版| 欧美一区二区福利视频| 精品日产卡一卡二卡麻豆| 精品少妇一区二区三区视频免付费 | 欧洲精品在线观看| 91蜜桃婷婷狠狠久久综合9色| 成人动漫精品一区二区| 不卡一二三区首页| 色综合久久九月婷婷色综合| 欧美在线免费视屏| 91麻豆精品国产91久久久久 | 日本欧美一区二区在线观看| 蜜臀99久久精品久久久久久软件| 老司机免费视频一区二区| 麻豆91精品视频| 国产福利电影一区二区三区| 色综合天天性综合| 3d动漫精品啪啪1区2区免费| 日韩免费福利电影在线观看| 日本一区二区三级电影在线观看| 中文字幕日韩欧美一区二区三区| 亚洲中国最大av网站| 麻豆视频一区二区| 97精品国产露脸对白| 欧美日韩在线播放三区| 日韩精品一区国产麻豆| 中文字幕高清不卡| 亚洲第一主播视频| 国产精品亚洲成人| 欧美色综合天天久久综合精品| 日韩欧美国产小视频| 国产精品久久久久久久岛一牛影视 | 99久久99久久综合| 日韩一区二区麻豆国产| 亚洲色大成网站www久久九九| 日本不卡视频一二三区| 91香蕉视频黄| 久久青草国产手机看片福利盒子| 一区二区三区中文在线观看| 激情文学综合插| 欧美午夜精品免费| 国产精品乱码一区二三区小蝌蚪| 秋霞电影一区二区| 91福利视频网站| 国产欧美精品区一区二区三区| 日本亚洲欧美天堂免费| 色香蕉成人二区免费| 久久久久久久久久看片| 日本美女一区二区| 欧美日韩一区二区三区四区五区| 久久精品综合网| 蜜臀91精品一区二区三区| 欧美日韩和欧美的一区二区| 成人欧美一区二区三区1314| 国产经典欧美精品| 欧美成人vr18sexvr| 日韩电影免费在线看| 欧美日韩国产片| 亚洲精选一二三| 国产成人av电影在线| 日韩精品一区二区三区四区| 性做久久久久久久免费看| 91久久精品日日躁夜夜躁欧美| 国产精品看片你懂得| 国产夫妻精品视频| 日本一区二区三区四区 | 日韩久久一区二区| 99久久99久久精品免费观看| 国产人伦精品一区二区| 国产999精品久久久久久| 久久久久成人黄色影片| 成人免费看片app下载| 国产精品三级久久久久三级| 成人动漫一区二区三区| 亚洲日本va在线观看| 欧美亚男人的天堂| 午夜电影久久久| 日韩三级高清在线| 国产主播一区二区| 国产精品久久久久久久久免费丝袜| 91在线视频18| 亚洲成人动漫在线免费观看| 91精品国产黑色紧身裤美女| 美女高潮久久久| 国产亚洲制服色| 99精品一区二区三区| 一级日本不卡的影视| 日韩一区二区影院| 国产高清无密码一区二区三区| 日本一区二区综合亚洲| 在线观看日韩电影| 日韩成人免费电影| 久久综合99re88久久爱| 91浏览器入口在线观看| 午夜天堂影视香蕉久久| 久久色.com| 色综合一区二区| 麻豆精品在线看| 国产精品理论片| 日韩午夜电影在线观看| 成人性生交大合| 亚洲成人久久影院| 国产人伦精品一区二区| 欧美三片在线视频观看| 国产在线播放一区| 亚洲综合色区另类av| 日韩欧美一级精品久久| jlzzjlzz国产精品久久| 日韩精品久久久久久| 国产精品嫩草久久久久| 91精品婷婷国产综合久久| 国产麻豆成人精品| 一片黄亚洲嫩模| 日本一区二区三区四区在线视频 | 91免费国产在线观看| 蜜臀av一级做a爰片久久| 亚洲人快播电影网| 国产三级欧美三级| 这里是久久伊人| 色综合天天综合网天天看片| 看片网站欧美日韩| 亚洲成av人片在线| 一色屋精品亚洲香蕉网站| 日韩三级免费观看| 欧美日韩成人在线一区| 91蜜桃在线观看| 成人性生交大片免费看在线播放| 免费在线看一区| 婷婷综合五月天| 亚洲欧美激情小说另类| 国产精品系列在线| 久久伊人中文字幕| 91精品婷婷国产综合久久 | 蜜臂av日日欢夜夜爽一区| 亚洲精品成人少妇| 亚洲欧洲另类国产综合| 久久久久国产精品麻豆ai换脸| 欧美国产1区2区| 欧美高清你懂得| 欧美午夜影院一区| 欧美在线免费视屏| 欧洲精品在线观看| 在线免费观看成人短视频| 不卡的电影网站| 成人在线视频首页| 处破女av一区二区| 成人免费看黄yyy456| 国产99精品视频| 成人app软件下载大全免费| 成人午夜在线播放| 成人毛片老司机大片| 国产电影精品久久禁18| 国产福利视频一区二区三区| 国产精品资源在线看| 国产精品亚洲专一区二区三区| 国内不卡的二区三区中文字幕| 激情成人午夜视频| 国产成人自拍网| 成人免费视频免费观看| 91视频免费看| 欧美在线短视频| 欧美一区二区三区免费视频| 日韩免费看网站| 国产欧美日韩在线视频| 亚洲精品一二三| 午夜成人免费视频| 久久精品久久综合| 国产裸体歌舞团一区二区| 成人av手机在线观看| 在线亚洲一区观看| 欧美一区二区视频观看视频 | 91国模大尺度私拍在线视频| 欧美视频日韩视频| 欧美一级高清片| 国产人成一区二区三区影院| 亚洲日本va在线观看| 五月天丁香久久| 极品尤物av久久免费看| 不卡视频一二三| 欧美日韩一本到| 久久精品免费在线观看| 亚洲免费在线观看视频| 美女视频网站黄色亚洲| 成人性生交大片免费| 欧美剧在线免费观看网站| 久久在线观看免费| 亚洲美女淫视频| 精品写真视频在线观看| 在线免费视频一区二区| www国产成人免费观看视频 深夜成人网| 国产精品午夜春色av| 日韩电影在线观看一区| 不卡在线视频中文字幕|