MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
include/architecture/planner/MarketPlanner.h
00001 #pragma once
00002 #ifndef __MARKET__PLANNER__
00003 #define __MARKET__PLANNER__
00004 
00005 #include <iostream>
00006 #include <stdlib.h>
00007 #include "ClThread.h"
00008 #include "ClMutex.h"
00009 #include "stepEvent.h"
00010 #include "slamInterface.h"
00011 #include "reactive.h"
00012 #include "planner.h"
00013 #include "pathPlanning.h"
00014 
00015 
00016 
00017 /** 
00018 * @brief Implements an explorative path planner using a cooperative market model for target selection
00019 *
00020 * Each robot has its own list of targets. 
00021 * Periodically new targets are proposed for auction.
00022 * The robot with the best bid includes the target in its list.
00023 *  
00024 */
00025 class MarketPlanner: public planner{
00026 
00027 private: 
00028 
00029 /** 
00030 * @brief Target struct
00031 *
00032 * It is used for in the Market Planner target list
00033 *
00034 * This struct contains the information related with the profit of a target.
00035 */
00036 typedef struct target{
00037         point cell;
00038         float utility;
00039         float cost;
00040         float profit;
00041         int auctionEnds;
00042         int bestOfferID;
00043         float bestOfferProfit;
00044         target():utility(0.0f),cost(0.0f),profit(0.0f),auctionEnds(0),bestOfferID(-1),bestOfferProfit(0.0f){}
00045         bool operator<(const target& t){return profit<t.profit;}
00046 }target;
00047 
00048 
00049 /** 
00050 * @brief Public auction, data contains the target cell and the auction publisher
00051 */
00052 typedef struct auct{
00053         point cell;
00054         int auctioner;
00055 }auct;
00056 
00057 
00058 ///////////////////////////////////////////////////////////////////////
00059 //-------------------------  Attributes  ------------------------------
00060 ///////////////////////////////////////////////////////////////////////
00061 
00062 
00063         ClMutex closing;                                // Mutex for a right stopping of the thread
00064         bool endPlanner;                                // Flag that indicates that the thread must conclude in the next iteration 
00065 //      bool showPlanner;                               // Flag that indicates if the planning figure must be displayed
00066         bool completedPath;                             // Flag to set when path is finished
00067         std::vector<point> path;                        // planned path
00068 
00069         std::list<target> targetList;
00070 
00071         // parameters
00072         float replanning_period;
00073         int inflate_obstacles;
00074         float utility_radius;
00075         float utility_weight;
00076         float cost_weight;      
00077 //--------------------------------------------------------------------- 
00078 ///////////////////////////////////////////////////////////////////////
00079 
00080 ///////////////////////////////////////////////////////////////////////
00081 //-------------------------  Methods  ---------------------------------
00082 ///////////////////////////////////////////////////////////////////////
00083 
00084 public:
00085 
00086         /// Constructor
00087         MarketPlanner(const ConfigFile& config);
00088         /// Destructor
00089         virtual ~MarketPlanner();
00090 
00091 private:
00092 
00093         /// Thread setup
00094         int setup();                                    
00095         /// Thread on stop
00096         void onStop();                                  
00097         /// Thead execution body
00098         void execute();                                 
00099         /// Evals the utility of an area
00100         int utility(const gridMapInterface& omap, const binMap& esz); 
00101 
00102 //--------------------------------------------------------------------- 
00103 ///////////////////////////////////////////////////////////////////////
00104 };
00105 
00106 #endif
00107 
 All Classes Functions Variables Typedefs