9 float simulationStep=BOX2DRANGE;
11 std::vector <BodyFeatures> world_objects;
14 enum CLUSTERING{BOX=0, KMEANS=1, PARTITION=2};
20 if (fabs(atan2(b1.pose.p.y, b1.pose.p.x))< fabs(atan2(b2.pose.p.y, b2.pose.p.x)) && b1.pose.p.Length()<= b2.pose.p.Length()){
27 static std::pair <CoordinateContainer, bool> salientPoints(b2Transform,
const CoordinateContainer &, std::pair <Pointf, Pointf>);
56 bool checkDisturbance(
Pointf,
bool&,
Task * curr =NULL,
float range=0.025);
74 virtual void buildWorld(b2World&,b2Transform, Direction,
Disturbance disturbance=
Disturbance(),
float halfWindowWidth=0.15, CLUSTERING clustering=CLUSTERING::PARTITION,
Task * task=NULL);
77 static std::pair <Pointf, Pointf> bounds(Direction, b2Transform t,
float boxLength,
float halfWindowWidth,std::vector <Pointf> *_bounds=NULL);
88 b2PolygonShape
object_filtering_box(
float halfWindowWidth,
float boxLength, b2Transform start, Direction d);
91 std::pair <bool, BodyFeatures> bounding_approx_poly(std::vector <cv::Point2f>nb);
98 std::vector <std::vector<cv::Point2f>>
kmeans_clusters( std::vector <cv::Point2f>, std::vector <cv::Point2f>&);
105 std::vector <std::vector<cv::Point2f>>
partition_clusters( std::vector <cv::Point2f>);
113 void add_body_count(){
121 void add_iteration(
int i=1){
125 b2Body * get_robot(b2World *);
127 b2Fixture * get_chassis(b2Body *);
139 std::vector <BodyFeatures>& get_world_objects(){
140 return world_objects;
143 void set_world_objects(
const std::vector <BodyFeatures>& wo){
147 void setSimulationStep(
float f){simulationStep=f;}
170 virtual void buildWorld(b2World & w, b2Transform start, Direction d,
Disturbance disturbance,
float halfWindowWidth, CLUSTERING clustering,
Task * task)
override;
191 void buildWorld(b2World & w, b2Transform start, Direction d,
Disturbance disturbance,
float halfWindowWidth, CLUSTERING clustering,
Task * task)
override{
206 virtual void buildWorld(b2World & w, b2Transform start, Direction d,
Disturbance disturbance,
float halfWindowWidth, CLUSTERING clustering,
Task * task)
override;
Definition: configurator.h:17
Makes a feature for every other point and builds only those in the way of task.
Definition: worldbuilder.h:177
std::vector< BodyFeatures > getFeatures(const CoordinateContainer ¤t, b2Transform start, CLUSTERING clustering) override
clusters point clouds into objects and returns a vector of body features
Definition: worldbuilder.cpp:328
Makes a feature for every other point and builds all points.
Definition: worldbuilder.h:185
void buildWorld(b2World &w, b2Transform start, Direction d, Disturbance disturbance, float halfWindowWidth, CLUSTERING clustering, Task *task) override
Creates bodies (objects) in the box2d world.
Definition: worldbuilder.h:191
std::vector< BodyFeatures > getFeatures(const CoordinateContainer ¤t, b2Transform start, CLUSTERING clustering) override
clusters point clouds into objects and returns a vector of body features
Definition: worldbuilder.h:187
Builds all points for each task.
Definition: worldbuilder.h:168
virtual void buildWorld(b2World &w, b2Transform start, Direction d, Disturbance disturbance, float halfWindowWidth, CLUSTERING clustering, Task *task) override
Creates bodies (objects) in the box2d world.
Definition: worldbuilder.cpp:322
Gets all points in the way of the task and makes a body which is a bounding upright box around all po...
Definition: worldbuilder.h:200
std::vector< BodyFeatures > getFeatures(const CoordinateContainer ¤t, b2Transform start, CLUSTERING clustering) override
clusters point clouds into objects and returns a vector of body features
Definition: worldbuilder.cpp:340
virtual void buildWorld(b2World &w, b2Transform start, Direction d, Disturbance disturbance, float halfWindowWidth, CLUSTERING clustering, Task *task) override
Creates bodies (objects) in the box2d world.
Definition: worldbuilder.cpp:346
A closed hybrid control loop. It has an initial disturbance representing the continuous state and a d...
Definition: task.h:47
Definition: worldbuilder.h:5
std::vector< std::vector< cv::Point2f > > partition_clusters(std::vector< cv::Point2f >)
Clusters points using the partition algorithm.
Definition: worldbuilder.cpp:71
std::vector< std::vector< cv::Point2f > > kmeans_clusters(std::vector< cv::Point2f >, std::vector< cv::Point2f > &)
Clusters points using k-means algorithm.
Definition: worldbuilder.cpp:55
virtual std::vector< BodyFeatures > getFeatures(const CoordinateContainer ¤t, b2Transform start, CLUSTERING clustering=PARTITION)
clusters point clouds into objects and returns a vector of body features
Definition: worldbuilder.cpp:187
std::vector< BodyFeatures > processData(const CoordinateContainer &, const b2Transform &)
returns a bounding box encompassing all points provided
Definition: worldbuilder.cpp:90
b2PolygonShape object_filtering_box(float halfWindowWidth, float boxLength, b2Transform start, Direction d)
Makes a box.
Definition: worldbuilder.cpp:38
b2Body * makeBody(b2World &w, const BodyFeatures &features)
Creates a body in the box2d world, and if the features represent a disturbance to which the attention...
Definition: worldbuilder.cpp:123
std::vector< BodyFeatures > cluster_data(const CoordinateContainer &pts, const b2Transform &start, CLUSTERING clustering=PARTITION)
Cluster point cloud data using a custom algorithm.
Definition: worldbuilder.cpp:101
virtual void buildWorld(b2World &, b2Transform, Direction, Disturbance disturbance=Disturbance(), float halfWindowWidth=0.15, CLUSTERING clustering=CLUSTERING::PARTITION, Task *task=NULL)
Creates bodies (objects) in the box2d world.
Definition: worldbuilder.cpp:206
b2AABB makeRobotSensor(b2Body *const robotBody, const Disturbance &focus) const
Makes the robot attention window, i.e. a distal sensor which is comprised between the extremes of the...
Definition: worldbuilder.cpp:295
Each point is an object but each time the world is built, only the points in the way of the task are ...
Definition: worldbuilder.h:159
virtual std::vector< BodyFeatures > getFeatures(const CoordinateContainer ¤t, b2Transform start, CLUSTERING clustering) override
clusters point clouds into objects and returns a vector of body features
Definition: worldbuilder.cpp:314
Given points, makes rotated bounding box.
std::set< Pointf > CoordinateContainer
container for LIDAR coordinates
Definition: sensor.h:61
Definition: disturbance.h:47
Definition: disturbance.h:113
Wrapper around cv::Point2f for customisation purposes.
Definition: sensor.h:12
Definition: worldbuilder.h:15