MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
include/architecture/planner/auxiliar/treeNode.h
00001 
00002 #ifndef ___TREE_NODE__
00003 #define ___TREE_NODE__
00004 
00005 #include "robotTypes.h"
00006 
00007 #define GATEWAY_NODE                    0
00008 #define LEAF_TYPE_FRONTIER              1
00009 #define LEAF_TYPE_PRECISE_POSE          2
00010 
00011 /**
00012 * @brief Nodes that form a tree that partitions the environment for the high level planner in the hybrid arquitecture
00013 *
00014 */
00015 class treeNode{
00016 
00017 private:
00018         treeNode* parent;
00019         int nchildren;
00020         treeNode** children;
00021         
00022         double ipoints;
00023         int nbots;
00024         double value;
00025         int nextNodeInPlan;
00026 
00027         int x;
00028         int y;
00029         double cost;
00030         double localCost;
00031 
00032         int node_type;
00033 
00034         int numrobots;
00035         bool* robots;
00036 
00037 public:
00038         treeNode(int type, int nrobots);
00039         virtual ~treeNode();
00040 
00041         void setCell(point pos);
00042         void setiPoints(double n);
00043         void setnBots(int n);
00044         double getiPoints() const;
00045         int getnBots() const;
00046 
00047         int getNChildren() const;
00048         
00049         double getValue() const;
00050         void setValue(double value);
00051 
00052         void setParent(treeNode& parent);
00053         void addChildren(treeNode& child);
00054 
00055         treeNode& getChildren(int number) const ;
00056         treeNode& getParent() const;
00057 
00058         void setCost(double val);
00059         double getCost() const;
00060         void setLocalCost(double val);
00061         double getLocalCost() const;
00062 
00063         int getX() const;
00064         int getY() const;
00065 
00066         bool isLeaf() const;
00067         int getNodeType() const;
00068         bool isRoot() const;
00069 
00070         void clearRobots();
00071         bool isRobot(int robot) const;
00072         void setRobot(int robot);
00073 
00074         static bool orderByValue(const treeNode* a, const treeNode* b);
00075         static bool orderByCost(const treeNode* a, const treeNode* b);
00076 
00077         int getNextNodeInPlan() const;
00078         void setNextNodeInPlan(int n);
00079 };
00080 
00081 inline void treeNode::setCell(point pos)                                {x = pos.x; y = pos.y;}
00082 inline void treeNode::setiPoints(double n)                              {ipoints = n;}
00083 inline double treeNode::getiPoints() const                              {return ipoints;}
00084 inline void treeNode::setnBots(int n)                                   {nbots = n;}
00085 inline int treeNode::getnBots() const                                   {return nbots;}
00086 inline void treeNode::setValue(double val)                              {value = val;}
00087 inline double treeNode::getValue() const                                {return value;}
00088 inline int treeNode::getNChildren() const                               {return nchildren;}
00089 inline void treeNode::setParent(treeNode& p)                            {parent = &p;}
00090 inline bool treeNode::isRoot() const                                    {return(parent==0);}
00091 inline int treeNode::getX() const                                       {return x;}
00092 inline int treeNode::getY() const                                       {return y;}
00093 inline bool treeNode::isLeaf() const                                    {return (node_type != GATEWAY_NODE);}
00094 inline int treeNode::getNodeType() const                                {return node_type;}
00095 inline void treeNode::setCost(double val)                               {cost = val;}
00096 inline double treeNode::getCost() const                                 {return cost;}
00097 inline void treeNode::setLocalCost(double val)                          {localCost = val;}
00098 inline double treeNode::getLocalCost() const                            {return localCost;}
00099 inline int treeNode::getNextNodeInPlan() const                          {return nextNodeInPlan;}
00100 inline void treeNode::setNextNodeInPlan(int n)                          {nextNodeInPlan = n;}
00101 
00102 #endif
00103 
 All Classes Functions Variables Typedefs