World configuration information. More...
#include <World.h>
Public Member Functions | |
void | addItem (const Item &item) |
Item adder. | |
void | addRoom (const Room &room) |
Room adder. | |
void | findClosestSurface (const geometry::Position &position, size_t &room_index, size_t &surface_index) const |
Closest Surface finder. | |
const Item & | findItem (const std::string &name) const |
Item finder (immutable). | |
Item & | findItem (const std::string &name) |
Item finder. | |
bool | findPlacementSurface (const geometry::Position &position, size_t &room_index, size_t &surface_index, size_t &placement_surface_index) const |
PlacementSurface finder. | |
const Room & | findRoom (const std::string &name) const |
Room finder (immutable). | |
Room & | findRoom (const std::string &name) |
Room finder. | |
const std::string & | getFixedFrameID () const |
Fixed frame ID accessor. | |
const Item & | getItem (const size_t index) const |
Item value accessor (immutable). | |
Item & | getItem (const size_t index) |
Item value accessor. | |
const std::vector< Item > & | getItems () const |
Items value accessor (immutable). | |
std::vector< Item > & | getItems () |
Items value accessor (immutable). | |
size_t | getNumItems () const |
Items size accessor. | |
size_t | getNumRooms () const |
Rooms size accessor. | |
const Room & | getRoom (const size_t index) const |
Room value accessor (immutable). | |
Room & | getRoom (const size_t index) |
Room value accessor. | |
const std::vector< Room > & | getRooms () const |
Rooms value accessor (immutable). | |
std::vector< Room > & | getRooms () |
Rooms value accessor. | |
bool | itemExists (const std::string &name) const |
Check for the existence of an Item. | |
bool | loadFromYaml (const std::string &file) |
Load configuration data from a YAML file. | |
void | removeItem (const size_t index) |
Item remover. | |
void | removeRoom (const size_t index) |
Room remover. | |
bool | roomExists (const std::string &name) const |
Check for the existence of a Room. | |
void | setFixedFrameID (const std::string &fixed_frame_id) |
Fixed frame ID mutator. | |
World (const std::string &fixed_frame_id="") | |
Create a new World. | |
Private Attributes | |
std::string | fixed_frame_id_ |
std::vector< Item > | items_ |
std::vector< Room > | rooms_ |
World configuration information.
A world consists of a series of rooms, surfaces, and items. Surfaces can have points of interest as well.
World::World | ( | const std::string & | fixed_frame_id = "" | ) |
void World::addItem | ( | const Item & | item | ) |
void World::addRoom | ( | const Room & | room | ) |
void World::findClosestSurface | ( | const geometry::Position & | position, |
size_t & | room_index, | ||
size_t & | surface_index | ||
) | const |
Closest Surface finder.
Find the closest surface to the given Position in the world fixed frame.
position | The Position to find the closest Surface to (in the world's fixed frame). |
room_index | Will be set to the Room index in the World. |
surface_index | Will be set to the Surface index in the Room. |
std::out_of_range | Thrown if no Rooms or Surfaces exist in the World. |
const Item& rail::spatial_temporal_learning::worldlib::world::World::findItem | ( | const std::string & | name | ) | const |
Item finder (immutable).
Find an Item with the given name. This will also check the aliases. Case is not important. If multiple items exist with the given name, the first Item is returned.
name | The name or alias of the Item to find. |
std::out_of_range | Thrown if no Item with the given name exists. |
Item& rail::spatial_temporal_learning::worldlib::world::World::findItem | ( | const std::string & | name | ) |
Item finder.
Find an Item with the given name. This will also check the aliases. Case is not important. If multiple items exist with the given name, the first Item is returned.
name | The name or alias of the Item to find. |
std::out_of_range | Thrown if no Item with the given name exists. |
bool World::findPlacementSurface | ( | const geometry::Position & | position, |
size_t & | room_index, | ||
size_t & | surface_index, | ||
size_t & | placement_surface_index | ||
) | const |
PlacementSurface finder.
Find the PlacementSurface (if any) that the Position is on. This will checking the bounding range of each Surface and find the closest PlacementSurface the Position is on. Since it is likely a Position will not be on a Placement surface (e.g., from noise or floating objects), this method returns false instead of throwing an exception.
position | The Position to find the PlacemetSurface to (in the world's fixed frame). |
room_index | Will be set to the Room index in the World. |
surface_index | Will be set to the Surface index in the Room. |
placement_surface_index | Will be set to the PlacemetSurface index in the Surface. |
const Room& rail::spatial_temporal_learning::worldlib::world::World::findRoom | ( | const std::string & | name | ) | const |
Room finder (immutable).
Find a Room with the given name. This will also check the aliases. Case is not important. If multiple rooms exist with the given name, the first Room is returned.
name | The name or alias of the Room to find. |
std::out_of_range | Thrown if no PointOfInterest with the given name exists. |
Room& rail::spatial_temporal_learning::worldlib::world::World::findRoom | ( | const std::string & | name | ) |
Room finder.
Find a Room with the given name. This will also check the aliases. Case is not important. If multiple rooms exist with the given name, the first Room is returned.
name | The name or alias of the Room to find. |
std::out_of_range | Thrown if no Room with the given name exists. |
const string & World::getFixedFrameID | ( | ) | const |
const Item & World::getItem | ( | const size_t | index | ) | const |
Item & World::getItem | ( | const size_t | index | ) |
const vector< Item > & World::getItems | ( | ) | const |
vector< Item > & World::getItems | ( | ) |
size_t World::getNumItems | ( | ) | const |
size_t World::getNumRooms | ( | ) | const |
const Room & World::getRoom | ( | const size_t | index | ) | const |
Room & World::getRoom | ( | const size_t | index | ) |
const vector< Room > & World::getRooms | ( | ) | const |
vector< Room > & World::getRooms | ( | ) |
bool World::itemExists | ( | const std::string & | name | ) | const |
bool World::loadFromYaml | ( | const std::string & | file | ) |
Load configuration data from a YAML file.
Load world configuration information from the given YAML file. This will attempt to load Pose data from a TF client and thus should only be run on a live system.
file | The name of the YAML file to load. |
void World::removeItem | ( | const size_t | index | ) |
void World::removeRoom | ( | const size_t | index | ) |
bool World::roomExists | ( | const std::string & | name | ) | const |
void World::setFixedFrameID | ( | const std::string & | fixed_frame_id | ) |
std::string rail::spatial_temporal_learning::worldlib::world::World::fixed_frame_id_ [private] |
std::vector<Item> rail::spatial_temporal_learning::worldlib::world::World::items_ [private] |
std::vector<Room> rail::spatial_temporal_learning::worldlib::world::World::rooms_ [private] |