28 #include <configfile/configfile.h> 30 #define DEBUG cout << __PRETTY_FUNCTION__ 51 int main(
int argc,
const char *
const * argv){
53 std::string outfilename=
"";
76 double srr=0.01, srt=0.01, str=0.01, stt=0.01;
82 double angularUpdate=0.5;
83 double linearUpdate=1;
84 double resampleThreshold=0.5;
85 bool generateMap=
true;
87 std::string configfilename =
"";
93 if (configfilename.length()>0){
94 ConfigFile cfg(configfilename);
95 outfilename = (std::string) cfg.value(
"gfs",
"outfilename",outfilename);
96 xmin = cfg.value(
"gfs",
"xmin", xmin);
97 xmax = cfg.value(
"gfs",
"xmax",xmax);
98 ymin = cfg.value(
"gfs",
"ymin",ymin);
99 ymax = cfg.value(
"gfs",
"ymax",ymax);
100 delta = cfg.value(
"gfs",
"delta",delta);
101 maxrange = cfg.value(
"gfs",
"maxrange",maxrange);
102 maxUrange = cfg.value(
"gfs",
"maxUrange",maxUrange);
103 regscore = cfg.value(
"gfs",
"regscore",regscore);
104 critscore = cfg.value(
"gfs",
"critscore",critscore);
105 kernelSize = cfg.value(
"gfs",
"kernelSize",kernelSize);
106 sigma = cfg.value(
"gfs",
"sigma",sigma);
107 iterations = cfg.value(
"gfs",
"iterations",iterations);
108 lstep = cfg.value(
"gfs",
"lstep",lstep);
109 astep = cfg.value(
"gfs",
"astep",astep);
110 maxMove = cfg.value(
"gfs",
"maxMove",maxMove);
111 srr = cfg.value(
"gfs",
"srr", srr);
112 srt = cfg.value(
"gfs",
"srt", srt);
113 str = cfg.value(
"gfs",
"str", str);
114 stt = cfg.value(
"gfs",
"stt", stt);
115 particles = cfg.value(
"gfs",
"particles",particles);
116 angularUpdate = cfg.value(
"gfs",
"angularUpdate", angularUpdate);
117 linearUpdate = cfg.value(
"gfs",
"linearUpdate", linearUpdate);
118 lsigma = cfg.value(
"gfs",
"lsigma", lsigma);
119 ogain = cfg.value(
"gfs",
"lobsGain", ogain);
120 lskip = (int)cfg.value(
"gfs",
"lskip", lskip);
122 resampleThreshold = cfg.value(
"gfs",
"resampleThreshold", resampleThreshold);
123 generateMap = cfg.value(
"gfs",
"generateMap", generateMap);
155 parseDouble(
"-resampleThreshold", resampleThreshold);
159 cerr <<
"Parameter parsed, connecting to Carmen!";
166 cerr <<
"." << flush;
176 cerr <<
"Connected " << endl;
180 processor->
setMatchingParameters(maxUrange, maxrange, sigma, kernelSize, lstep, astep, iterations, lsigma, ogain, lskip);
183 processor->setgenerateMap(generateMap);
188 processor->
init(particles, xmin, ymin, xmax, ymax, delta, initialPose);
189 if (outfilename.length()>0)
195 ap=processor; processor=copy; copy=ap;
207 cerr <<
"PROCESSED" << endl;
216 cerr <<
"Particle reproduction story begin" << endl;
217 for (
unsigned int i=0; i<particles.size(); i++){
218 cerr << particles[i].previousIndex <<
"->" << i <<
" ";
220 cerr <<
"Particle reproduction story end" << endl;
231 cerr << __PRETTY_FUNCTION__ <<
"CLONING... " << endl;
233 cerr <<
"DONE" << endl;
234 cerr << __PRETTY_FUNCTION__ <<
"DELETING... " << endl;
236 cerr <<
"DONE" << endl;
237 processor=newProcessor;
const char *const *argv double delta
std::ofstream & outputStream()
const ParticleVector & getParticles() const
#define parseFlag(name, value)
void setMatchingParameters(double urange, double range, double sigma, int kernsize, double lopt, double aopt, int iterations, double likelihoodSigma=1, double likelihoodGain=1, unsigned int likelihoodSkip=0)
bool processScan(const RangeReading &reading, int adaptParticles=0)
std::vector< Particle > ParticleVector
#define parseDouble(name, value)
#define CMD_PARSE_BEGIN_SILENT(i, count)
static void initializeIPC(const char *name)
#define parseInt(name, value)
void setUpdateDistances(double linear, double angular, double resampleThreshold)
void setSensorMap(const SensorMap &smap)
GridSlamProcessor * clone() const
#define parseString(name, value)
static bool sensorMapComputed()
#define CMD_PARSE_END_SILENT
static bool start(const char *name)
std::map< std::string, Sensor * > SensorMap
#define parseStringSilent(name, value)
static const SensorMap & sensorMap()
void init(unsigned int size, double xmin, double ymin, double xmax, double ymax, double delta, OrientedPoint initialPose=OrientedPoint(0, 0, 0))
static bool getReading(RangeReading &reading)
int main(int argc, conat char **argv)
void setMotionModelParameters(double srr, double srt, double str, double stt)
CMD_PARSE_BEGIN(1, argc-2)