#include <Facade.hpp>
Inheritance diagram for estar::Facade:
Hides the semantics for accessing the underlying Algorithm, Grid, Kernel, and associated objects. The Facade is specialized for grid-based environment representations.
The recommended way to create and initialize a new Facade is to use one of the factory methods Create() or CreateDefault(). You can also allocate and initialize separate Algorithm, Grid, and Kernel objects and wrap a Facade around them.
Public Types | |
typedef FacadeReadInterface::node_status_t | node_status_t |
| |
Public Member Functions | |
Facade (boost::shared_ptr< Algorithm > algo, boost::shared_ptr< Grid > grid, boost::shared_ptr< Kernel > kernel) | |
Create a Facade from existing instances of Algorithm, Grid, and Kernel. | |
virtual double | GetScale () const |
Implements FacadeReadInterface::GetScale(). | |
virtual double | GetFreespaceMeta () const |
Implements FacadeReadInterface::GetFreespaceMeta(). | |
virtual double | GetObstacleMeta () const |
Implements FacadeReadInterface::GetObstacleMeta(). | |
virtual double | GetValue (ssize_t ix, ssize_t iy) const |
Implements FacadeReadInterface::GetValue(). | |
virtual double | GetMeta (ssize_t ix, ssize_t iy) const |
Implements FacadeReadInterface::GetMeta(). | |
virtual bool | SetMeta (ssize_t ix, ssize_t iy, double meta) |
Implements FacadeWriteInterface::SetMeta(). | |
virtual bool | AddGoal (ssize_t ix, ssize_t iy, double value) |
Implements FacadeWriteInterface::AddGoal(). | |
void | AddGoal (const Region &goal) |
An alternative to AddGoal(ssize_t, ssize_t, double) which ignores obstacles [vertices with meta equal to GetObstacleMeta()] and doesn't tell us if it encountered any invalid indices. | |
void | RemoveGoal (ssize_t ix, ssize_t iy) |
Revert a goal cell to normal status. | |
void | RemoveGoal (const Region &goal) |
Revert all cells in a goal region to normal status. | |
virtual void | RemoveAllGoals () |
Implements FacadeWriteInterface::RemoveAllGoals(). | |
virtual bool | IsGoal (ssize_t ix, ssize_t iy) const |
Implements FacadeReadInterface::IsGoal(). | |
virtual bool | HaveWork () const |
Implements FacadeReadInterface::HaveWork(). | |
virtual void | ComputeOne () |
Implements FacadeWriteInterface::ComputeOne(). | |
virtual void | Reset () |
Implements FacadeWriteInterface::Reset(). | |
virtual node_status_t | GetStatus (ssize_t ix, ssize_t iy) const |
Implements FacadeReadInterface::GetStatus(). | |
virtual node_status_t | GetStatus (vertex_t vertex) const |
Implements FacadeReadInterface::GetStatus(). | |
virtual bool | IsValidIndex (ssize_t ix, ssize_t iy) const |
Implements FacadeReadInterface::IsValidIndex(). | |
virtual bool | GetLowestInconsistentValue (double &value) const |
Implements FacadeReadInterface::GetLowestInconsistentValue(). | |
void | DumpGrid (FILE *stream) const |
Write the underlying grid to a stream. | |
void | DumpQueue (FILE *stream, size_t limit) const |
Write the contents of the wavefront Queue to a stream. | |
void | DumpPointers (FILE *stream) const |
Write the addresses of the Algorithm, Grid, and Kernel instances. | |
virtual const Algorithm & | GetAlgorithm () const |
Implements FacadeReadInterface::GetAlgorithm(). | |
virtual const Kernel & | GetKernel () const |
Implements FacadeReadInterface::GetKernel(). | |
virtual int | TraceCarrot (double robot_x, double robot_y, double distance, double stepsize, size_t maxsteps, carrot_trace &trace) const |
Implements FacadeReadInterface::TraceCarrot(). | |
virtual boost::shared_ptr< GridCSpace const > | GetCSpace () const |
Implements FacadeReadInterface::GetCSpace(). | |
Algorithm & | GetAlgorithm () |
| |
Kernel & | GetKernel () |
| |
Static Public Member Functions | |
static Facade * | Create (const std::string &kernel_name, double scale, GridOptions const &grid_options, AlgorithmOptions const &algo_options, FILE *dbgstream) |
Create a Facade and make it ready to be used. | |
static Facade * | CreateDefault (ssize_t xsize, ssize_t ysize, double scale) |
Like Create(), but doesn't give you a choice of Kernel (it's always LSMKernel) or of diagonally connected cells (that's always disabled). | |
Public Attributes | |
const double | scale |
edge length of square cells in the grid | |
Protected Member Functions | |
virtual boost::shared_ptr< Grid const > | GetGrid () const |
| |
Private Member Functions | |
node_status_t | DoGetStatus (ssize_t ix, ssize_t iy, vertex_t vertex) const |
Private Attributes | |
boost::shared_ptr< GridCSpace const > | m_cspace |
boost::shared_ptr< Algorithm > | m_algo |
boost::shared_ptr< Grid > | m_grid |
boost::shared_ptr< Kernel > | m_kernel |
Friends | |
class | pnf::Flow |
Reimplemented from estar::FacadeReadInterface.
Facade * estar::Facade::Create | ( | const std::string & | kernel_name, | |
double | scale, | |||
GridOptions const & | grid_options, | |||
AlgorithmOptions const & | algo_options, | |||
FILE * | dbgstream | |||
) | [static] |
Create a Facade and make it ready to be used.
Most people can call CreateDefault() instead. Typically, the first things you will do with a freshly created Facade are:
These steps interweave quite easily with updates to the traversability information, because SetMeta() will create appropriate entries on the wavefront Queue. However, when multi-threading you have to create your own mutexes and such (for an example, see the asl-mcontrol code that is provided with the estar-devkit project, available from http://estar.sourceforge.net/).
kernel_name | Name of the Kernel subclass to use. Currently accepts "nf1" for NF1Kernel, "alpha" for AlphaKernel, and "lsm" for LSMKernel. The latter is preferred. |
dbgstream | If non-null, error messages are written to this stream. This currently only happens when you specify an invalid kernel_name. |
Like Create(), but doesn't give you a choice of Kernel (it's always LSMKernel) or of diagonally connected cells (that's always disabled).
It uses the default AlgorithmOptions ctor.
virtual double estar::Facade::GetScale | ( | ) | const [inline, virtual] |
double estar::Facade::GetFreespaceMeta | ( | ) | const [virtual] |
double estar::Facade::GetObstacleMeta | ( | ) | const [virtual] |
Implements FacadeReadInterface::GetMeta().
See also Algorithm::SetMeta() for more details.
Implements estar::FacadeReadInterface.
Implements FacadeWriteInterface::SetMeta().
See also Algorithm::SetMeta() for more details.
Implements estar::FacadeWriteInterface.
Implements FacadeWriteInterface::AddGoal().
Implements estar::FacadeWriteInterface.
void estar::Facade::AddGoal | ( | const Region & | goal | ) |
An alternative to AddGoal(ssize_t, ssize_t, double) which ignores obstacles [vertices with meta equal to GetObstacleMeta()] and doesn't tell us if it encountered any invalid indices.
Revert a goal cell to normal status.
Unless the cell happens to be non-goal before calling this method, this sets a flag which causes the next call to ComputeOne() to reinitialize the navigation function and wavefront.
void estar::Facade::RemoveGoal | ( | const Region & | goal | ) |
Revert all cells in a goal region to normal status.
Basically just calls RemoveGoal(ssize_t, ssize_t) for all the cells in the region.
void estar::Facade::RemoveAllGoals | ( | ) | [virtual] |
bool estar::Facade::HaveWork | ( | ) | const [virtual] |
void estar::Facade::ComputeOne | ( | ) | [virtual] |
void estar::Facade::Reset | ( | ) | [virtual] |
Facade::node_status_t estar::Facade::GetStatus | ( | ssize_t | ix, | |
ssize_t | iy | |||
) | const [virtual] |
Facade::node_status_t estar::Facade::GetStatus | ( | vertex_t | vertex | ) | const [virtual] |
bool estar::Facade::GetLowestInconsistentValue | ( | double & | value | ) | const [virtual] |
Implements FacadeReadInterface::GetLowestInconsistentValue().
Implements estar::FacadeReadInterface.
void estar::Facade::DumpGrid | ( | FILE * | stream | ) | const |
Write the underlying grid to a stream.
Actually just calls dump_grid() in dump.hpp, so if you want finer control have a look at what else is offered there.
void estar::Facade::DumpQueue | ( | FILE * | stream, | |
size_t | limit | |||
) | const |
Write the contents of the wavefront Queue to a stream.
Actually just calls dump_queue() in dump.hpp, look there for more options.
limit | if >0 then output stops after that number of entries (the queue can get really long even in medium-sized grids) |
void estar::Facade::DumpPointers | ( | FILE * | stream | ) | const |
virtual const Algorithm& estar::Facade::GetAlgorithm | ( | ) | const [inline, virtual] |
shared_ptr< Grid const > estar::Facade::GetGrid | ( | ) | const [protected, virtual] |
virtual const Kernel& estar::Facade::GetKernel | ( | ) | const [inline, virtual] |
int estar::Facade::TraceCarrot | ( | double | robot_x, | |
double | robot_y, | |||
double | distance, | |||
double | stepsize, | |||
size_t | maxsteps, | |||
carrot_trace & | trace | |||
) | const [virtual] |
shared_ptr< GridCSpace const > estar::Facade::GetCSpace | ( | ) | const [virtual] |
Algorithm& estar::Facade::GetAlgorithm | ( | ) | [inline] |
Kernel& estar::Facade::GetKernel | ( | ) | [inline] |
node_status_t estar::Facade::DoGetStatus | ( | ssize_t | ix, | |
ssize_t | iy, | |||
vertex_t | vertex | |||
) | const [private] |
friend class pnf::Flow [friend] |
const double estar::Facade::scale |
edge length of square cells in the grid
boost::shared_ptr<GridCSpace const> estar::Facade::m_cspace [private] |
boost::shared_ptr<Algorithm> estar::Facade::m_algo [private] |
boost::shared_ptr<Grid> estar::Facade::m_grid [private] |
boost::shared_ptr<Kernel> estar::Facade::m_kernel [private] |