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

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

?? positiondevice.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 differential mobile robot. * Author: Andrew Howard, Richard Vaughan * Date: 5 Dec 2000 * CVS info: $Id: positiondevice.cc,v 1.2.2.5.2.1 2003/12/05 02:08:28 gerkey Exp $ *///#define DEBUG#include <math.h>#include "player.h"#include "world.hh"#include "positiondevice.hh"// MACROS for packing Player buffers (borrowed from libplayerpacket)// convert meters to Player mm in NBO in various sizes#define MM_32(A)  (htonl((int32_t)(A * 1000.0)))#define MM_16(A)  (htons((int16_t)(A * 1000.0)))#define MM_U16(A) (htons((uint16_t)(A * 1000.0)))// convert mm of various sizes in NBO to local meters#define M_32(A)  ((int)ntohl((int32_t)A) / 1000.0)#define M_16(A)  ((int)ntohs((int16_t)A) / 1000.0)#define M_U16(A) ((unsigned short)ntohs((uint16_t)A) / 1000.0)// convert local radians to Player degrees in various sizes#define Deg_32(A) (htonl((int32_t)(RTOD(A))))#define Deg_16(A) (htons((int16_t)(RTOD(A))))#define Deg_U16(A) (htons((uint16_t)(RTOD(A))))// convert Player degrees in various sizes to local radians#define Rad_32(A) (DTOR((int)ntohl((int32_t)A)))#define Rad_16(A) (DTOR((short)ntohs((int16_t)A)))#define Rad_U16(A) (DTOR((unsigned short)ntohs((uint16_t)A)))///////////////////////////////////////////////////////////////////////////// ConstructorCPositionDevice::CPositionDevice(  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_position_data_t );  m_command_len = sizeof( player_position_cmd_t );  m_config_len = 1;   m_reply_len = 1;     m_player.code = PLAYER_POSITION_CODE;  // set up our sensor response  laser_return = LaserTransparent;  sonar_return = true;  obstacle_return = true;  puck_return = true;  idar_return = IDARTransparent;  vision_return = true;  this->com_vr = this->com_vth = 0;  this->odo_px = this->odo_py = this->odo_pth = 0;  this->stall = 0;  // update this device VERY frequently  m_interval = 0.01;     // assume robot is 20kg  this->mass = 20.0;    // Set the default shape and geometry  // to correspond to a Pioneer2 DX  this->shape = ShapeRect;  this->size_x = 0.440;  this->size_y = 0.380;  // Pioneer-like behavior by default  this->reset_odom_on_disconnect = true;  // took this out - now use the 'offset [X Y]' worldfile setting - rtv.  // pioneer.inc now defines a pioneer as a positiondevice with a 4cm offset  //this->origin_x = -0.04;   this->origin_x = 0;  this->origin_y = 0;}///////////////////////////////////////////////////////////////////////////// Startup routine//bool CPositionDevice::Startup(){  if (!CPlayerEntity::Startup())    return false;  return true;}///////////////////////////////////////////////////////////////////////////// Update the position of the robot basevoid CPositionDevice::Update( double sim_time ){  CPlayerEntity::Update(sim_time);  ASSERT(m_world != NULL);  // if its time to recalculate state  if( sim_time - m_last_update >  m_interval )  {    m_last_update = sim_time;          if( Subscribed() > 0 )    {      // Process configuration requests      UpdateConfig();      // Get the latest command      UpdateCommand();      // do things      Move();      // report the new state of things      UpdateData();    }    else      {      // the device is not subscribed,      // reset to default settings.      // also set speeds to zero      if( reset_odom_on_disconnect )	this->odo_px = this->odo_py = this->odo_pth = 0;      this->com_vr = this->com_vth = 0;    }  }  // Redraw ourself it we have moved  double x, y, th;  GetGlobalPose(x, y, th);  ReMap(x, y, th);}int CPositionDevice::Move(){  double step = m_world->m_sim_timestep;  // Get the current robot pose  double px, py, pth;  GetPose(px, py, pth);  // Compute a new pose  // This is a zero-th order approximation  double qx = px + this->com_vr * step * cos(pth);  double qy = py + this->com_vr * step * sin(pth);  double qth = pth + this->com_vth * step;  // Check for collisions  // and accept the new pose if ok  if (TestCollision(qx, qy, qth ) != NULL)  {    this->stall = 1;  }   else  {    // set pose now takes care of marking us dirty    SetPose(qx, qy, qth);    this->stall = 0;    // Compute the new odometric pose    // Uses a first-order integration approximation    //    double dr = this->com_vr * step;    double dth = this->com_vth * step;    this->odo_px += dr * cos(this->odo_pth + dth / 2);    this->odo_py += dr * sin(this->odo_pth + dth / 2);    this->odo_pth += dth;    // Normalise the odometric angle    this->odo_pth = fmod(this->odo_pth + TWOPI, TWOPI);  }  return true;}///////////////////////////////////////////////////////////////////////////// Process configuration requests.void CPositionDevice::UpdateConfig(){  int len;  void *client;  char buffer[PLAYER_MAX_REQREP_SIZE];  player_position_geom_t geom;  player_position_set_odom_req_t* setOdom;  while (true)  {    len = GetConfig(&client, buffer, sizeof(buffer));    if (len <= 0)      break;        switch (buffer[0])      {      case PLAYER_POSITION_MOTOR_POWER_REQ:        // motor state change request         // 1 = enable motors        // 0 = disable motors        // (default)        // CONFIG NOT IMPLEMENTED	puts( "Warning: positiondevice motor power request not implemented");        PutReply(client, PLAYER_MSGTYPE_RESP_ACK);        break;	      case PLAYER_POSITION_VELOCITY_MODE_REQ:        // velocity control mode:        //   0 = direct wheel velocity control (default)        //   1 = separate translational and rotational control        // CONFIG NOT IMPLEMENTED	puts( "Warning: positiondevice velocity mode request not implemented");        PutReply(client, PLAYER_MSGTYPE_RESP_ACK);        break;	      case PLAYER_POSITION_RESET_ODOM_REQ:	// reset position to 0,0,0: ignore value        this->odo_px = this->odo_py = this->odo_pth = 0.0;        PutReply(client, PLAYER_MSGTYPE_RESP_ACK);        break;	      case PLAYER_POSITION_SET_ODOM_REQ:                if(len != sizeof(player_position_set_odom_req_t)) {            fprintf(stderr, "ERROR: SET_ODOM request had the wrong size data buffer. (was %d, should be %d.)\n", len, sizeof(player_position_set_odom_req_t));            PutReply(client, PLAYER_MSGTYPE_RESP_NACK);            break;        }        setOdom = (player_position_set_odom_req_t *) buffer;        if(setOdom->subtype != PLAYER_POSITION_SET_ODOM_REQ) {            fprintf(stderr, "ERROR: SET_ODOM request had the wrong subtype. (was %d, should be %d.)\n", setOdom->subtype, PLAYER_POSITION_SET_ODOM_REQ);            break;        }//        printf("DEBUG: request is for set pose %d, %d, %d.\n", ntohl(setOdom->x), ntohl(setOdom->y), ntohs(setOdom->theta));	    // set my odometry to the values in the packet        this->odo_px =  M_32(setOdom->x);        this->odo_py =  M_32(setOdom->y);        this->odo_pth = Rad_16(setOdom->theta);	    printf( "DEBUG: set pose to %f, %f x %f.\n", this->odo_px, this->odo_py, this->odo_pth);        PutReply(client, PLAYER_MSGTYPE_RESP_ACK);        break;	      case PLAYER_POSITION_GET_GEOM_REQ:        // Return the robot 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("got unknown config request \"%c\"\n", buffer[0]);        PutReply(client, PLAYER_MSGTYPE_RESP_NACK);        break;      }  }}///////////////////////////////////////////////////////////////////////////// Parse the command buffer to extract commandsvoid CPositionDevice::UpdateCommand(){  if (GetCommand(&this->cmd, sizeof(this->cmd)) == sizeof(this->cmd))  {    // this device only uses x and theta velocities and ignores    // everything else    this->com_vr = M_32(this->cmd.xspeed);    this->com_vth = Rad_32(this->cmd.yawspeed);            // normalize yaw +-PI    this->com_vth = atan2(sin(this->com_vth), cos(this->com_vth));    //printf( "vr %.2f vth %.2f * \n", com_vr, com_vth );    // Set our x,y,th velocity components so that other entities (like pucks)    // can get at them.    SetGlobalVel(this->com_vr * cos(com_vth),this->com_vr * sin(com_vth), 0.0);  }}///////////////////////////////////////////////////////////////////////////// Compose data to send back to clientvoid CPositionDevice::UpdateData(){   // normalize yaw 0-2PI   // Construct the data packet  // Basically just changes byte orders and some units  this->data.xpos = MM_32(this->odo_px);  this->data.ypos = MM_32(this->odo_py);  this->data.yaw = Deg_32( fmod( this->odo_pth + TWOPI, TWOPI ) );  this->data.xspeed = MM_32(this->com_vr);  this->data.yspeed = MM_32(0); // this device can't move sideways  this->data.yawspeed = Deg_32(NORMALIZE(this->com_vth));    this->data.stall =  (uint8_t)(this->stall ? 1 : 0 );    PutData(&this->data, sizeof(this->data));     }///////////////////////////////////////////////////////////////////////////// Load the entity from the world filebool CPositionDevice::Load(CWorldFile *worldfile, int section){  if (!CPlayerEntity::Load(worldfile, section))    return false;  const char *rvalue;    // Obstacle return values  if (this->reset_odom_on_disconnect )    rvalue = "reset";  else    rvalue = "keep";  rvalue = worldfile->ReadString(section, "odometry", rvalue);  if (strcmp(rvalue, "keep") == 0)    this->reset_odom_on_disconnect = false;  else    this->reset_odom_on_disconnect = true;  return true;}#ifdef INCLUDE_RTK2///////////////////////////////////////////////////////////////////////////// Initialise the rtk guivoid CPositionDevice::RtkStartup(){  CPlayerEntity::RtkStartup();    // add a 'nose line' indicating forward to the entity's normal  // rectangle or circle. draw from the center to the front.  rtk_fig_line( this->fig, 		0, 0, 		this->size_x/2.0 + this->origin_x, this->origin_y );}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本中文字幕不卡| 亚洲激情一二三区| 经典一区二区三区| 日韩午夜激情免费电影| 日本午夜一区二区| 日韩欧美视频在线| 国产传媒欧美日韩成人| 国产精品国产精品国产专区不蜜| 成a人片亚洲日本久久| 亚洲免费在线播放| 欧美性猛交一区二区三区精品 | 91老师片黄在线观看| 亚洲啪啪综合av一区二区三区| 在线影院国内精品| 日韩av一区二区在线影视| 日韩美女主播在线视频一区二区三区| 久久99热国产| 国产精品久久99| 91成人在线精品| 免费精品视频在线| 国产精品久久久久影视| 欧美性猛交xxxxxxxx| 精品影院一区二区久久久| 国产精品免费人成网站| 欧美揉bbbbb揉bbbbb| 激情文学综合丁香| 樱花影视一区二区| 欧美成人欧美edvon| 色综合久久中文字幕综合网| 美国av一区二区| 最新中文字幕一区二区三区| 欧美高清一级片在线| 国产成人免费在线| 视频在线在亚洲| 国产精品三级av在线播放| 欧美三日本三级三级在线播放| 狠狠狠色丁香婷婷综合久久五月| 综合电影一区二区三区| 精品美女一区二区| 日本韩国欧美三级| 福利电影一区二区| 日韩国产欧美在线播放| 亚洲国产精品二十页| 日韩欧美国产三级电影视频| 一本到一区二区三区| 国产激情一区二区三区| 性做久久久久久免费观看欧美| 亚洲国产精品成人综合色在线婷婷| 在线成人av网站| 97久久人人超碰| 国产麻豆精品在线| 蜜臀av一区二区在线观看| 亚洲一区二区综合| 中文字幕在线播放不卡一区| 2017欧美狠狠色| 欧美一区二区三区免费在线看| 91视视频在线观看入口直接观看www| 久久精品国产精品亚洲精品| 五月激情综合网| 亚洲精品高清在线| 国产精品久久久久久亚洲伦| 欧美精品一区二区三区蜜臀| 日韩欧美亚洲一区二区| 在线电影院国产精品| 色94色欧美sute亚洲线路一ni| 国v精品久久久网| 国产美女在线观看一区| 久久国产剧场电影| 麻豆精品一区二区三区| 日本成人超碰在线观看| 亚洲va韩国va欧美va| 亚洲综合色丁香婷婷六月图片| 综合久久久久久久| 亚洲男帅同性gay1069| 国产欧美一区二区在线观看| 久久久九九九九| 国产日韩欧美电影| 国产色产综合产在线视频| 久久免费精品国产久精品久久久久| 精品久久久久香蕉网| 日韩精品一区二| 欧美精品一区二区三区四区| 精品久久久久久久久久久院品网 | 天天综合天天综合色| 午夜激情一区二区三区| 天天操天天综合网| 日韩和欧美的一区| 蜜桃传媒麻豆第一区在线观看| 男女男精品网站| 国产一区二区女| 国产不卡视频在线观看| 99精品在线免费| 在线视频国内自拍亚洲视频| 欧美日韩高清在线播放| 91精品蜜臀在线一区尤物| 日韩亚洲国产中文字幕欧美| 精品福利一区二区三区| 日本一区二区免费在线| 亚洲精品视频自拍| 午夜日韩在线电影| 日产欧产美韩系列久久99| 国内精品伊人久久久久av一坑| 成人亚洲一区二区一| 色综合色综合色综合色综合色综合 | 日本成人中文字幕在线视频| 精品写真视频在线观看| 国产成人aaa| 色成人在线视频| 欧美一级黄色片| 欧美国产激情一区二区三区蜜月| 综合在线观看色| 日韩黄色小视频| 国产99一区视频免费| 欧洲av在线精品| 欧美电视剧在线看免费| 亚洲欧洲无码一区二区三区| 午夜电影一区二区| 国产成人精品三级麻豆| 在线一区二区观看| 日韩免费成人网| 中文字幕一区二区视频| 五月婷婷综合网| 成人精品视频一区二区三区| 51精品秘密在线观看| 国产精品免费aⅴ片在线观看| 午夜精品福利一区二区三区蜜桃| 国产精品一二三区在线| 欧美性猛片aaaaaaa做受| 欧美激情自拍偷拍| 青青草成人在线观看| 色哟哟一区二区三区| 久久精品一区二区| 视频在线观看国产精品| 99re这里只有精品首页| 亚洲激情五月婷婷| 国产精品88av| 日韩一区二区三区免费观看| 亚洲久草在线视频| 成人午夜av电影| 久久综合久久综合亚洲| 石原莉奈在线亚洲三区| 色婷婷综合久久| 国产精品系列在线| 国产综合久久久久久鬼色| 欧美精品自拍偷拍| 亚洲欧美区自拍先锋| 成人一区在线观看| 久久久精品免费免费| 麻豆成人综合网| 欧美高清精品3d| 亚洲自拍欧美精品| 波多野结衣欧美| 久久久精品tv| 麻豆精品在线看| 3d成人h动漫网站入口| 一区二区三区在线影院| 精品日韩成人av| 亚洲国产成人av好男人在线观看| 成人激情小说乱人伦| 国产无一区二区| 久草中文综合在线| 精品久久久久久久久久久久久久久久久 | 成人激情午夜影院| 久久精品一区二区三区不卡| 蜜臀av性久久久久av蜜臀妖精 | 欧美日韩国产天堂| 亚洲成人中文在线| 欧美午夜不卡在线观看免费| 亚洲欧美激情插| 99久久久久久| 最新日韩在线视频| 色婷婷久久一区二区三区麻豆| 自拍偷自拍亚洲精品播放| jlzzjlzz国产精品久久| 1区2区3区精品视频| 成人国产精品免费网站| 国产精品黄色在线观看| 成人免费观看男女羞羞视频| 国产精品久久看| eeuss鲁片一区二区三区| 国产精品二区一区二区aⅴ污介绍| 国产91色综合久久免费分享| 国产清纯白嫩初高生在线观看91| 国产福利一区在线观看| 中文字幕二三区不卡| 94-欧美-setu| 亚洲福利视频导航| 91精品午夜视频| 麻豆成人综合网| 国产欧美日韩久久| 91欧美一区二区| 亚洲gay无套男同| 欧美成人bangbros| 国产+成+人+亚洲欧洲自线| 最近日韩中文字幕| 7777精品伊人久久久大香线蕉超级流畅 | 国产成人在线色| 亚洲视频狠狠干| 欧美日韩一卡二卡三卡| 久久精品99国产精品日本|