Skip to content

Commit bc96a2f

Browse files
author
Michael Ruhnke
committed
started to create new observation struct for more compact ssa3d files
1 parent 5333a63 commit bc96a2f

3 files changed

+133
-0
lines changed

ssa/types_3d/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ edge_se3_xyzcov.h
66
edge_se3_xyzcov.cpp
77
edge_xyzcov_xyzcov.h
88
edge_xyzcov_xyzcov.cpp
9+
observation_point_xyz_rgb_normal.h
10+
observation_point_xyz_rgb_normal.cpp
911
)
1012

1113
SET_TARGET_PROPERTIES(types_3d PROPERTIES OUTPUT_NAME ${LIB_PREFIX}types_3d)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Sparse Surface Optimization
2+
// Copyright (C) 2011 M. Ruhnke, R. Kuemmerle, G. Grisetti, W. Burgard
3+
//
4+
// SSA is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU Lesser General Public License as published
6+
// by the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
//
9+
// SSA is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU Lesser General Public License for more details.
13+
//
14+
// You should have received a copy of the GNU Lesser General Public License
15+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
17+
//#include <Eigen/Eigenvalues>
18+
#include "observation_point_xyz_rgb_normal.h"
19+
20+
namespace ssa {
21+
using namespace Eigen;
22+
23+
ObservationXYZRGBNormal::ObservationXYZRGBNormal() : measurement(Eigen::Vector3d::Zero()), estimate(Eigen::Vector3d::Zero()), normal(Eigen::Vector3d::Zero()), rgb(Eigen::Vector3i::Zero()), level(0)
24+
{
25+
26+
}
27+
28+
ObservationXYZRGBNormal::ObservationXYZRGBNormal(Eigen::Vector3d& m, Eigen::Vector3d& e, Eigen::Vector3d& n, Eigen::Vector3i& color, int l) : measurement(m), estimate(e), normal(n), rgb(color), level(l)
29+
{
30+
31+
};
32+
33+
34+
bool ObservationXYZRGBNormal::read(std::istream& is)
35+
{
36+
/// measurement in sensor frame
37+
for(int i = 0; i < 3; ++i)
38+
is >> measurement(i);
39+
40+
/// estimate in global frame
41+
for(int i = 0; i < 3; ++i)
42+
is >> estimate(i);
43+
44+
/// normal in local frame
45+
for(int i = 0; i < 3; ++i)
46+
is >> normal(i);
47+
48+
/// color as r,g,b
49+
for(int i = 0; i < 3; ++i)
50+
is >> rgb(i);
51+
52+
is >> level;
53+
return true;
54+
}
55+
56+
bool ObservationXYZRGBNormal::write(std::ostream& os) const
57+
{
58+
/// measurement in sensor frame
59+
for(int i = 0; i < 3; ++i)
60+
os << measurement(i) << " ";
61+
62+
/// estimate in global frame
63+
for(int i = 0; i < 3; ++i)
64+
os << estimate(i) << " ";
65+
66+
/// normal in local frame
67+
for(int i = 0; i < 3; ++i)
68+
os << normal(i) << " ";
69+
70+
/// color as r,g,b
71+
for(int i = 0; i < 3; ++i)
72+
os << rgb(i) << " ";
73+
74+
os << level << " ";
75+
return os.good();
76+
}
77+
78+
} //end namespace
79+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#ifndef __SSA_OBSERVATION_XYZ_RGB_NORMAL__
2+
#define __SSA_OBSERVATION_XYZ_RGB_NORMAL__
3+
4+
// Sparse Surface Optimization
5+
// Copyright (C) 2011 M. Ruhnke, R. Kuemmerle, G. Grisetti, W. Burgard
6+
//
7+
// SSA is free software: you can redistribute it and/or modify
8+
// it under the terms of the GNU Lesser General Public License as published
9+
// by the Free Software Foundation, either version 3 of the License, or
10+
// (at your option) any later version.
11+
//
12+
// SSA is distributed in the hope that it will be useful,
13+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
// GNU Lesser General Public License for more details.
16+
//
17+
// You should have received a copy of the GNU Lesser General Public License
18+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
20+
#include <Eigen/Core>
21+
22+
namespace ssa {
23+
24+
/** \brief: SSA class for single observation of a surface point
25+
*
26+
* This point vertices represent the observed surface,
27+
* which will be adapted during optimization.
28+
*
29+
*/
30+
31+
class ObservationXYZRGBNormal
32+
{
33+
public:
34+
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35+
36+
Eigen::Vector3d measurement;
37+
Eigen::Vector3d estimate;
38+
Eigen::Vector3d normal;
39+
Eigen::Vector3i rgb;
40+
unsigned short level;
41+
42+
43+
ObservationXYZRGBNormal();
44+
ObservationXYZRGBNormal(Eigen::Vector3d& measurement, Eigen::Vector3d& estimate, Eigen::Vector3d& normal, Eigen::Vector3i& rgb, int level = 0);
45+
46+
bool read(std::istream& is);
47+
bool write(std::ostream& os) const;
48+
49+
};
50+
51+
}
52+
#endif

0 commit comments

Comments
 (0)