Main Page
Namespaces
Classes
Files
File List
File Members
src
PlanningState.cpp
Go to the documentation of this file.
1
/*
2
* A footstep planner for humanoid robots
3
*
4
* Copyright 2010-2011 Johannes Garimort, Armin Hornung, University of Freiburg
5
* http://www.ros.org/wiki/footstep_planner
6
*
7
* D* Lite (Koenig et al. 2002) partly based on the implementation
8
* by J. Neufeld (http://code.google.com/p/dstarlite/)
9
*
10
*
11
* This program is free software: you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation, version 3.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the GNU General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
#include <
footstep_planner/PlanningState.h
>
25
26
27
namespace
footstep_planner
28
{
29
PlanningState::PlanningState
(
double
x,
double
y,
double
theta
,
Leg
leg,
30
double
cell_size,
int
num_angle_bins,
31
int
max_hash_size)
32
: ivX(
state_2_cell
(x, cell_size)),
33
ivY(
state_2_cell
(y, cell_size)),
34
ivTheta(
angle_state_2_cell
(theta, num_angle_bins)),
35
ivLeg(leg),
36
ivId(-1),
37
ivHashTag(
calc_hash_tag
(ivX, ivY, ivTheta, ivLeg, max_hash_size))
38
{}
39
40
41
PlanningState::PlanningState
(
int
x,
int
y,
int
theta
,
Leg
leg,
42
int
max_hash_size)
43
:
ivX
(x),
44
ivY
(y),
45
ivTheta
(theta),
46
ivLeg
(leg),
47
ivId
(-1),
48
ivHashTag
(
calc_hash_tag
(
ivX
,
ivY
,
ivTheta
,
ivLeg
, max_hash_size))
49
{}
50
51
52
PlanningState::PlanningState
(
const
State
& s,
double
cell_size,
53
int
num_angle_bins,
int
max_hash_size)
54
:
ivX
(
state_2_cell
(s.
getX
(), cell_size)),
55
ivY
(
state_2_cell
(s.
getY
(), cell_size)),
56
ivTheta
(
angle_state_2_cell
(s.
getTheta
(), num_angle_bins)),
57
ivLeg
(s.
getLeg
()),
58
ivId
(-1),
59
ivHashTag
(
calc_hash_tag
(
ivX
,
ivY
,
ivTheta
,
ivLeg
, max_hash_size))
60
{}
61
62
63
PlanningState::PlanningState
(
const
PlanningState
& s)
64
:
ivX
(s.
getX
()),
65
ivY
(s.
getY
()),
66
ivTheta
(s.
getTheta
()),
67
ivLeg
(s.
getLeg
()),
68
ivId
(s.
getId
()),
69
ivHashTag
(s.
getHashTag
())
70
{}
71
72
73
PlanningState::~PlanningState
()
74
{}
75
76
77
bool
78
PlanningState::operator ==
(
const
PlanningState
& s2)
79
const
80
{
81
// First test the hash tag. If they differ, the states are definitely
82
// different.
83
if
(
ivHashTag
!= s2.
getHashTag
())
84
return
false
;
85
86
return
(
ivX
== s2.
getX
() &&
ivY
== s2.
getY
() &&
87
ivTheta
== s2.
getTheta
() &&
ivLeg
== s2.
getLeg
());
88
}
89
90
91
bool
92
PlanningState::operator !=
(
const
PlanningState
& s2)
93
const
94
{
95
return
ivHashTag
!= s2.
getHashTag
();
96
}
97
98
99
State
100
PlanningState::getState
(
double
cell_size,
int
num_angle_bins)
101
const
102
{
103
return
State
(
cell_2_state
(
ivX
, cell_size),
104
cell_2_state
(
ivY
, cell_size),
105
angles::normalize_angle
(
106
angle_cell_2_state
(
ivTheta
, num_angle_bins)),
107
ivLeg
);
108
}
109
}
// end of namespace
footstep_planner::Leg
Leg
Definition:
helper.h:41
footstep_planner::cell_2_state
double cell_2_state(int value, double cell_size)
Calculate the respective (continuous) state value for a cell. (Should be used to get a State from a d...
Definition:
helper.h:122
footstep_planner::PlanningState::getTheta
int getTheta() const
Definition:
PlanningState.h:97
footstep_planner::PlanningState::getState
State getState(double cell_size, int num_angle_bins) const
Computes the continuous State the PlanningState represents.
Definition:
PlanningState.cpp:100
footstep_planner::PlanningState::operator!=
bool operator!=(const PlanningState &s2) const
Compare two states on inequality of x, y, theta, leg by comparing the hash tags of the states...
Definition:
PlanningState.cpp:92
footstep_planner::State
A class representing the robot's pose (i.e. position and orientation) in the (continuous) world view...
Definition:
State.h:34
footstep_planner::PlanningState::PlanningState
PlanningState(double x, double y, double theta, Leg leg, double cell_size, int num_angle_bins, int max_hash_size)
x, y and theta represent the global (continuous) position and orientation of the robot's support leg...
Definition:
PlanningState.cpp:29
footstep_planner::PlanningState::getY
int getY() const
Definition:
PlanningState.h:99
footstep_planner::PlanningState::ivHashTag
unsigned int ivHashTag
Definition:
PlanningState.h:133
footstep_planner::PlanningState::getLeg
Leg getLeg() const
Definition:
PlanningState.h:96
footstep_planner::angle_cell_2_state
double angle_cell_2_state(int angle, int angle_bin_num)
Calculate the respective (continuous) angle for a bin.
Definition:
helper.h:101
footstep_planner::PlanningState::getX
int getX() const
Definition:
PlanningState.h:98
plan_footsteps.theta
theta
Definition:
plan_footsteps.py:38
angles::normalize_angle
def normalize_angle(angle)
footstep_planner::PlanningState::ivX
int ivX
Value of the grid cell the position's x value is fitted into.
Definition:
PlanningState.h:118
PlanningState.h
footstep_planner::PlanningState::ivLeg
Leg ivLeg
The supporting leg.
Definition:
PlanningState.h:124
footstep_planner::PlanningState::ivTheta
int ivTheta
Number of the bin the orientation is fitted into.
Definition:
PlanningState.h:122
footstep_planner::PlanningState::ivY
int ivY
Value of the grid cell the position's y value is fitted into.
Definition:
PlanningState.h:120
footstep_planner::state_2_cell
int state_2_cell(float value, float cell_size)
Discretize a (continuous) state value into a cell. (Should be used to discretize a State to a Plannin...
Definition:
helper.h:112
footstep_planner::angle_state_2_cell
int angle_state_2_cell(double angle, int angle_bin_num)
Discretize a (continuous) angle into a bin.
Definition:
helper.h:92
footstep_planner::PlanningState::~PlanningState
~PlanningState()
Definition:
PlanningState.cpp:73
footstep_planner::PlanningState::ivId
int ivId
The (unique) ID of the planning state.
Definition:
PlanningState.h:127
footstep_planner::PlanningState::getId
int getId() const
Definition:
PlanningState.h:111
footstep_planner::PlanningState::getHashTag
unsigned int getHashTag() const
Definition:
PlanningState.h:105
footstep_planner::calc_hash_tag
unsigned int calc_hash_tag(int x, int y, int theta, int leg, int max_hash_size)
Definition:
helper.h:166
footstep_planner::PlanningState
A class representing the robot's pose (i.e. position and orientation) in the underlying SBPL...
Definition:
PlanningState.h:45
footstep_planner::PlanningState::operator==
bool operator==(const PlanningState &s2) const
Compare two states on equality of x, y, theta, leg. Makes first use of the non-unique hash tag to rul...
Definition:
PlanningState.cpp:78
footstep_planner
Definition:
Footstep.h:28
footstep_planner
Author(s): Johannes Garimort, Armin Hornung
autogenerated on Mon Jun 10 2019 13:38:24