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

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

?? gripperdevice.cc

?? 一個機器人平臺
?? CC
字號:
/////////////////////////////////////////////////////////////////////////////// File: gripperdevice.cc// Author: brian gerkey// Date: 09 Jul 2001// Desc: Simulates a simple gripper//// CVS info://  $Source: /cvsroot/playerstage/code/stage/src/models/Attic/gripperdevice.cc,v $//  $Author: gerkey $//  $Revision: 1.2.4.1 $///////////////////////////////////////////////////////////////////////////////#define ENABLE_RTK_TRACE 1#if HAVE_CONFIG_H  #include <config.h>#endif#include <math.h>#if HAVE_VALUES_H  #include <values.h>#endif#include "world.hh"#include "gripperdevice.hh"#include "raytrace.hh"///////////////////////////////////////////////////////////////////////////// Default constructor//CGripperDevice::CGripperDevice( LibraryItem* libit, CWorld *world, CEntity *parent )  : CPlayerEntity(libit, world, parent ){  m_data_len    = sizeof( player_gripper_data_t );   m_command_len = sizeof( player_gripper_cmd_t );   m_config_len  = 0;  m_reply_len  = 0;  // Set default shape and geometry  this->shape = ShapeRect;  this->size_x = 0.08;  this->size_y = 0.30;    // these are used both for locating break beams and for visualization  this->m_paddle_width = this->size_x;  this->m_paddle_height = this->size_y / 5.0;  m_player.code = PLAYER_GRIPPER_CODE;  m_interval = 0.1;   // we interact with pucks and obstacles  puck_return = true;   obstacle_return = true;  this->mass = 20; // same mass as a robot  // some nice colors for beams  clear_beam_color = ::LookupColor("light blue");  broken_beam_color = ::LookupColor("red");    // these are never changed (for now)  m_paddles_moving = false;  m_gripper_error = false;  m_lift_up = false;  m_lift_down = true;  m_lift_moving = false;  m_lift_error = false;    // these are initial values  m_paddles_open = true;  m_paddles_closed = false;  m_inner_break_beam = false;  m_outer_break_beam = false;  m_puck_count = 0;}///////////////////////////////////////////////////////////////////////////// Startup routine//bool CGripperDevice::Startup(){  if (!CPlayerEntity::Startup())    return false;  return true;}///////////////////////////////////////////////////////////////////////////// Load the entity from the world filebool CGripperDevice::Load(CWorldFile *worldfile, int section){  if (!CPlayerEntity::Load(worldfile, section))    return false;  if(!strcmp(worldfile->ReadString(section, "consume", "false"),"true"))  {    m_gripper_consume = true;    m_puck_capacity = MAXGRIPPERCAPACITY;  }   else  {    // default to the more common gripper    m_gripper_consume = false;    m_puck_capacity = 1;  }  return true;}///////////////////////////////////////////////////////////////////////////// Update the device data//void CGripperDevice::Update( double sim_time ){  ASSERT(m_world != NULL);  if(!Subscribed())    return;      // if its time to recalculate gripper state  //  if( sim_time - m_last_update <= m_interval )    return;    m_last_update = sim_time;    // Get the command string  //  player_gripper_cmd_t cmd;  int len = GetCommand(&cmd, sizeof(cmd));  if (len > 0 && len != sizeof(cmd))  {    PRINT_MSG1("command buffer has incorrect length: %d -- ignored",len);    return;  }    // Parse the command string (if there is one)  //  // this gripper only understands a subset of the P2 gripper commands.  // also we ignore the cmd.arg byte, which can set actuation times  // on the real gripper  //  if (len > 0)  {    switch(cmd.cmd)    {      case GRIPopen:        if(!m_paddles_open)        {          m_paddles_open = true;          m_paddles_closed = false;          if(!m_gripper_consume)            DropObject();        }        break;      case GRIPclose:        if(m_paddles_open)        {          PickupObject();          m_paddles_open = false;          m_paddles_closed = true;        }        break;      case GRIPstop:      case LIFTup:      case LIFTdown:      case LIFTstop:      case GRIPstore:      case GRIPdeploy:      case GRIPhalt:      case GRIPpress:      case LIFTcarry:        /*        PRINT_MSG1("CGripperDevice::Update(): unimplemented gripper "                   "command: %d\n", cmd.cmd);         */        break;      default:        /*        PRINT_MSG1("CGripperDevice::Update(): unknown gripper "                   "command: %d\n", cmd.cmd);                   */        break;    }  }  m_outer_break_beam = BreakBeam(0) ? true : false;  m_inner_break_beam = BreakBeam(1) ? true : false;  // Construct the return data buffer  //  player_gripper_data_t data;  MakeData(&data, sizeof(data));  // Pass back the data  //  PutData(&data, sizeof(data));}// returns pointer to the puck in the beam, or NULL if noneCEntity* CGripperDevice::BreakBeam( int beam ){  double px, py, pth;  GetGlobalPose( px, py, pth );  double xoffset, yoffset;    assert( beam < 2 );    double costh = cos( pth );  double sinth = sin( pth );  // if we have a normal (non-consuming) gripper and the paddles are closed,  // but we don't have a puck, then the beams are both clear. if we  // have at least one puck, then both beams are broken  if(!m_gripper_consume)  {    if(m_paddles_closed && !m_puck_count)      return(NULL);    else if(m_puck_count)      return(m_pucks[0]);  }  double xdist, ydist;  ydist = (this->size_y-2*this->m_paddle_height)/2.0;  /*  double xdist = 0;  double ydist = this->m_paddle_height;  */  switch( beam )  {    case 0:       xdist = this->size_x/2.0 + this->m_paddle_width;      break;    case 1:       xdist = this->size_x/2.0 + this->m_paddle_width/2.0;       break;    default:      printf("unknown gripper break beam number %d\n", beam);      return(NULL);  }    // transform to global coords  xoffset = xdist * costh - ydist * sinth;  yoffset = xdist * sinth + ydist * costh;  double beamlength = this->size_y-2*this->m_paddle_height;  CEntity* ent = 0;  /*  CLineIterator lit(px+xoffset, py+yoffset, pth - M_PI/2.0,                     this->size_y * 0.66, m_world->ppm, m_world->matrix,                     PointToBearingRange );    */  CLineIterator lit(px+xoffset, py+yoffset, pth - M_PI/2.0,                     beamlength, m_world->ppm, m_world->matrix,                     PointToBearingRange);     while( (ent = lit.GetNextEntity()) )  {    // grippers only perceive pucks right now.    //if( ent->stage_type == PuckType )    if( ent->gripper_return == GripperEnabled )      return ent;  }  return NULL;}    // Package up the gripper's state in the right format//void CGripperDevice::MakeData(player_gripper_data_t* data, size_t len){  // check length first  if(len != sizeof(player_gripper_data_t))  {    PRINT_MSG("CGripperDevice::MakeData(): got wrong-length data to fill\n");    return;  }  // break beams are now implemented  data->beams = 0;  data->beams |=  m_outer_break_beam ? 0x04 : 0x00;  data->beams |=  m_inner_break_beam ? 0x08 : 0x00;    //   both beams are broken when we're holding a puck  //data->beams |= (m_puck_count&&!m_gripper_consume) ? 0x04 : 0x00;  //data->beams |= (m_puck_count&&!m_gripper_consume) ? 0x08 : 0x00;  // set the proper bits  data->state = 0;  data->state |= m_paddles_open ? 0x01 : 0x00;  data->state |= m_paddles_closed ? 0x02 : 0x00;  data->state |= m_paddles_moving ? 0x04 : 0x00;  data->state |= m_gripper_error ? 0x08 : 0x00;  data->state |= m_lift_up ? 0x10 : 0x00;  data->state |= m_lift_down ? 0x20 : 0x00;  data->state |= m_lift_moving ? 0x40 : 0x00;  data->state |= m_lift_error ? 0x80 : 0x00;}    // Drop an object from the gripper (if there is one)//void CGripperDevice::DropObject(){  // if we don't have any pucks, then there are no pucks to drop  if(!m_puck_count)    return;  // find out where we are  double px,py,pth;  GetGlobalPose(px,py,pth);  // drop the last one we picked up  double x_offset = (this->size_x*2.0);  m_puck_count--;  //m_pucks[m_puck_count]->SetParent( (CEntity*)NULL );  m_pucks[m_puck_count]->SetParent( m_world->GetRoot() );  m_pucks[m_puck_count]->SetDirty(1);  m_pucks[m_puck_count]->SetGlobalPose(px+x_offset*cos(pth),                                       py+x_offset*sin(pth),                                       pth);  m_pucks[m_puck_count]->SetGlobalVel(0, 0, 0);  //printf("dropped puck %d at (%f,%f,%f) with speed %f\n",         //m_pucks[m_puck_count],         //px,py,pth,m_pucks[m_puck_count]->GetSpeed());  //if(!m_puck_count)  //REMOVE  expGripper.have_puck = false;}    // Try to pick up an object with the gripper//void CGripperDevice::PickupObject(){  if(m_puck_count >= m_puck_capacity)    return;    // get our position  double px,py,pth;  GetGlobalPose(px,py,pth);  // find the closest puck  CEntity* closest_puck=NULL;  //double closest_dist = MAXDOUBLE;  //double ox,oy,oth;  //double this_dist;  // first, check the inner break beam  if((closest_puck = BreakBeam(1)))  {    // make sure that we're not trying to pick up    // an already picked up puck    int j;    for(j=0;j<m_puck_count;j++)    {      if(m_pucks[j] == closest_puck )        break;    }    if(j < m_puck_count)      closest_puck = NULL;  }  // if nothing there, check the outer break beam  if(!closest_puck && (closest_puck = BreakBeam(0)))  {    // make sure that we're not trying to pick up    // an already picked up puck    int j;    for(j=0;j<m_puck_count;j++)    {      if(m_pucks[j] == closest_puck )        break;    }    if(j < m_puck_count)      closest_puck = NULL;  }  if(closest_puck)  {    // pickup the puck    closest_puck->SetParent( this );    // if we're consuming the puck then move it behind the gripper    if(m_gripper_consume)      closest_puck->SetPose(-this->size_x,0,0);    else      closest_puck->SetPose(this->size_x/2.0+closest_puck->size_x/2.0,0,0);    m_pucks[m_puck_count++]=closest_puck;    closest_puck->SetDirty(1);  }}#ifdef INCLUDE_RTK2///////////////////////////////////////////////////////////////////////////// Initialise the rtk guivoid CGripperDevice::RtkStartup(){  CPlayerEntity::RtkStartup();    // Create a figure representing this object  this->grip_fig = rtk_fig_create(m_world->canvas, NULL, 49);  // Set the color  rtk_fig_color_rgb32(this->grip_fig, this->color);  // Create a figure representing the inner breakbeam  this->inner_beam_fig = rtk_fig_create(m_world->canvas, NULL, 49);  // Create a figure representing the outer breakbeam  this->outer_beam_fig = rtk_fig_create(m_world->canvas, NULL, 49);}///////////////////////////////////////////////////////////////////////////// Finalise the rtk guivoid CGripperDevice::RtkShutdown(){  // Clean up the figure we created  rtk_fig_destroy(this->grip_fig);  CPlayerEntity::RtkShutdown();} ///////////////////////////////////////////////////////////////////////////// Process GUI update messages//void CGripperDevice::RtkUpdate(){  CPlayerEntity::RtkUpdate();    // Get global pose  double gx, gy, gth;  GetGlobalPose(gx, gy, gth);  rtk_fig_clear(this->grip_fig);  rtk_fig_origin(this->grip_fig, gx, gy, gth );  // Draw the gripper  //rtk_fig_rectangle(this->grip_fig, 0, 0, 0, this->size_x, this->size_y,                     //false);      // locate the paddles  double x_offset;  double y_offset;  if(this->m_paddles_open)  {    x_offset = (this->size_x/2.0)+(this->m_paddle_width/2.0);    y_offset = (this->size_y/2.0)-(this->m_paddle_height/2.0);  }  else  {    x_offset = (this->size_x/2.0)+(this->m_paddle_width/2.0);    y_offset = (this->m_paddle_height/2.0);  }  // Draw the paddles  /*  rtk_fig_rectangle(this->grip_fig,                    (x_offset*cos(gth))+(y_offset*-sin(gth)),                    (x_offset*sin(gth))+(y_offset*cos(gth)),                    0,                     this->m_paddle_width,                    this->m_paddle_height,                    false);                    */  rtk_fig_rectangle(this->grip_fig,                    x_offset, y_offset, 0,                    this->m_paddle_width,                    this->m_paddle_height,                    false);  rtk_fig_rectangle(this->grip_fig,                    x_offset, -y_offset, 0,                    this->m_paddle_width,                    this->m_paddle_height,                    false);  rtk_fig_clear(this->inner_beam_fig);  rtk_fig_clear(this->outer_beam_fig);    // if a client is subscribed to this device, then draw break beams  if(this->m_paddles_open &&      Subscribed() > 0 &&      m_world->ShowDeviceData(this->lib_entry->type_num) )  {    rtk_fig_origin(this->inner_beam_fig, gx, gy, gth );    rtk_fig_origin(this->outer_beam_fig, gx, gy, gth );    double xdist, ydist;    ydist = (this->size_y-2*this->m_paddle_height)/2.0;        if(this->m_inner_break_beam)    {      // beam broken: set to red      rtk_fig_color_rgb32(this->inner_beam_fig, this->broken_beam_color);    }    else    {      // beam unbroken: set to pale blue      rtk_fig_color_rgb32(this->inner_beam_fig, this->clear_beam_color);    }       // draw inner beam    xdist = this->size_x/2.0 + this->m_paddle_width/2.0;    rtk_fig_line(this->inner_beam_fig, xdist, ydist, xdist, -ydist);    if(this->m_outer_break_beam)    {      // beam broken: set to red      rtk_fig_color_rgb32(this->outer_beam_fig, this->broken_beam_color);    }    else    {      // beam unbroken: set to pale blue      rtk_fig_color_rgb32(this->outer_beam_fig, this->clear_beam_color);    }    // draw outer beam    xdist = this->size_x/2.0 + this->m_paddle_width;    rtk_fig_line(this->outer_beam_fig, xdist, ydist, xdist, -ydist);  }}#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕第一区综合| 另类小说欧美激情| 奇米综合一区二区三区精品视频| 精品系列免费在线观看| 色8久久精品久久久久久蜜| 欧美日韩精品欧美日韩精品一综合| 精品免费日韩av| 亚洲天堂av一区| 看片的网站亚洲| 91激情在线视频| 久久久国产午夜精品| 日韩激情av在线| 91福利视频在线| 中文字幕巨乱亚洲| 久久99国产精品免费网站| 欧美日韩视频在线一区二区| 国产精品欧美一区喷水| 久久国产精品99久久久久久老狼| 日本高清无吗v一区| 久久精品亚洲精品国产欧美kt∨| 亚洲成a人片综合在线| av资源站一区| 国产欧美一区二区精品性色| 久久国产婷婷国产香蕉| 欧美午夜精品久久久久久孕妇 | 中文字幕免费观看一区| 日本欧美一区二区| 欧美肥大bbwbbw高潮| 亚洲影院久久精品| 91国在线观看| 亚洲综合一区二区三区| 色狠狠色噜噜噜综合网| 1024精品合集| 色乱码一区二区三区88| 亚洲欧美日韩一区二区三区在线观看 | 99热这里都是精品| 国产精品嫩草影院com| 国产99久久久国产精品免费看| 欧美精品一区二区不卡| 韩国av一区二区三区四区| 久久综合色婷婷| 激情综合色综合久久| 精品国产免费一区二区三区四区 | 在线日韩国产精品| 亚洲一区二区视频在线观看| 日本韩国欧美一区二区三区| 亚洲精品国产第一综合99久久| 91蜜桃传媒精品久久久一区二区| 中文字幕亚洲区| 日本精品一级二级| 一区二区在线观看视频在线观看| 在线免费观看视频一区| 视频一区中文字幕| 久久亚洲捆绑美女| 成+人+亚洲+综合天堂| 国产精品视频你懂的| 91丨九色丨国产丨porny| 亚洲欧美国产三级| 91精品国产综合久久香蕉的特点 | 亚洲国产精品av| 91亚洲男人天堂| 五月激情综合婷婷| 久久久久久久久久久久久久久99 | 久久精品欧美一区二区三区不卡| 国产成人av福利| 亚洲欧美视频在线观看| 欧美日韩成人高清| 国产精品亚洲а∨天堂免在线| 中文字幕视频一区| 欧美一区二区精品| 9i在线看片成人免费| 天天综合色天天综合色h| 久久久久久综合| 欧美午夜精品免费| 国产成人av网站| 天堂影院一区二区| 国产精品午夜在线| 4438x成人网最大色成网站| 国产成人免费视频| 日韩精品成人一区二区在线| 欧美激情一区二区三区四区 | 久久蜜桃香蕉精品一区二区三区| 成人精品国产免费网站| 日韩中文字幕av电影| 中文在线一区二区 | 美女诱惑一区二区| 亚洲图片你懂的| 久久蜜桃一区二区| 欧美精选一区二区| 色综合久久中文综合久久牛| 久久精品国内一区二区三区| 有码一区二区三区| 日韩一区在线播放| 久久免费视频色| 日韩视频在线你懂得| 91久久精品一区二区二区| 成人午夜在线播放| 国产一区二区三区电影在线观看| 日韩在线一区二区| 一区二区三区四区国产精品| 国产色产综合色产在线视频| 日韩一区二区精品| 欧美精品丝袜中出| 欧美三级资源在线| 91行情网站电视在线观看高清版| 国产成人精品影院| 国产在线精品一区二区不卡了| 日本人妖一区二区| 日韩电影在线观看网站| 天堂蜜桃91精品| 日韩高清不卡一区| 日韩激情在线观看| 日本视频一区二区三区| 视频一区二区中文字幕| 偷拍一区二区三区四区| 亚洲成av人片在www色猫咪| 亚洲高清视频在线| 天天操天天综合网| 秋霞电影网一区二区| 美女精品自拍一二三四| 麻豆91精品视频| 国产精品66部| 成人免费毛片a| 91碰在线视频| 欧美日韩视频一区二区| 538在线一区二区精品国产| 欧美一区二区三区在线| 日韩精品在线网站| 久久久国产午夜精品| 国产精品久久久久毛片软件| 中文字幕日韩一区二区| 一区二区三区.www| 视频一区视频二区在线观看| 裸体在线国模精品偷拍| 国产成人一区二区精品非洲| 成人福利视频网站| 色八戒一区二区三区| 欧美日韩国产综合久久| 精品国产亚洲在线| 亚洲欧洲韩国日本视频| 亚洲高清免费观看高清完整版在线观看| 婷婷开心激情综合| 国产精品一区二区三区网站| 91在线云播放| 欧美日韩精品免费观看视频| 精品国精品国产| 亚洲乱码一区二区三区在线观看| 亚洲国产成人av| 国产精品99精品久久免费| 色视频成人在线观看免| 日韩精品在线一区| 亚洲欧洲中文日韩久久av乱码| 日韩国产欧美一区二区三区| 懂色av中文一区二区三区| 在线观看av一区| 国产日韩欧美一区二区三区综合| 免费人成在线不卡| 国产一区二区三区四区五区美女| 成人97人人超碰人人99| 91精品欧美久久久久久动漫 | 亚洲日本乱码在线观看| 日韩精品电影一区亚洲| 国产成人精品影院| 欧美日韩极品在线观看一区| 久久精品一区四区| 亚洲成人在线观看视频| 国产69精品久久久久777| 欧美精品自拍偷拍动漫精品| 欧美国产日韩亚洲一区| 日本中文字幕不卡| 日本韩国一区二区三区| 国产午夜精品一区二区三区视频| 午夜精品久久久久| 91在线你懂得| 久久久久成人黄色影片| 奇米777欧美一区二区| 在线观看日韩av先锋影音电影院| 国产日韩三级在线| 蜜桃视频第一区免费观看| 欧美在线free| 最新国产精品久久精品| 国产专区欧美精品| 日韩一区二区精品葵司在线 | 裸体健美xxxx欧美裸体表演| 欧美体内she精视频| 国产精品女同一区二区三区| 麻豆精品蜜桃视频网站| 在线观看91精品国产入口| 最新国产の精品合集bt伙计| 国产精品2024| 久久久精品黄色| 国产一区高清在线| 26uuu亚洲综合色欧美| 轻轻草成人在线| 91精品久久久久久久久99蜜臂| 亚洲国产日产av| 欧美色区777第一页| 亚洲与欧洲av电影| 欧美在线观看一区| 亚洲二区视频在线|