ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
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
}
}
}
2 | No.2 Revision |
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
}
}
}
3 | No.3 Revision |
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
}
}
}
4 | No.4 Revision |
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
}
}
}
5 | No.5 Revision |
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
}
}
}