1 #ifndef JSK_FOOTSTEP_PLANNER_GRID_GRAPH_H_
2 #define JSK_FOOTSTEP_PLANNER_GRID_GRAPH_H_
9 template <
class GStateT>
28 inline virtual bool setCost(std::vector<float> in)
31 for(
int i = 0;
i < cnt;
i++) {
35 inline virtual bool setCost(
int ix,
int iy,
float cost = 0.0)
37 return getState(ix, iy)->setCost(cost);
42 for(
int i = 0;
i < cnt;
i++) {
46 inline virtual bool setOccupancy(
int ix,
int iy,
int occupancy = 0)
48 return getState(ix, iy)->setOccupancy(occupancy);
52 return getState(ix, iy)->getOccupancy();
54 inline virtual float getCost(
int ix,
int iy)
58 inline virtual bool isValid(
int ix,
int iy)
65 inline virtual int index(
int ix,
int iy) {
return ((
size_x_ * iy) + ix); }
66 inline virtual int inRange(
int ix,
int iy) {
return (ix >= 0 && ix < size_x_ && iy >= 0 && iy <
size_y_ ); }
83 template <
class GStateT>
109 std::vector<StatePtr> ret;
110 int x_offset = target_state->indexX();
111 int y_offset = target_state->indexY();
112 for (
int x = -1;
x < 2;
x++) {
113 for (
int y = -1;
y < 2;
y++) {
114 if (
x != 0 ||
y != 0) {
135 double gx = from->indexX() - to->indexX();
136 double gy = from->indexY() - to->indexY();
137 return prev_cost + std::sqrt(gx * gx + gy * gy) + to->getCost();