Main Page
Namespaces
Classes
Files
File List
File Members
include
jsk_footstep_planner
grid_state.h
Go to the documentation of this file.
1
#ifndef JSK_FOOTSTEP_PLANNER_GRID_STATE_H_
2
#define JSK_FOOTSTEP_PLANNER_GRID_STATE_H_
3
4
namespace
jsk_footstep_planner
{
5
class
GridState
6
{
7
public
:
8
typedef
boost::shared_ptr<GridState>
Ptr
;
9
GridState
(
int
x,
int
y) :
index_x_
(x),
index_y_
(y)
10
{
11
}
12
inline
virtual
int
indexX
() {
return
index_x_
; }
13
inline
virtual
int
indexY
() {
return
index_y_
; }
14
15
inline
virtual
int
getOccupancy
() {
return
0; }
16
inline
virtual
bool
setOccupancy
(
int
occ_) {
return
false
; }
17
inline
virtual
float
getCost
() {
return
0.0; }
18
inline
virtual
bool
setCost
(
float
c_) {
return
false
; }
19
inline
virtual
bool
isValid
() {
return
true
; }
20
// for boost unordered_map
21
bool
operator==
(
const
GridState
& other)
const
22
{
23
return
((
index_x_
== other.
index_x_
) &&
24
(
index_y_
== other.
index_y_
));
25
}
26
protected
:
27
int
index_x_
;
28
int
index_y_
;
29
};
30
31
class
OccupancyGridState
:
public
GridState
32
{
33
public
:
34
typedef
boost::shared_ptr<OccupancyGridState>
Ptr
;
35
36
OccupancyGridState
(
int
x,
int
y) :
GridState
(x, y), occupancy_(0)
37
{
38
}
39
40
inline
virtual
int
getOccupancy
() {
return
occupancy_; }
41
inline
virtual
bool
setOccupancy
(
int
occ_)
42
{
43
occupancy_ = occ_;
44
return
true
;
45
}
46
inline
virtual
bool
isValid
()
47
{
48
if
(occupancy_ == 0) {
49
return
true
;
50
}
51
return
false
;
52
}
53
protected
:
54
int
occupancy_
;
55
};
56
57
class
CostedGridState
:
public
OccupancyGridState
58
{
59
public
:
60
typedef
boost::shared_ptr<CostedGridState>
Ptr
;
61
62
CostedGridState
(
int
x,
int
y) :
OccupancyGridState
(x, y), cost_(0.0)
63
{
64
}
65
66
inline
virtual
float
getCost
()
67
{
68
return
cost_;
69
}
70
inline
virtual
bool
setCost
(
float
c_)
71
{
72
cost_ = c_;
73
return
true
;
74
}
75
inline
virtual
bool
isValid
() {
76
// TODO update for using cost
77
if
(occupancy_ == 0) {
78
return
true
;
79
}
80
return
false
;
81
}
82
protected
:
83
float
cost_
;
84
};
85
86
// for boost unordered_map
87
inline
size_t
hash_value
(
const
GridState::Ptr
&
s
)
88
{
89
return
(std::abs(s->indexX() + 32000) << 16) + std::abs(s->indexY() + 32000);
90
}
91
}
92
#endif
jsk_footstep_planner::GridState::getOccupancy
virtual int getOccupancy()
Definition:
grid_state.h:15
jsk_footstep_planner::GridState::index_y_
int index_y_
Definition:
grid_state.h:28
jsk_footstep_planner::CostedGridState::setCost
virtual bool setCost(float c_)
Definition:
grid_state.h:70
jsk_footstep_planner::GridState::indexY
virtual int indexY()
Definition:
grid_state.h:13
jsk_footstep_planner::CostedGridState::getCost
virtual float getCost()
Definition:
grid_state.h:66
jsk_footstep_planner::GridState::indexX
virtual int indexX()
Definition:
grid_state.h:12
jsk_footstep_planner::OccupancyGridState::OccupancyGridState
OccupancyGridState(int x, int y)
Definition:
grid_state.h:36
jsk_footstep_planner::CostedGridState::cost_
float cost_
Definition:
grid_state.h:83
jsk_footstep_planner::OccupancyGridState::getOccupancy
virtual int getOccupancy()
Definition:
grid_state.h:40
jsk_footstep_planner::GridState::Ptr
boost::shared_ptr< GridState > Ptr
Definition:
grid_state.h:8
jsk_footstep_planner::GridState::setOccupancy
virtual bool setOccupancy(int occ_)
Definition:
grid_state.h:16
jsk_footstep_planner::GridState::GridState
GridState(int x, int y)
Definition:
grid_state.h:9
jsk_footstep_planner::OccupancyGridState
Definition:
grid_state.h:31
jsk_footstep_planner::OccupancyGridState::isValid
virtual bool isValid()
Definition:
grid_state.h:46
jsk_footstep_planner::OccupancyGridState::setOccupancy
virtual bool setOccupancy(int occ_)
Definition:
grid_state.h:41
jsk_footstep_planner
Definition:
ann_grid.h:50
jsk_footstep_planner::CostedGridState::isValid
virtual bool isValid()
Definition:
grid_state.h:75
boost::shared_ptr
jsk_footstep_planner::GridState
Definition:
grid_state.h:5
jsk_footstep_planner::GridState::index_x_
int index_x_
Definition:
grid_state.h:27
jsk_footstep_planner::GridState::operator==
bool operator==(const GridState &other) const
Definition:
grid_state.h:21
jsk_footstep_planner::OccupancyGridState::Ptr
boost::shared_ptr< OccupancyGridState > Ptr
Definition:
grid_state.h:34
jsk_footstep_planner::GridState::getCost
virtual float getCost()
Definition:
grid_state.h:17
pose_array.s
s
Definition:
pose_array.py:22
jsk_footstep_planner::CostedGridState::CostedGridState
CostedGridState(int x, int y)
Definition:
grid_state.h:62
jsk_footstep_planner::CostedGridState::Ptr
boost::shared_ptr< CostedGridState > Ptr
Definition:
grid_state.h:60
jsk_footstep_planner::GridState::setCost
virtual bool setCost(float c_)
Definition:
grid_state.h:18
jsk_footstep_planner::OccupancyGridState::occupancy_
int occupancy_
Definition:
grid_state.h:54
jsk_footstep_planner::CostedGridState
Definition:
grid_state.h:57
jsk_footstep_planner::GridState::isValid
virtual bool isValid()
Definition:
grid_state.h:19
jsk_footstep_planner::hash_value
size_t hash_value(const FootstepState::Ptr &s)
Definition:
footstep_state.h:254
jsk_footstep_planner
Author(s): Ryohei Ueda
autogenerated on Fri May 14 2021 02:51:52