ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I think you want to make a path planning using OccupancyGrid, the data types defined in this message type are ;

# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.

Header header 

#MetaData for the map
MapMetaData info

# The map data, in row-major order, starting with (0,0).  Occupancy
# probabilities are in the range [0,100].  Unknown is -1.
int8[] data

data array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.

You can get x,y position of each cell using meta data of map inside info

for example;

void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
  for(int i=0; i<grid->info.height){
    for(int j =0; j<grid->info.width){
         int current_cell_value = grid->data[i+ grid->info.width * j];
         // do someprocessing according to cell value you got
      }
  }
}

I think you want to make a path planning using OccupancyGrid, the data types defined in this message type are ;

# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.

Header header 

#MetaData for the map
MapMetaData info

# The map data, in row-major order, starting with (0,0).  Occupancy
# probabilities are in the range [0,100].  Unknown is -1.
int8[] data

data array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.

You can get x,y position of each cell using meta data of map inside info

for example;

void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
  for(int i=0; i<grid->info.height){
i<grid->info.height; i++){
    for(int j =0; j<grid->info.width){
j<grid->info.width; j++){
         int current_cell_value = grid->data[i+ grid->info.width * j];
         // do someprocessing some processing according to cell value you got
      }
  }
}

I think you want to make a path planning using OccupancyGrid, the data types defined in this message type are ;

# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.

Header header 

#MetaData for the map
MapMetaData info

# The map data, in row-major order, starting with (0,0).  Occupancy
# probabilities are in the range [0,100].  Unknown is -1.
int8[] data

data array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.

You can get x,y position of each cell using meta data of map inside info

for example;

void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
  for(int i=0; i<grid->info.height; i<grid->info.height+1; i++){
    for(int j =0; j<grid->info.width; j<grid->info.width+1; j++){
         int current_cell_value = grid->data[i+ grid->info.width * j];
j-1];
         // do some processing according to cell value you got
      }
  }
}

I think you want to make a path planning using OccupancyGrid, the data types defined in this message type are ;

# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.

Header header 

#MetaData for the map
MapMetaData info

# The map data, in row-major order, starting with (0,0).  Occupancy
# probabilities are in the range [0,100].  Unknown is -1.
int8[] data

data array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.

You can get x,y position of each cell using meta data of map inside info

for example;

void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
  for(int i=0; i<grid->info.height+1; i++){
    for(int j =0; j<grid->info.width+1; j++){
         int current_cell_value = grid->data[i+ grid->info.width (grid->info.width * j-1];
j-1)];
         // do some processing according to cell value you got
      }
  }
}

I think you want to make a path planning using OccupancyGrid, the data types defined in this message type are ;

# This represents a 2-D grid map, in which each cell represents the probability of
# occupancy.

Header header 

#MetaData for the map
MapMetaData info

# The map data, in row-major order, starting with (0,0).  Occupancy
# probabilities are in the range [0,100].  Unknown is -1.
int8[] data

data array indicates whether a cell is occupied or not,. Note that this is a 1D array which you need to think/convert it to 2D.

You can get x,y position of each cell using meta data of map inside info

for example;

void YourClass::QueryMapCellInfo(const nav_msgs::OccupancyGridConstPtr &grid){
  for(int i=0; i<grid->info.height+1; i<grid->info.height; i++){
    for(int j =0; j<grid->info.width+1; j<grid->info.width; j++){
         int current_cell_value = grid->data[i+ (grid->info.width * j-1)];
j)];
         // do some processing according to cell value you got
      }
  }
}