32 using namespace gtsam;
36 const string expected_end =
"examples/Data/example.graph";
38 string actual_end = actual.substr(actual.size() - expected_end.size(), expected_end.size());
40 std::replace(actual_end.begin(), actual_end.end(),
'\\',
'/');
47 const string str =
"VERTEX2 1 2.000000 3.000000 4.000000";
48 istringstream is(
str);
62 const string str =
"VERTEX_XY 1 2.000000 3.000000";
63 istringstream is(
str);
77 const string str =
"EDGE2 0 1 2.000000 3.000000 4.000000";
78 istringstream is(
str);
109 auto measurements2 = parseMeasurements<Rot2>(
filename);
114 for (
size_t i : {0, 1, 2, 3, 4, 5}) {
121 for (
size_t j : {0, 1, 2, 3, 4}) {
131 TEST(dataSet, load2DVictoriaPark) {
152 const std::vector<Pose3> relative_poses = {
153 {{0.854230, 0.190253, 0.283162, -0.392318},
154 {1.001367, 0.015390, 0.004948}},
155 {{0.105373, 0.311512, 0.656877, -0.678505},
156 {0.523923, 0.776654, 0.326659}},
157 {{0.568551, 0.595795, -0.561677, 0.079353},
158 {0.910927, 0.055169, -0.411761}},
159 {{0.542221, -0.592077, 0.303380, -0.513226},
160 {0.775288, 0.228798, -0.596923}},
161 {{0.327419, -0.125250, -0.534379, 0.769122},
162 {-0.577841, 0.628016, -0.543592}},
163 {{0.083672, 0.104639, 0.627755, 0.766795},
164 {-0.623267, 0.086928, 0.773222}},
168 const std::vector<Pose3> poses = {
169 {{1.000000, 0.000000, 0.000000, 0.000000}, {0, 0, 0}},
170 {{0.854230, 0.190253, 0.283162, -0.392318},
171 {1.001367, 0.015390, 0.004948}},
172 {{0.421446, -0.351729, -0.597838, 0.584174},
173 {1.993500, 0.023275, 0.003793}},
174 {{0.067024, 0.331798, -0.200659, 0.919323},
175 {2.004291, 1.024305, 0.018047}},
176 {{0.765488, -0.035697, -0.462490, 0.445933},
177 {0.999908, 1.055073, 0.020212}},
181 using KeyPair = pair<Key, Key>;
182 std::vector<KeyPair>
edges = {{0, 1}, {1, 2}, {2, 3}, {3, 4}, {1, 4}, {3, 0}};
194 for (
size_t i : {0, 1, 2, 3, 4, 5}) {
196 *actualFactors[
i], 1
e-5));
201 for (
size_t j : {0, 1, 2, 3, 4}) {
207 for (
size_t j : {0, 1, 2, 3, 4}) {
213 const auto [actualGraph, actualValues] =
readG2o(g2oFile, is3D);
215 for (
size_t j : {0, 1, 2, 3, 4}) {
221 TEST( dataSet, readG2o3DNonDiagonalNoise)
225 const auto [actualGraph, actualValues] =
readG2o(g2oFile, is3D);
239 for (
int i = 0;
i < 6;
i++){
240 for (
int j =
i;
j < 6;
j++){
259 TEST(dataSet, readG2oCheckDeterminants) {
265 for (
const auto& factor :
factors) {
266 const Rot3 R = factor->measured().rotation();
273 for (
const auto& key_value : poses) {
274 const Rot3 R = key_value.second.rotation();
282 TEST(dataSet, readG2oLandmarks) {
291 auto graphAndValues =
load3D(g2oFile);
292 EXPECT(graphAndValues.second->exists(
L(0)));
317 const auto [actualGraph, actualValues] =
readG2o(g2oFile);
320 Vector3(44.721360, 44.721360, 30.901699));
324 expectedValues.
insert(0,
Pose2(0.000000, 0.000000, 0.000000));
325 expectedValues.
insert(1,
Pose2(1.030390, 0.011350, -0.081596));
326 expectedValues.
insert(2,
Pose2(2.036137, -0.129733, -0.301887));
327 expectedValues.
insert(3,
Pose2(3.015097, -0.442395, -0.345514));
328 expectedValues.
insert(4,
Pose2(3.343949, 0.506678, 1.214715));
329 expectedValues.
insert(5,
Pose2(3.684491, 1.464049, 1.183785));
330 expectedValues.
insert(6,
Pose2(4.064626, 2.414783, 1.176333));
331 expectedValues.
insert(7,
Pose2(4.429778, 3.300180, 1.259169));
332 expectedValues.
insert(8,
Pose2(4.128877, 2.321481, -1.825391));
333 expectedValues.
insert(9,
Pose2(3.884653, 1.327509, -1.953016));
334 expectedValues.
insert(10,
Pose2(3.531067, 0.388263, -2.148934));
342 const auto [actualGraph, actualValues] =
346 Vector3(44.721360, 44.721360, 30.901699));
357 const auto [actualGraph, actualValues] =
361 Vector3(44.721360, 44.721360, 30.901699));
377 const auto [actualGraph, actualValues] =
readG2o(filenameToWrite);
392 const auto [actualGraph, actualValues] =
readG2o(filenameToWrite, is3D);
398 TEST( dataSet, writeG2o3DNonDiagonalNoise)
407 const auto [actualGraph, actualValues] =
readG2o(filenameToWrite, is3D);