53 int deltax = abs(x1 - x0);
54 int deltay = abs(y1 - y0);
58 int xinc1, xinc2, yinc1, yinc2;
59 int den, num, numadd, numpixels;
61 base_local_planner::Position2DInt pt;
104 for (
int curpixel = 0; curpixel <= numpixels; curpixel++)
125 base_local_planner::Position2DInt
swap, pt;
127 while (i < footprint.size() - 1) {
128 if (footprint[i].x > footprint[i + 1].x) {
130 footprint[i] = footprint[i + 1];
131 footprint[i + 1] =
swap;
141 base_local_planner::Position2DInt min_pt;
142 base_local_planner::Position2DInt max_pt;
143 unsigned int min_x = footprint[0].x;
144 unsigned int max_x = footprint[footprint.size() -1].x;
146 for (
unsigned int x = min_x; x <= max_x; ++x) {
147 if (i >= footprint.size() - 1) {
150 if (footprint[i].y < footprint[i + 1].y) {
151 min_pt = footprint[i];
152 max_pt = footprint[i + 1];
154 min_pt = footprint[i + 1];
155 max_pt = footprint[i];
159 while (i < footprint.size() && footprint[i].x == x) {
160 if(footprint[i].y < min_pt.y) {
161 min_pt = footprint[i];
162 }
else if(footprint[i].y > max_pt.y) {
163 max_pt = footprint[i];
169 for (
unsigned int y = min_pt.y; y < max_pt.y; ++y) {
172 footprint.push_back(pt);
182 std::vector<geometry_msgs::Point> footprint_spec,
187 double theta_i = pos[2];
188 std::vector<base_local_planner::Position2DInt> footprint_cells;
191 if (footprint_spec.size() <= 1) {
194 Position2DInt center;
197 footprint_cells.push_back(center);
199 return footprint_cells;
203 double cos_th = cos(theta_i);
204 double sin_th = sin(theta_i);
206 unsigned int x0, y0, x1, y1;
207 unsigned int last_index = footprint_spec.size() - 1;
209 for (
unsigned int i = 0; i < last_index; ++i) {
211 new_x = x_i + (footprint_spec[i].x * cos_th - footprint_spec[i].y * sin_th);
212 new_y = y_i + (footprint_spec[i].x * sin_th + footprint_spec[i].y * cos_th);
213 if(!costmap.
worldToMap(new_x, new_y, x0, y0)) {
214 return footprint_cells;
218 new_x = x_i + (footprint_spec[i + 1].x * cos_th - footprint_spec[i + 1].y * sin_th);
219 new_y = y_i + (footprint_spec[i + 1].x * sin_th + footprint_spec[i + 1].y * cos_th);
220 if (!costmap.
worldToMap(new_x, new_y, x1, y1)) {
221 return footprint_cells;
228 new_x = x_i + (footprint_spec[last_index].x * cos_th - footprint_spec[last_index].y * sin_th);
229 new_y = y_i + (footprint_spec[last_index].x * sin_th + footprint_spec[last_index].y * cos_th);
230 if (!costmap.
worldToMap(new_x, new_y, x0, y0)) {
231 return footprint_cells;
233 new_x = x_i + (footprint_spec[0].x * cos_th - footprint_spec[0].y * sin_th);
234 new_y = y_i + (footprint_spec[0].x * sin_th + footprint_spec[0].y * cos_th);
235 if(!costmap.
worldToMap(new_x, new_y, x1, y1)) {
236 return footprint_cells;
245 return footprint_cells;