# How to extract max(x-axis) and min(x-axis) from costmap I want to know maximum value of x Axis in costmap. How can I get it with C++? In old code, I found a next expression.

map_upperbound = costmap_->getSizeInMetersX() - costmap_->getOriginX();
map_lowerbound = map_upperbound - costmap_->getSizeInMetersX();
bounds.setHigh(0, map_upperbound);
bounds.setLow(0, map_lowerbound);
ROS_DEBUG("Setting uper bound and lower bound of map x-coordinate to (%f, %f).", map_upperbound, map_lowerbound);


I think that this is wrong. or I'm wrong? As dornhege says, this code is correct. I understand that getSizeInMetersX() gets a width of X axis on a map. So, minimum value of x-axis is 0 and maximum value of x-axis is getSizeInMetersX().
At once, I edited a code like a following.

map_upperbound = costmap_->getSizeInMetersX() - 0.0;
map_lowerbound = -map_upperbound;


So, RRT planner began to plan.

[ INFO] [1403639024.861823324]: odom received!
Debug:   RRT: Planner range detected to be 113.437104
Info:    RRT: Starting with 1 states
Info:    RRT: Created 7 states
Info:    Solution found in 0.021853 seconds
Info:    Path simplification took 0.000126 seconds

edit retag close merge delete

Thanks @dornhege: if getOriginX() is 0, map_upperbound = getSizeInMetersX() and map_lowerbound = 0. I think so. I expected map_lowerbound = - value. My thought is wrong?
@dornhege, Could you help me how to extract max(x-axis), min(x-axis), max(y-axis) and min(y-axis) using python?