log
rdk2carmen.cpp
Go to the documentation of this file.
1
#include <cstdlib>
2
#include <fstream>
3
#include <iostream>
4
#include <
gmapping/log/carmenconfiguration.h
>
5
#include <
gmapping/log/sensorlog.h
>
6
7
8
using namespace
std;
9
using namespace
GMapping
;
10
11
int
main
(
int
argc,
char
** argv){
12
if
(argc<2){
13
cerr <<
"usage "
<<argv[0]<<
" <filename> <outfilename>"
<< endl;
14
cerr <<
"or "
<<argv[0]<<
" <filename> for standard output"
<< endl;
15
exit (-1);
16
}
17
ifstream
is
(argv[1]);
18
if
(!
is
){
19
cerr <<
"no file "
<< argv[1] <<
" found"
<< endl;
20
exit (-1);
21
}
22
ostream *os;
23
if
(argc<3)
24
os=&cout;
25
else
{
26
os=
new
ofstream(argv[2]);
27
if
(! os){
28
cerr <<
"no file "
<< argv[1] <<
" found"
<< endl;
29
exit (-1);
30
}
31
}
32
CarmenConfiguration
conf;
33
conf.
load
(
is
);
34
35
SensorMap
m=conf.
computeSensorMap
();
36
37
//for (SensorMap::const_iterator it=m.begin(); it!=m.end(); it++)
38
// cout << it->first << " " << it->second->getName() << endl;
39
40
SensorLog
log(m);
41
is
.close();
42
43
ifstream ls(argv[1]);
44
log.
load
(ls);
45
ls.close();
46
cerr <<
"log size"
<< log.size() << endl;
47
for
(SensorLog::iterator it=log.begin(); it!=log.end(); it++){
48
RangeReading
* rr=
dynamic_cast<
RangeReading
*
>
(*it);
49
if
(rr){
50
*os << rr->
getSensor
()->
getName
() <<
" "
;
51
*os << rr->size()<<
" "
;
52
for
(RangeReading::const_iterator it=rr->begin(); it!=rr->end(); it++){
53
*os << (*it)*0.001 <<
" "
;
54
}
55
*os<< rr->
getPose
().
x
*0.001 <<
" "
<< rr->
getPose
().
y
*0.001 <<
" "
<< rr->
getPose
().
theta
<< endl;
56
}
57
}
58
}
GMapping::SensorMap
std::map< std::string, Sensor * > SensorMap
Definition:
sensor.h:20
main
int main(int argc, char **argv)
Definition:
rdk2carmen.cpp:11
is
ifstream is(argv[c])
carmenconfiguration.h
GMapping::CarmenConfiguration::computeSensorMap
virtual SensorMap computeSensorMap() const
Definition:
carmenconfiguration.cpp:97
GMapping
Definition:
configfile.cpp:34
GMapping::Sensor::getName
std::string getName() const
Definition:
sensor.h:14
sensorlog.h
GMapping::CarmenConfiguration
Definition:
carmenconfiguration.h:14
GMapping::point::y
T y
Definition:
point.h:16
GMapping::orientedpoint::theta
A theta
Definition:
point.h:60
GMapping::SensorLog::load
std::istream & load(std::istream &is)
Definition:
sensorlog.cpp:23
GMapping::SensorReading::getSensor
const Sensor * getSensor() const
Definition:
sensoreading.h:13
GMapping::RangeReading
Definition:
rangereading.h:17
GMapping::RangeReading::getPose
const OrientedPoint & getPose() const
Definition:
rangereading.h:22
GMapping::CarmenConfiguration::load
virtual std::istream & load(std::istream &is)
Definition:
carmenconfiguration.cpp:17
GMapping::SensorLog
Definition:
sensorlog.h:16
GMapping::point::x
T x
Definition:
point.h:16
openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51