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

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

?? lowmap.c

?? 卡內基梅隆大學(CMU)開發的移動機器人控制開發軟件包??蓪Χ喾N機器人進行控制
?? C
?? 第 1 頁 / 共 4 頁
字號:
//
// This Program is provided by Duke University and the authors as a service to the
// research community. It is provided without cost or restrictions, except for the
// User's acknowledgement that the Program is provided on an "As Is" basis and User
// understands that Duke University and the authors make no express or implied
// warranty of any kind.  Duke University and the authors specifically disclaim any
// implied warranty or merchantability or fitness for a particular purpose, and make
// no representations or warranties that the Program will not infringe the
// intellectual property rights of others. The User agrees to indemnify and hold
// harmless Duke University and the authors from and against any and all liability
// arising out of User's use of the Program.
//
// lowMap.c
//
// Copyright 2005, Austin Eliazar, Ronald Parr, Duke University
//
// Code for generating and maintaining maps (for the low level of the hierarchy)
//

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <math.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#include "lowMap.h"

// Unobserved grid squares are treated of having a prior of one stopped scan per 
// 8 meters of laser scan. 
#define L_PRIOR (-1.0/(MAP_SCALE*8.0))
// The strength of the prior is set to be as if 4 grid squares worth of observation 
// has already been made at the prior's density
#define L_PRIOR_DIST 4.0

// The global map for the low level, which contains all observations that any particle 
// has made to any specific grid square.
PMapStarter lowMap[MAP_WIDTH][MAP_HEIGHT];

// The nodes of the ancestry tree are stored here. Since each particle has a unique ID, 
// we can quickly access the particles via their ID in this array. See the structure 
// TAncestor in map.h for more details.
TAncestor l_particleID[ID_NUMBER];

// Our current set of particles being processed by the particle filter
TParticle l_particle[PARTICLE_NUMBER];
// We like to keep track of exactly how many particles we are currently using.
int l_cur_particles_used;
int FLAG;


//
// This process should be called at the start of each iteration of the slam process.
// It clears the observation cache so that it can be reloaded with the local maps 
// for the new iteration. 
//
void LowInitializeFlags()
{
  // Each entry observationArray corresponds to a single grid square in the global 
  // map. observationID is a count of how many of these entries there are. For each
  // one of these entries, obsX/obsY represent its x,y coordinate in the global map.
  // flagMap is an array the size of the global map, which gives a proper index into 
  // observationArray for that location. Therefore, we are resetting all non-zero 
  // entries of flagMap while resetting the arrays of obsX/obsY 
  while (observationID > 0) {
    observationID--;
    flagMap[obsX[observationID]][obsY[observationID]] = 0;
    obsX[observationID] = 0;
    obsY[observationID] = 0;
  }
  observationID = 1;
}


//
// Initializes the lowMap and the observationArray.
// Always returns 0 to indicate that it was successful.
//
void LowInitializeWorldMap()
{
  int x, y;

  for (y=0; y < MAP_HEIGHT; y++)
    for (x=0; x < MAP_WIDTH; x++) {
      // The map is a set of pointers. Null represents that it is unobserved.
      lowMap[x][y] = NULL;
      // flagMap is set to all zeros, indicating that location does not have an
      // entry in the observationArray
      flagMap[x][y] = 0;
    }

  // There are no entries in the observationArray yet, so obsX/obsY are set to 0
  for (x=0; x < AREA; x++) {
    obsX[x] = 0;
    obsY[x] = 0;
  }

  // observationArray[0] is reserved as a constant for "unused". We start the
  // array at 1.
  observationID = 1;
}



//
// Frees up all of the memory being used by the map. Completely erases all info in
// that map, making it ready for another slam implementation. In hierarchical slam, 
// this is called inbetween iterations of the high level slam, since each low level
// process runs essentially independently of previous low level processes.
//
void LowDestroyMap()
{
  int x, y;

  // Get rid of the old map.
  for (y=0; y < MAP_HEIGHT; y++)
    for (x=0; x < MAP_WIDTH; x++) {
      while (lowMap[x][y] != NULL) {
	free(lowMap[x][y]->array);
	free(lowMap[x][y]);
	lowMap[x][y] = NULL;
      }
    }
}



//
// Each grid square contains a dynamic array of the observations made at that grid 
// square. Therefore, these arrays need to be resized occasionally. In the process
// of resizing the array, we also clean up any redundant or obsolete "dead" entries.
//
void LowResizeArray(TMapStarter *node, int deadID)
{
  short int i, j, ID, x, y;
  short int hash[ID_NUMBER];
  int source, last;
  TMapNode *temp;

  // This is a special flag that can be raised when calling LowResizeArray, indicating
  // that a specific ID is "dead". Currently this is only used when the ancestry tree
  // is pruning off a dead branch, and the process of removing the corresponding 
  // observations leads to a reduction in the size of a dynamic array.
  if (deadID >= 0)
    node->dead++;

  // Create a new array of the appropriate size.
  // Don't count the dead entries in computing the new size
  node->size = (int)(ceil((node->total - node->dead)*1.75));
  temp = (TMapNode *) malloc(sizeof(TMapNode)*node->size);
  if (temp == NULL) fprintf(stderr, "Malloc failed in expansion of arrays.  %d\n", node->size);

  // Initialize our hash table.
  for (i=0; i < ID_NUMBER; i++)
    hash[i] = -1;

  j = 0;
  // Run through each entry in our old array of observations.
  for (i=0; i < node->total; i++) {
    if (node->array[i].ID == deadID) {
      // Denote that this has been removed already. Therefore, we won't try to remove it later.
      // We don't bother actually removing the source, since the only way that we can have a deadID is if we are in
      // the process of removing all updates that deadID has made.
      l_particleID[deadID].mapEntries[node->array[i].source].node = -1;
    }

    // This observation is the first one of this ID entered into the new array. Just copy it over, and note its position.
    else if (hash[node->array[i].ID] == -1) {
      // Copy the information into the new array.
      temp[j].ID = node->array[i].ID;
      temp[j].source = node->array[i].source;
      temp[j].parentGen = node->array[i].parentGen;
      temp[j].hits = node->array[i].hits;
      temp[j].distance = node->array[i].distance;

      // This entry is moving- alter its source to track it
      l_particleID[ temp[j].ID ].mapEntries[ temp[j].source ].node = j;

      // Note that an observation with this ID has already been entered into the new array, and where that was entered.
      hash[node->array[i].ID] = j;
      j++;
    }

    // There is already an entry in the new array with the same ID, and this current observation is
    // actually more recent (as indicated by having seen more distance of laser scans). This current
    // observation will replace the older one.
    else if (node->array[i].distance > temp[hash[node->array[i].ID]].distance) {
      // We set a couple of values to shorter variable names, in order to reduce indirection and make 
      // reading the code easier.
      ID = node->array[i].ID;   // The ID of the observations in conflict.
      source = temp[hash[ID]].source;  // The ancestor node corresponding to that ID

      // Remove the source of the dead entry
      l_particleID[ID].total--;
      last = l_particleID[ID].total;
      l_particleID[ID].mapEntries[source].x = l_particleID[ID].mapEntries[last].x;
      l_particleID[ID].mapEntries[source].y = l_particleID[ID].mapEntries[last].y;
      l_particleID[ID].mapEntries[source].node = l_particleID[ID].mapEntries[last].node;

      // The last source entry was moved into this newly vacated position. Make sure that the 
      // observation it links to notes the new source position.
      x = l_particleID[ID].mapEntries[source].x;
      y = l_particleID[ID].mapEntries[source].y;

      if ((lowMap[x][y] == node) && (l_particleID[ID].mapEntries[source].node < i))
	temp[hash[ID]].source = source;
      else
	lowMap[x][y]->array[ l_particleID[ID].mapEntries[source].node ].source = source;

      // Copy the more recent information into the slot previously held by the dead entry
      temp[hash[ID]].source = node->array[i].source;
      temp[hash[ID]].hits = node->array[i].hits;
      temp[hash[ID]].distance = node->array[i].distance;
      // We do not copy over the parentGen- we are inheriting it from the dead entry, since it was the predecessor
      // The ID does not need to be copied, since it was necessarily the same for both observations.

      // This entry is moving- alter its source to track it
      l_particleID[ID].mapEntries[ node->array[i].source ].node = hash[ID];
    }

    // There was already an entry for this ID. This new entry is an older form of the observation already recorded. Therefore, 
    // the new entry is dead, and should not be copied over, and it's source in the ancestry tree should be removed.
    else {
      // The new entry is an older form of the one already entered. We should inherit the new parentGen
      if (node->array[i].parentGen != -1)
	temp[hash[node->array[i].ID]].parentGen = node->array[i].parentGen;

      ID = node->array[i].ID;
      source = node->array[i].source;

      // Remove the source of the dead entry
      l_particleID[ID].total--;
      last = l_particleID[ID].total;

      if (last != source) {
	l_particleID[ID].mapEntries[source].x = l_particleID[ID].mapEntries[last].x;
	l_particleID[ID].mapEntries[source].y = l_particleID[ID].mapEntries[last].y;
	l_particleID[ID].mapEntries[source].node = l_particleID[ID].mapEntries[last].node;

	// A source entry was moved. Make sure that the observation it links to notes the new source position.
	x = l_particleID[ID].mapEntries[source].x;
	y = l_particleID[ID].mapEntries[source].y;

	if ((lowMap[x][y] == node) && (l_particleID[ID].mapEntries[source].node <= i))
	  temp[hash[ID]].source = source;
	else
	  lowMap[x][y]->array[ l_particleID[ID].mapEntries[source].node ].source = source;
      }
    }

  }

  // Note the new total, which should be the previous size minus the dead.
  node->total = j;
  // After completing this process, we have removed all dead entries.
  node->dead = 0;
  free(node->array);
  node->array = temp;
}


//
// When we add a new entry to workingArray, there is a chance that we will run into a dead entry. 
// If so, we will need to delete the dead entry, by copying the last entry in the array onto its
// location. We then need to recursively add the entry (that we just copied onto that spot) to 
// the workingArray
//
static void AddToWorkingArray(int i, TMapStarter *node, short int workingArray[]) 
{
  int j, source, last;
  TEntryList *entries;

  // Keep an eye out for dead entries. They will be made apparent when two entries both have the same ID.
  if (workingArray[node->array[i].ID] == -1) 
    workingArray[node->array[i].ID] = i;

  else {
    // The node we are currently looking at is the dead one.
    if (node->array[i].distance < node->array[ workingArray[node->array[i].ID] ].distance) {
      // Otherwise, remove the source, then remove the entry. Follow with a recursive call.
      j = i;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产不卡视频在线观看| 精品日韩在线观看| 91精品国产综合久久香蕉麻豆| 精品国产免费人成电影在线观看四季 | 色噜噜狠狠色综合中国| 日韩欧美二区三区| 亚洲777理论| 在线观看日韩电影| 欧美国产日韩亚洲一区| 奇米综合一区二区三区精品视频 | 久久久久久黄色| 日韩电影免费在线| 在线观看免费成人| 亚洲日本在线天堂| av福利精品导航| 国产精品乱码久久久久久| 久久福利资源站| 欧美一级久久久久久久大片| 亚洲另类春色校园小说| 北条麻妃国产九九精品视频| 久久久91精品国产一区二区三区| 偷偷要91色婷婷| 欧美老年两性高潮| 一区二区三区自拍| 91免费视频网| 亚洲精品国久久99热| 94色蜜桃网一区二区三区| 国产精品亲子伦对白| 成年人网站91| 亚洲色图视频网站| 色综合网色综合| 亚洲资源在线观看| 欧美亚洲综合在线| 午夜免费久久看| 日韩女优制服丝袜电影| 捆绑调教美女网站视频一区| 欧美一区二视频| 精品中文字幕一区二区| 久久伊人蜜桃av一区二区| 国产精品91一区二区| 欧美国产在线观看| 99免费精品在线观看| 亚洲精品视频在线观看网站| 欧美午夜精品久久久| 亚洲图片欧美一区| 日韩午夜激情av| 国产成人在线看| 一区二区三区精品视频| 欧美日韩性生活| 精久久久久久久久久久| 中文字幕 久热精品 视频在线| 99r精品视频| 日韩在线卡一卡二| 国产亚洲精品中文字幕| 9i在线看片成人免费| 亚洲午夜视频在线观看| 日韩欧美综合在线| 成人午夜在线播放| 亚洲bt欧美bt精品| 国产欧美日韩三级| 在线观看日韩国产| 国产一区在线精品| 亚洲色图欧美在线| 精品国产一区二区在线观看| 99久久综合精品| 午夜精品一区二区三区免费视频 | 亚洲精品久久久久久国产精华液| 欧美另类变人与禽xxxxx| 九九在线精品视频| 亚洲另类在线一区| 久久先锋资源网| 91理论电影在线观看| 毛片av一区二区| 一区二区在线观看不卡| 日韩免费视频一区| 色婷婷国产精品久久包臀| 九九久久精品视频| 亚洲成人福利片| 18欧美亚洲精品| 欧美不卡激情三级在线观看| 91女厕偷拍女厕偷拍高清| 精品一区二区三区在线播放视频| 一区二区三区中文字幕在线观看| xvideos.蜜桃一区二区| 欧美日韩免费高清一区色橹橹| 国产乱子伦一区二区三区国色天香| 亚洲麻豆国产自偷在线| 久久久www免费人成精品| 欧美日韩www| 欧美综合在线视频| 不卡一二三区首页| 国产福利91精品一区二区三区| 免费成人在线观看| 首页国产丝袜综合| 亚洲妇女屁股眼交7| 亚洲欧美综合在线精品| 久久精品一区四区| 精品久久一区二区三区| 欧美电影在线免费观看| 色综合 综合色| 成人av综合在线| 国产精品一品视频| 国产精一区二区三区| 精品一区二区三区av| 五月天亚洲精品| 亚洲午夜久久久久中文字幕久| 中文字幕视频一区| 国产欧美精品区一区二区三区| 欧美一级艳片视频免费观看| 欧美三级三级三级爽爽爽| 欧美视频一二三区| 777a∨成人精品桃花网| 欧美日韩一区二区在线观看视频| 色综合久久久网| 在线一区二区三区| 欧美中文字幕亚洲一区二区va在线 | 夜夜夜精品看看| 一区二区三区日本| 亚洲午夜精品在线| 日韩在线一二三区| 麻豆91在线看| 国产麻豆视频一区| 丁香亚洲综合激情啪啪综合| 国产成人精品亚洲午夜麻豆| 国产乱码精品一品二品| 东方欧美亚洲色图在线| 97精品超碰一区二区三区| 91久久免费观看| 欧美这里有精品| 欧美一区二区三区性视频| 亚洲精品在线三区| 日本一区二区成人在线| 国产精品成人免费| 亚洲小少妇裸体bbw| 美女脱光内衣内裤视频久久网站| 国内精品免费在线观看| www.性欧美| 欧美系列在线观看| 欧美成人福利视频| 中文字幕色av一区二区三区| 亚洲欧美色综合| 免费欧美日韩国产三级电影| 国产精品一区二区x88av| 91成人在线精品| 精品国产精品网麻豆系列| 亚洲国产成人私人影院tom| 亚洲福利电影网| 国产精品伊人色| 欧美偷拍一区二区| 久久久亚洲国产美女国产盗摄| 亚洲人吸女人奶水| 久久99精品国产麻豆婷婷洗澡| 成人午夜av影视| 日韩一本二本av| 亚洲欧美区自拍先锋| 美女国产一区二区三区| 93久久精品日日躁夜夜躁欧美| 欧美精品 日韩| 中文字幕一区二区三区视频| 日韩激情在线观看| 99久久综合色| 久久综合久色欧美综合狠狠| 亚洲美女视频在线| 国产伦精品一区二区三区免费迷 | 国产日韩v精品一区二区| 亚洲国产一区二区视频| 国产伦精品一区二区三区视频青涩 | 六月丁香综合在线视频| www.欧美日韩| 欧美精品一区二区不卡| 一区二区三区日本| 成人免费视频播放| 日韩视频一区二区在线观看| 亚洲女人的天堂| 国产高清精品久久久久| 日韩欧美中文一区二区| 亚洲夂夂婷婷色拍ww47| 成人永久免费视频| 久久综合视频网| 久久精品免费观看| 欧美日韩高清一区| 一区二区三区在线播| 国产成人免费av在线| 精品国产a毛片| 极品少妇一区二区| 欧美一区二区观看视频| 亚洲国产精品嫩草影院| 91首页免费视频| 国产精品第一页第二页第三页| 久久精品国产成人一区二区三区| 欧美日本乱大交xxxxx| 一区二区高清免费观看影视大全| 高清国产一区二区| 国产精品美女视频| 成人app在线观看| 国产精品乱码一区二三区小蝌蚪| 国产69精品一区二区亚洲孕妇 | 国产精品18久久久久久久久| 欧美一区二区啪啪| 老司机午夜精品|