Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
EllipsesRepresentation Class Reference

IRI ROS Specific Driver Class. More...

#include <ellipses_representation.h>

List of all members.

Public Types

typedef
iri_clean_board::CleaningPlanConfig 
Config
 define config type

Public Member Functions

std::vector
< estirabot_msgs::DirtyArea > 
calculateRosDirtyAreas (std::vector< cv::RotatedRect > ellipses)
void config_update (Config &new_cfg, uint32_t level=0)
 config update
void createNewState (cv::Mat image)
 Creates a new state from a image.
std::vector
< estirabot_msgs::PointsDistanceMsg > 
distancesBetweenEllipses (std::vector< estirabot_msgs::DirtyArea > dirty_areas)
 Gets the distane between ellipses.
void drawPoints (std::vector< cv::Point2f > img_coords)
 Draws target points.
 EllipsesRepresentation (void)
 constructor
std::vector< cv::RotatedRect > getCurrentEllipses ()
 Gets current ellipses.
cv::RotatedRect getEllipseFromRosDirtyAreas (std::vector< estirabot_msgs::DirtyArea > dirty_areas, int idx)
 Gets ellipse corresponding to index in dirty areas vector.
std::vector< double > getEllipsesAreas ()
 Gets ellipses' areas.
std::vector< double > getEllipsesMaxWidths ()
 Gets ellipses' max widths.
std::vector< double > getEllipsesMinWidths ()
 Gets ellipses min widths.
size_t getEllipsesNumber ()
 Gets ellipses' size.
std::vector
< estirabot_msgs::Ellipse > 
getEllipsesRosMsg ()
 Gets current ellipses.
std::vector< uint8_t > getEllipsesSparse ()
 Gets if ellipses are sparse.
double getEllipsesSummedAreas ()
 Gets ellipses' areas.
std::vector< size_t > getGoodPathThroughAllDirtyAreas (std::vector< estirabot_msgs::DirtyArea > dirty_areas)
std::vector< size_t > getGoodPathThroughAllEllipses (size_t init_ellipse)
 Gets a path that goes through all ellipses.
int32_t getNearestEllipse ()
 Get nearest ellipse to current position.
std::vector
< estirabot_msgs::DirtyArea > 
getRosDirtyAreas ()
 Gets ros msg dirty areas from ellipses.
std::string getStateString (const std::vector< estirabot_msgs::DirtyArea > dirty_areas)
 Get state as a string.
std::string getStateStringOrdered (const std::vector< estirabot_msgs::DirtyArea > dirty_areas)
std::vector
< estirabot_msgs::TraversedEllipses > 
getTraversedEllipses (std::vector< estirabot_msgs::DirtyArea > dirty_areas)
 Gets traversed ellipses in a movement between ellipses.
std::vector< cv::RotatedRect > loadEllipsesFromRosMsg (std::vector< estirabot_msgs::Ellipse > ellipses_msg)
 Load ellipses from ros msg.
std::vector< cv::RotatedRect > loadEllipsesFromRosMsg (std::vector< estirabot_msgs::DirtyArea > dirty_areas_msg)
void lock (void)
 Lock Algorithm.
std::vector
< estirabot_msgs::DirtyArea > 
orderDirtyAreas (const std::vector< estirabot_msgs::DirtyArea > dirty_areas, const std::vector< estirabot_msgs::DirtyArea > previous_dirty_areas)
bool pointIsBetween (cv::Point2f p1, cv::Point2f p2, cv::Point2f point)
bool pointIsBetween (iri_perception_msgs::ImagePoint new_p1, iri_perception_msgs::ImagePoint new_p2, iri_perception_msgs::ImagePoint new_point)
bool pointIsBetween (iri_perception_msgs::ImagePoint new_p1, cv::Point2f p2, iri_perception_msgs::ImagePoint new_point)
cv::RotatedRect rosEllipseToRotatedRect (estirabot_msgs::Ellipse ellipse_msg)
 Rosmsg Ellipse to Opencv RotatedRect.
estirabot_msgs::Ellipse rotatedRectToRosEllipse (cv::RotatedRect ellipse)
 Opencv RotatedRect to rosmsg Ellipse.
void truncateEllipsesNumber ()
 Truncates the number of ellipses.
bool try_enter (void)
 Tries Access to Algorithm.
void unlock (void)
 Unlock Algorithm.
void writeStateToFile (std::string path, std::vector< estirabot_msgs::DirtyArea > dirty_areas)
 Write current state to file.
 ~EllipsesRepresentation (void)
 Destructor.

Public Attributes

Config config_
 config variable
cv::Point2f currentArmPosition
 Position of the robot arm.
cv::Mat show_image
cv::Mat state_image

Protected Member Functions

void clearLastEllipses ()
 Clear data from previous stamps.
void computeBoundingEllipses (cv::Mat image)
 Separates occupied regions in ellipses.
std::string dirtyAreasDistancesToString (std::vector< estirabot_msgs::PointsDistanceMsg > distances)
std::string dirtyAreaToString (estirabot_msgs::DirtyArea dirty_area, int idx)
bool divideBigEllipse (cv::Mat image, cv::Mat ellipseMask, cv::RotatedRect currentEllipse)
 Divides a big sparse ellipse in smaller ellipses.
double getDistance (cv::Point2f p1, cv::Point2f p2)
double getDistance (iri_perception_msgs::ImagePoint p1, iri_perception_msgs::ImagePoint p2)
void setSourceImage (cv::Mat image)
 Set images used to get state and display visual info.
std::string traversedEllipsesToString (std::vector< estirabot_msgs::TraversedEllipses > traversed_ellipses)

Protected Attributes

CMutex alg_mutex_
 define config type
bool board_plan
std::vector
< estirabot_msgs::DirtyArea > 
dirtyAreas_
std::vector< double > ellipsesArea
std::vector< double > ellipsesMaxWidths
std::vector< double > ellipsesMinWidths
std::vector< uint8_t > ellipsesSparse
std::vector< cv::RotatedRect > imageEllipses
int initial_state_idx
bool is_learning
bool is_planning
uint32_t max_number_ellipses
double max_width_threshold
double medium_area_threshold
double min_width_threshold
double minAreaThreshold
double minFillThreshold
double near_distance_threshold
double small_area_threshold
uint32_t small_objects_join_distance

Static Protected Attributes

static const int IMAGE_HEIGHT = 480
static const int IMAGE_WIDTH = 640

Detailed Description

IRI ROS Specific Driver Class.

Definition at line 95 of file ellipses_representation.h.


Member Typedef Documentation

typedef iri_clean_board::CleaningPlanConfig EllipsesRepresentation::Config

define config type

Define a Config type with the CleaningPlanConfig. All driver implementations will then use the same variable type Config.

Definition at line 197 of file ellipses_representation.h.


Constructor & Destructor Documentation

constructor

In this constructor parameters related to the specific driver can be initalized. Those parameters can be also set in the openDriver() function. Attributes from the main node driver class IriBaseDriver such as loop_rate, may be also overload here.

Definition at line 7 of file ellipses_representation.cpp.

Destructor.

This destructor is called when the object is about to be destroyed.

Definition at line 14 of file ellipses_representation.cpp.


Member Function Documentation

std::vector< estirabot_msgs::DirtyArea > EllipsesRepresentation::calculateRosDirtyAreas ( std::vector< cv::RotatedRect >  ellipses)

Definition at line 565 of file ellipses_representation.cpp.

Clear data from previous stamps.

Clear vectors saving ellipses of previous perceptions

Definition at line 211 of file ellipses_representation.cpp.

void EllipsesRepresentation::computeBoundingEllipses ( cv::Mat  image) [protected]

Separates occupied regions in ellipses.

Separates occupied regions in ellipses

Definition at line 135 of file ellipses_representation.cpp.

void EllipsesRepresentation::config_update ( Config new_cfg,
uint32_t  level = 0 
)

config update

In this function the driver parameters must be updated with the input config variable. Then the new configuration state will be stored in the Config attribute.

Parameters:
new_cfgthe new driver configuration state
levellevel in which the update is taken place

Definition at line 18 of file ellipses_representation.cpp.

void EllipsesRepresentation::createNewState ( cv::Mat  image)

Creates a new state from a image.

Clears last state, sets new images, and obtains updated ellipses

Definition at line 50 of file ellipses_representation.cpp.

std::string EllipsesRepresentation::dirtyAreasDistancesToString ( std::vector< estirabot_msgs::PointsDistanceMsg >  distances) [protected]

Definition at line 665 of file ellipses_representation.cpp.

std::string EllipsesRepresentation::dirtyAreaToString ( estirabot_msgs::DirtyArea  dirty_area,
int  idx 
) [protected]

Definition at line 612 of file ellipses_representation.cpp.

std::vector< estirabot_msgs::PointsDistanceMsg > EllipsesRepresentation::distancesBetweenEllipses ( std::vector< estirabot_msgs::DirtyArea >  dirty_areas)

Gets the distane between ellipses.

Gets the distance between ellipses Information needed by PRADA Planner

Definition at line 273 of file ellipses_representation.cpp.

bool EllipsesRepresentation::divideBigEllipse ( cv::Mat  image,
cv::Mat  ellipseMask,
cv::RotatedRect  currentEllipse 
) [protected]

Divides a big sparse ellipse in smaller ellipses.

Divides a big sparse ellipse in smaller ellipses

Definition at line 72 of file ellipses_representation.cpp.

void EllipsesRepresentation::drawPoints ( std::vector< cv::Point2f >  img_coords)

Draws target points.

Draws target points Only useful for DEBUGGING

Method only for debugging

Definition at line 405 of file ellipses_representation.cpp.

Gets current ellipses.

Definition at line 385 of file ellipses_representation.h.

double EllipsesRepresentation::getDistance ( cv::Point2f  p1,
cv::Point2f  p2 
) [inline, protected]

Definition at line 141 of file ellipses_representation.h.

Definition at line 146 of file ellipses_representation.h.

cv::RotatedRect EllipsesRepresentation::getEllipseFromRosDirtyAreas ( std::vector< estirabot_msgs::DirtyArea >  dirty_areas,
int  idx 
)

Gets ellipse corresponding to index in dirty areas vector.

Gets ellipse corresponding to index idx in dirty_areas vector

Definition at line 545 of file ellipses_representation.cpp.

Gets ellipses' areas.

Definition at line 411 of file ellipses_representation.h.

Gets ellipses' max widths.

Definition at line 406 of file ellipses_representation.h.

Gets ellipses min widths.

Definition at line 401 of file ellipses_representation.h.

Gets ellipses' size.

Definition at line 438 of file ellipses_representation.h.

std::vector<estirabot_msgs::Ellipse> EllipsesRepresentation::getEllipsesRosMsg ( ) [inline]

Gets current ellipses.

Definition at line 372 of file ellipses_representation.h.

Gets if ellipses are sparse.

Definition at line 433 of file ellipses_representation.h.

Gets ellipses' areas.

Definition at line 422 of file ellipses_representation.h.

std::vector< size_t > EllipsesRepresentation::getGoodPathThroughAllDirtyAreas ( std::vector< estirabot_msgs::DirtyArea >  dirty_areas)

Definition at line 484 of file ellipses_representation.cpp.

Gets a path that goes through all ellipses.

Tries to get a small distance

Definition at line 446 of file ellipses_representation.cpp.

Get nearest ellipse to current position.

Get nearest ellipse to current position

Definition at line 386 of file ellipses_representation.cpp.

std::vector< estirabot_msgs::DirtyArea > EllipsesRepresentation::getRosDirtyAreas ( )

Gets ros msg dirty areas from ellipses.

Definition at line 560 of file ellipses_representation.cpp.

std::string EllipsesRepresentation::getStateString ( const std::vector< estirabot_msgs::DirtyArea >  dirty_areas)

Get state as a string.

Gets a string with the literals representing the states

Definition at line 702 of file ellipses_representation.cpp.

std::string EllipsesRepresentation::getStateStringOrdered ( const std::vector< estirabot_msgs::DirtyArea >  dirty_areas)

Definition at line 679 of file ellipses_representation.cpp.

std::vector< estirabot_msgs::TraversedEllipses > EllipsesRepresentation::getTraversedEllipses ( std::vector< estirabot_msgs::DirtyArea >  dirty_areas)

Gets traversed ellipses in a movement between ellipses.

Gets traversed ellipses in a movement between ellipses Information needed by PRADA Planner

Definition at line 344 of file ellipses_representation.cpp.

std::vector< cv::RotatedRect > EllipsesRepresentation::loadEllipsesFromRosMsg ( std::vector< estirabot_msgs::Ellipse >  ellipses_msg)

Load ellipses from ros msg.

Load ellipses from ros msg to a vector<RotatedRect>

std::vector< cv::RotatedRect > EllipsesRepresentation::loadEllipsesFromRosMsg ( std::vector< estirabot_msgs::DirtyArea >  dirty_areas_msg)

Definition at line 533 of file ellipses_representation.cpp.

void EllipsesRepresentation::lock ( void  ) [inline]

Lock Algorithm.

Locks access to the Algorithm class

Definition at line 222 of file ellipses_representation.h.

std::vector< estirabot_msgs::DirtyArea > EllipsesRepresentation::orderDirtyAreas ( const std::vector< estirabot_msgs::DirtyArea >  dirty_areas,
const std::vector< estirabot_msgs::DirtyArea >  previous_dirty_areas 
)

Definition at line 708 of file ellipses_representation.cpp.

bool EllipsesRepresentation::pointIsBetween ( cv::Point2f  p1,
cv::Point2f  p2,
cv::Point2f  point 
)

Definition at line 310 of file ellipses_representation.cpp.

Definition at line 292 of file ellipses_representation.cpp.

Definition at line 300 of file ellipses_representation.cpp.

cv::RotatedRect EllipsesRepresentation::rosEllipseToRotatedRect ( estirabot_msgs::Ellipse  ellipse_msg) [inline]

Rosmsg Ellipse to Opencv RotatedRect.

Definition at line 332 of file ellipses_representation.h.

estirabot_msgs::Ellipse EllipsesRepresentation::rotatedRectToRosEllipse ( cv::RotatedRect  ellipse) [inline]

Opencv RotatedRect to rosmsg Ellipse.

Definition at line 319 of file ellipses_representation.h.

void EllipsesRepresentation::setSourceImage ( cv::Mat  image) [protected]

Set images used to get state and display visual info.

Set images used to get state and display visual info

Definition at line 59 of file ellipses_representation.cpp.

std::string EllipsesRepresentation::traversedEllipsesToString ( std::vector< estirabot_msgs::TraversedEllipses >  traversed_ellipses) [protected]

Definition at line 643 of file ellipses_representation.cpp.

Truncates the number of ellipses.

If the number of ellipses is too big, only the ones that are nearest to Point(0,0) will be processed

Definition at line 221 of file ellipses_representation.cpp.

Tries Access to Algorithm.

Tries access to Algorithm

Returns:
true if the lock was adquired, false otherwise

Definition at line 238 of file ellipses_representation.h.

void EllipsesRepresentation::unlock ( void  ) [inline]

Unlock Algorithm.

Unlocks access to the Algorithm class

Definition at line 229 of file ellipses_representation.h.

void EllipsesRepresentation::writeStateToFile ( std::string  path,
std::vector< estirabot_msgs::DirtyArea >  dirty_areas 
)

Write current state to file.

Write current state to file

Definition at line 600 of file ellipses_representation.cpp.


Member Data Documentation

define config type

Define a Config type with the CleaningPlanConfig. All driver implementations will then use the same variable type Config.

Definition at line 104 of file ellipses_representation.h.

Definition at line 113 of file ellipses_representation.h.

config variable

This variable has all the driver parameters defined in the cfg config file. Is updated everytime function config_update() is called.

Definition at line 205 of file ellipses_representation.h.

Position of the robot arm.

Position of the robot arm. Used to minimize moving distances.

Definition at line 463 of file ellipses_representation.h.

std::vector<estirabot_msgs::DirtyArea> EllipsesRepresentation::dirtyAreas_ [protected]

Definition at line 120 of file ellipses_representation.h.

Definition at line 123 of file ellipses_representation.h.

Definition at line 122 of file ellipses_representation.h.

Definition at line 121 of file ellipses_representation.h.

Definition at line 124 of file ellipses_representation.h.

const int EllipsesRepresentation::IMAGE_HEIGHT = 480 [static, protected]

Definition at line 108 of file ellipses_representation.h.

const int EllipsesRepresentation::IMAGE_WIDTH = 640 [static, protected]

Definition at line 107 of file ellipses_representation.h.

std::vector<cv::RotatedRect> EllipsesRepresentation::imageEllipses [protected]

Definition at line 119 of file ellipses_representation.h.

Definition at line 133 of file ellipses_representation.h.

Definition at line 116 of file ellipses_representation.h.

Definition at line 115 of file ellipses_representation.h.

Definition at line 114 of file ellipses_representation.h.

Definition at line 131 of file ellipses_representation.h.

Definition at line 129 of file ellipses_representation.h.

Definition at line 131 of file ellipses_representation.h.

Definition at line 112 of file ellipses_representation.h.

Definition at line 111 of file ellipses_representation.h.

Definition at line 132 of file ellipses_representation.h.

Definition at line 188 of file ellipses_representation.h.

Definition at line 129 of file ellipses_representation.h.

Definition at line 125 of file ellipses_representation.h.

Definition at line 187 of file ellipses_representation.h.


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


iri_clean_board
Author(s): David Martinez
autogenerated on Fri Dec 6 2013 23:52:37