THIS PAGE IS OBSOLETE
Everything on this page is obsolete; its provided only as a record of an earlier implementation. The code for this was deleted from github in the 2015 time-frame, or thereabouts.
The rudimentary space server should support all of the (2D only) queries that will be handled by the final space server, but does so in a possibly less efficient (flat vs. hierarchical) fashion. The 2D Local Space Map is in Launchpad (BZR) as opencog/spatial/LocalSpaceMap2D.h.
Paths and intersections are computed based on a discrete grid and used to identify the distances and possible route paths between objects. The only constructor is:
LocalSpaceMap2D(Distance xMin,Distance xMax,unsigned int xDim, Distance yMin,Distance yMax,unsigned int yDim, Distance radius);
This constructs a map over a given rectangle of space, with a discretized grid of xDim * yDim points. Since hash tables are used, memory requirements grow linearly with the number of occupied points, not quadratically with the resolution. The radius of the robot (for tangent bug) is taken as a ctor argument so that certain quantities can be precomputed (see below).
//adds an object represented by a set of points to the map this should be //at a granularity at or greater than the gridWidth, otherwise the //resulting object representation may have holes in it // //an object with this ID cannot already exist void addObject(ObjectID id, ObjectMetaData metadata );
An object id is just a string which unique identifies the object. An object metadata is a struct that describes some characteristics of the object:
- its center position
- its bounding box (width, height and length)
- its orientation angle (yaw)
//update the position of an object void updateObject(ObjectID id, ObjectMetaData metadata);
Updating an object is done by removing it from the map and adding a new one described by a new metadata.
For Predicate Mining
//find the IDs of all objects within distance d of a certain point Out findEntities(const Point& p, Distance d,Out out) const;
This method is quadratic in d and linear in the number of entities found.
//all of the points associated with a given object Out allPoints(ObjectID id,Out out) const;
This method is linear time in the number of points.
//all of the perimeter points associated with a given object Out allPerimeterPoints(ObjectID id,Out out) const;
This method is linear time in the number of perimeter points.
For Tangent Bug
IMPORTANT: Note that even though the tangent bug algorithm is available to be used as a path planner, the official and more reliable/fast path planning algorithm used by embodiment is HPA. Look for opencog/spatial/HPASearch.h (into the source repository) for more informations.
//returns true iff there is a clear path from src to dst of the robot //radius on all sides (i.e. assuming a circular/spherical robot) bool isClearPath(const Point& src,const Point& dst) const; //scan for an edge-point along the vector between src and dst based on the //robot's radius - if no edge-point is found, returns src // //you should be able to get all endpoints visible from src by feeding the //return value back in as dst repeatedly Point scanClockwise(const Point& src,const Point& dst) const; Point scanCounterclockwise(const Point& src,const Point& dst) const; //Nearest occupied neighbor Point getOccupiedClosestPoint(const Point& p) const;
Other miscellaneous functionalities are also provided - see the header for details.
-- Main.MosheLooks - 24 Jul 2007 -- Main.SamirAraujo - 29 Apr 2009