ObjectPositionInterface majority fuser. More...
#include <objpos_majority.h>
Classes | |
class | OpiWrapper |
Wrapper that compares by the Opi's id(). | |
Public Member Functions | |
WorldModelObjPosMajorityFuser (fawkes::Logger *logger, fawkes::BlackBoard *blackboard, const std::string &own_id, const std::string &foreign_id_pattern, const std::string &output_id, float self_confidence_radius) | |
Constructor. | |
~WorldModelObjPosMajorityFuser () | |
Destructor. | |
virtual void | bb_interface_created (const char *type, const char *id) throw () |
BlackBoard interface created notification. | |
virtual void | fuse () |
The single function that makes fusers work. |
ObjectPositionInterface majority fuser.
The parameters are (1) the ID of the own ObjectPositionInterface, (2) the pattern ID of the other robots' ObjectPositionInterfaces and (3) the maximum-self-confidence-distance.
(1) If the own ObjectPositionInterface thinks the object is not further away than self_confidence_radius, then the own interface's data is copied to the output interface. (2) If there is an unambiguous majority of interfaces that say the object is somewhere else and this majority is averaged and the average values are copied to the output interface. Since the other interfaces probably won't agree on one exact position, they are grouped: for each interface A its group is the set of interfaces that claim the object is not further away from the position claimed by A than GROUP_RADIUS. GROUP_RADIUS is currently hard-coded to 1.0 meters. (3) If the other interfaces "cannot settle" on some position of the object, the own interface's data is considered as at least as reliable as theirs and therefore the own interface's data is copied to the output interface.
Like the WorldModelObjPosMajorityFuser, it registers as an observer and opens any newly created interface that matches the ID of the own ObjectPositionInterface or the pattern of the foreign ObjectPositionInterfaces.
Definition at line 44 of file objpos_majority.h.
WorldModelObjPosMajorityFuser::WorldModelObjPosMajorityFuser | ( | fawkes::Logger * | logger, | |
fawkes::BlackBoard * | blackboard, | |||
const std::string & | own_id, | |||
const std::string & | foreign_id_pattern, | |||
const std::string & | output_id, | |||
float | self_confidence_radius | |||
) |
Constructor.
blackboard | BlackBoard. | |
logger | Logger. | |
own_id | The ID of the (single) own interface. | |
foreign_id_pattern | The pattern of the (multiple) other interfaces. | |
output_id | The ID of the destination interface. | |
self_confidence_radius | radius in which to consider our perception the best |
Definition at line 70 of file objpos_majority.cpp.
References fawkes::BlackBoardInterfaceObserver::bbio_add_observed_create(), fawkes::BlackBoard::BBIO_FLAG_CREATED, fawkes::BlackBoard::close(), fawkes::BlackBoard::open_for_reading(), fawkes::BlackBoard::open_for_writing(), fawkes::BlackBoard::open_multiple_for_reading(), and fawkes::BlackBoard::register_observer().
WorldModelObjPosMajorityFuser::~WorldModelObjPosMajorityFuser | ( | ) |
Destructor.
Definition at line 134 of file objpos_majority.cpp.
References fawkes::BlackBoard::close(), fawkes::LockSet< KeyType, LessKey >::lock(), fawkes::LockSet< KeyType, LessKey >::unlock(), and fawkes::BlackBoard::unregister_observer().
void WorldModelObjPosMajorityFuser::bb_interface_created | ( | const char * | type, | |
const char * | id | |||
) | throw () [virtual] |
BlackBoard interface created notification.
This is called whenever an interface is created for a type that you registered for.
type | type of the interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call | |
id | ID of the newly created interface. If you want to store this make a copy as it is not guaranteed that the supplied string exists for longer than the duration of the method call |
Reimplemented from fawkes::BlackBoardInterfaceObserver.
Definition at line 153 of file objpos_majority.cpp.
References fawkes::Interface::id(), and fawkes::Exception::print_trace().
void WorldModelObjPosMajorityFuser::fuse | ( | ) | [virtual] |
The single function that makes fusers work.
In this method fusers shall read from their source interfaces, process the data and write to their output interfaces.
Implements WorldModelFuser.
Definition at line 218 of file objpos_majority.cpp.
References fawkes::ObjectPositionInterface::distance(), fawkes::ObjectPositionInterface::FLAG_HAS_RELATIVE_CARTESIAN, fawkes::ObjectPositionInterface::FLAG_HAS_RELATIVE_POLAR, fawkes::ObjectPositionInterface::FLAG_HAS_WORLD, fawkes::ObjectPositionInterface::flags(), fawkes::Interface::has_writer(), fawkes::ObjectPositionInterface::is_valid(), fawkes::ObjectPositionInterface::is_visible(), fawkes::LockSet< KeyType, LessKey >::lock(), fawkes::Interface::read(), and fawkes::LockSet< KeyType, LessKey >::unlock().