GAMS  1.4.0
gams::variables::Sensor Class Reference

A container for sensor information. More...

#include <Sensor.h>

Public Member Functions

 Sensor ()
 Constructor. More...
 
 Sensor (const std::string &name, madara::knowledge::KnowledgeBase *knowledge, const double &range=0.0, const pose::Position &origin=pose::Position(pose::gps_frame(), DBL_MAX, DBL_MAX))
 Constructor. More...
 
 ~Sensor ()
 Destructor. More...
 
set< pose::Positiondiscretize (const pose::Region &region)
 Discretize a search area into index positions inside search area. More...
 
set< pose::Positiondiscretize (const pose::SearchArea &area)
 Discretize a search area into index positions inside search area. More...
 
double get_discretization () const
 Get the length of the side of each discretized cell. More...
 
pose::Position get_gps_from_index (const pose::Position &index)
 Gets GPS position from index position. More...
 
pose::Position get_index_from_gps (const pose::Position &pos)
 Gets current location on sensor map. More...
 
std::string get_name () const
 Gets name. More...
 
pose::Position get_origin ()
 Gets origin. More...
 
double get_range () const
 Gets range in meters. More...
 
double get_value (const pose::Position &pos)
 Gets value at location. More...
 
void init_vars (const std::string &name, madara::knowledge::KnowledgeBase *knowledge, const double &range=0.0, const pose::Position &origin=pose::Position(pose::gps_frame(), DBL_MAX, DBL_MAX))
 Initializes the variables. More...
 
void operator= (const Sensor &rhs)
 Assignment operator. More...
 
void set_origin (const pose::Position &origin)
 Sets origin. More...
 
void set_range (const double &range)
 Sets range in meters. More...
 
void set_value (const pose::Position &pos, const double &val, const madara::knowledge::KnowledgeUpdateSettings &settings=madara::knowledge::KnowledgeUpdateSettings())
 Sets value at a point with position. More...
 

Protected Member Functions

std::string index_pos_to_index (const pose::Position &pos) const
 Convert index position to string index. More...
 
void init_vars ()
 Initialize madara containers. More...
 
void regenerate_local_frame (void)
 

Protected Attributes

madara::knowledge::KnowledgeBase * knowledge_
 knowledge base More...
 
pose::ReferenceFrame local_frame_
 local cartesian frame More...
 
std::string name_
 name of the sensor More...
 
madara::knowledge::containers::NativeDoubleArray origin_
 origin for index calculations More...
 
madara::knowledge::containers::Double range_
 the range of the sensor, determines discretization More...
 
madara::knowledge::containers::Map value_
 the map of locations to sensor value More...
 

Detailed Description

A container for sensor information.

Definition at line 80 of file Sensor.h.

Constructor & Destructor Documentation

◆ Sensor() [1/2]

gams::variables::Sensor::Sensor ( )

Constructor.

◆ Sensor() [2/2]

gams::variables::Sensor::Sensor ( const std::string &  name,
madara::knowledge::KnowledgeBase *  knowledge,
const double &  range = 0.0,
const pose::Position origin = pose::Position(pose::gps_frame(), DBL_MAX, DBL_MAX) 
)

Constructor.

◆ ~Sensor()

gams::variables::Sensor::~Sensor ( )

Destructor.

Member Function Documentation

◆ discretize() [1/2]

set<pose::Position> gams::variables::Sensor::discretize ( const pose::Region region)

Discretize a search area into index positions inside search area.

Parameters
regionregion to discretize
Returns
set of index positions considered inside search area

◆ discretize() [2/2]

set<pose::Position> gams::variables::Sensor::discretize ( const pose::SearchArea area)

Discretize a search area into index positions inside search area.

Parameters
areaarea to discretize
Returns
set of index positions considered inside search area

◆ get_discretization()

double gams::variables::Sensor::get_discretization ( ) const

Get the length of the side of each discretized cell.

Returns
discretization value

◆ get_gps_from_index()

pose::Position gams::variables::Sensor::get_gps_from_index ( const pose::Position index)

Gets GPS position from index position.

Parameters
indexindex location in cartesian location on sensor map
Returns
GPSPosition of index position

◆ get_index_from_gps()

pose::Position gams::variables::Sensor::get_index_from_gps ( const pose::Position pos)

Gets current location on sensor map.

Parameters
poscurrent GPS location
Returns
current location in cartesian location on sensor map

◆ get_name()

std::string gams::variables::Sensor::get_name ( ) const

Gets name.

Returns
name of sensor

◆ get_origin()

pose::Position gams::variables::Sensor::get_origin ( )

Gets origin.

Returns
GPS origin

◆ get_range()

double gams::variables::Sensor::get_range ( ) const

Gets range in meters.

Returns
sensor range

◆ get_value()

double gams::variables::Sensor::get_value ( const pose::Position pos)

Gets value at location.

Parameters
posposition to get
Returns
sensor value at pos

◆ index_pos_to_index()

std::string gams::variables::Sensor::index_pos_to_index ( const pose::Position pos) const
protected

Convert index position to string index.

Parameters
posgps position
Returns
string index into map

◆ init_vars() [1/2]

void gams::variables::Sensor::init_vars ( )
protected

Initialize madara containers.

◆ init_vars() [2/2]

void gams::variables::Sensor::init_vars ( const std::string &  name,
madara::knowledge::KnowledgeBase *  knowledge,
const double &  range = 0.0,
const pose::Position origin = pose::Position(pose::gps_frame(), DBL_MAX, DBL_MAX) 
)

Initializes the variables.

Parameters
namename of the sensor
knowledgethe knowledge base
rangethe range
originthe GPS origin

◆ operator=()

void gams::variables::Sensor::operator= ( const Sensor rhs)

Assignment operator.

Parameters
rhsvalues to copy

◆ regenerate_local_frame()

void gams::variables::Sensor::regenerate_local_frame ( void  )
protected

◆ set_origin()

void gams::variables::Sensor::set_origin ( const pose::Position origin)

Sets origin.

Parameters
originnew origin

◆ set_range()

void gams::variables::Sensor::set_range ( const double &  range)

Sets range in meters.

Parameters
rangenew range

◆ set_value()

void gams::variables::Sensor::set_value ( const pose::Position pos,
const double &  val,
const madara::knowledge::KnowledgeUpdateSettings &  settings = madara::knowledge::KnowledgeUpdateSettings() 
)

Sets value at a point with position.

Parameters
posposition to set
valvalue to set at position
settingssettings to use for mutating value

Member Data Documentation

◆ knowledge_

madara::knowledge::KnowledgeBase* gams::variables::Sensor::knowledge_
protected

knowledge base

Definition at line 222 of file Sensor.h.

◆ local_frame_

pose::ReferenceFrame gams::variables::Sensor::local_frame_
protected

local cartesian frame

Definition at line 234 of file Sensor.h.

◆ name_

std::string gams::variables::Sensor::name_
protected

name of the sensor

Definition at line 228 of file Sensor.h.

◆ origin_

madara::knowledge::containers::NativeDoubleArray gams::variables::Sensor::origin_
protected

origin for index calculations

Definition at line 231 of file Sensor.h.

◆ range_

madara::knowledge::containers::Double gams::variables::Sensor::range_
protected

the range of the sensor, determines discretization

Definition at line 225 of file Sensor.h.

◆ value_

madara::knowledge::containers::Map gams::variables::Sensor::value_
protected

the map of locations to sensor value

Definition at line 219 of file Sensor.h.


The documentation for this class was generated from the following file: