#include <costmap.h>
Public Member Functions | |
virtual bool | canTrackChanges () |
Flag to indicate whether this costmap is able to track how much has changed. | |
virtual UIntBounds | getChangeBounds (const std::string &ns) |
If canTrackChanges, get the bounding box for how much of the costmap has changed. | |
unsigned char | getCost (const unsigned int x, const unsigned int y) |
unsigned char | getCost (const nav_grid::Index &index) |
virtual mutex_t * | getMutex ()=0 |
Accessor for boost mutex. | |
virtual void | initialize (const ros::NodeHandle &parent, const std::string &name, TFListenerPtr tf) |
Initialization function for the Costmap. | |
void | setCost (const unsigned int x, const unsigned int y, const unsigned char cost) |
void | setCost (const nav_grid::Index &index, const unsigned char cost) |
virtual void | update () |
Update the values in the costmap. | |
virtual | ~Costmap () |
Virtual Destructor. | |
Static Public Attributes | |
static const unsigned char | FREE_SPACE = 0 |
static const unsigned char | INSCRIBED_INFLATED_OBSTACLE = 253 |
static const unsigned char | LETHAL_OBSTACLE = 254 |
static const unsigned char | NO_INFORMATION = 255 |
virtual nav_core2::Costmap::~Costmap | ( | ) | [inline, virtual] |
virtual bool nav_core2::Costmap::canTrackChanges | ( | ) | [inline, virtual] |
virtual UIntBounds nav_core2::Costmap::getChangeBounds | ( | const std::string & | ns | ) | [inline, virtual] |
If canTrackChanges, get the bounding box for how much of the costmap has changed.
Rather than querying based on time stamps (which can require an arbitrary amount of storage) we instead query based on a namespace. The return bounding box reports how much of the costmap has changed since the last time this method was called with a particular namespace. If a namespace is new, then it returns a bounding box for the whole costmap. The max values are inclusive.
Example Sequence with a 5x5 costmap: (results listed (min_x,min_y):(max_x, max_y)) 0) getChangeBounds("A") --> (0,0):(4,4) 1) getChangeBounds("B") --> (0,0):(4,4) 2) update cell 1, 1 3) getChangeBounds("C") --> (0,0):(4,4) 4) getChangeBounds("A") --> (1,1):(1,1) 5) getChangeBounds("A") --> (empty bounds) (i.e. nothing was updated since last call) 6) updateCell 2, 4 7) getChangeBounds("A") --> (2,4):(2,4) 8) getChangeBounds("B") --> (1,1):(2,4)
ns | The namespace |
std::runtime_error | If canTrackChanges is false, the returned bounds would be meaningless |
unsigned char nav_core2::Costmap::getCost | ( | const unsigned int | x, |
const unsigned int | y | ||
) | [inline] |
unsigned char nav_core2::Costmap::getCost | ( | const nav_grid::Index & | index | ) | [inline] |
virtual mutex_t* nav_core2::Costmap::getMutex | ( | ) | [pure virtual] |
Accessor for boost mutex.
Implemented in nav_core2::BasicCostmap.
virtual void nav_core2::Costmap::initialize | ( | const ros::NodeHandle & | parent, |
const std::string & | name, | ||
TFListenerPtr | tf | ||
) | [inline, virtual] |
Initialization function for the Costmap.
ROS parameters/topics are expected to be in the parent/name namespace. It is suggested that all NodeHandles in the costmap use the parent NodeHandle's callback queue.
parent | NodeHandle to derive other NodeHandles from |
name | The namespace for the costmap |
tf | A pointer to a transform listener |
void nav_core2::Costmap::setCost | ( | const unsigned int | x, |
const unsigned int | y, | ||
const unsigned char | cost | ||
) | [inline] |
void nav_core2::Costmap::setCost | ( | const nav_grid::Index & | index, |
const unsigned char | cost | ||
) | [inline] |
virtual void nav_core2::Costmap::update | ( | ) | [inline, virtual] |
Update the values in the costmap.
Note that this method can throw CostmapExceptions to indicate problems, like when it would be unsafe to navigate. e.g. If the costmap expects laser data at a given rate, but laser data hasn't shown up in a while, this method might throw a CostmapDataLagException.
const unsigned char nav_core2::Costmap::FREE_SPACE = 0 [static] |
const unsigned char nav_core2::Costmap::INSCRIBED_INFLATED_OBSTACLE = 253 [static] |
const unsigned char nav_core2::Costmap::LETHAL_OBSTACLE = 254 [static] |
const unsigned char nav_core2::Costmap::NO_INFORMATION = 255 [static] |