IVPointParser.hpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package
19
* @author
20
* @date
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
#pragma once
25
26
#include <string>
27
#include <iostream>
28
#include <fstream>
29
#include <cassert>
30
31
//Eigen
32
#include <Eigen/Core>
33
34
#include <
ArmarXCore/core/logging/Logging.h
>
35
36
37
class
IVPointParser
38
{
39
public
:
40
static
std::vector<Eigen::Vector3f>
fromFile
(
const
std::string& fileName)
41
{
42
std::vector<Eigen::Vector3f> ps;
43
44
std::ifstream file(fileName.c_str(), std::ifstream::in);
45
46
if
(file.is_open())
47
{
48
std::string word;
49
50
//Find the points
51
while
(file >> word)
52
{
53
if
(word.find(
"Coordinate3"
) != std::string::npos)
54
{
55
break
;
56
}
57
}
58
59
//Skip first {
60
file >> word;
61
//Should be "point"
62
file >> word;
63
assert(word.find(
"point"
) != std::string::npos);
64
65
//Skip next [
66
file >> word;
67
68
//Start with the points
69
while
(
true
)
70
{
71
double
x, y, z;
72
file >> x >> y >> z;
73
74
if
(file.fail())
75
{
76
break
;
77
}
78
79
file.get();
//Last comma
80
81
Eigen::Vector3f
v
;
82
v
<< x, y, z;
83
ps.push_back(
v
);
84
}
85
86
file.close();
87
}
88
else
89
{
90
ARMARX_WARNING_S
<<
"Could not open IV file to parse points"
<<
armarx::flush
;
91
}
92
93
return
ps;
94
}
95
};
96
armarx::flush
const LogSender::manipulator flush
Definition:
LogSender.h:251
ARMARX_WARNING_S
#define ARMARX_WARNING_S
Definition:
Logging.h:206
armarx::ctrlutil::v
double v(double t, double v0, double a0, double j)
Definition:
CtrlUtil.h:39
Logging.h
IVPointParser
Definition:
IVPointParser.hpp:37
IVPointParser::fromFile
static std::vector< Eigen::Vector3f > fromFile(const std::string &fileName)
Definition:
IVPointParser.hpp:40
VisionX
components
pointcloud_processor
ObjectShapeClassification
IVPointParser.hpp
Generated on Sat Oct 12 2024 09:14:17 for armarx_documentation by
1.8.17