MCPcopy Create free account
hub / github.com/OctoMap/octomap / printChanges

Function printChanges

octomap/src/testing/test_changedkeys.cpp:9–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace octomap;
8
9void printChanges(OcTree& tree){
10 unsigned int changedOccupied = 0;
11 unsigned int changedFree = 0;
12 unsigned int actualOccupied = 0;
13 unsigned int actualFree = 0;
14 unsigned int missingChanged = 0;
15
16 tree.expand();
17
18 // iterate through the changed nodes
19 KeyBoolMap::const_iterator it;
20 for (it=tree.changedKeysBegin(); it!=tree.changedKeysEnd(); it++) {
21 OcTreeNode* node = tree.search(it->first);
22 if (node != NULL) {
23 if (tree.isNodeOccupied(node)) {
24 changedOccupied += 1;
25 }
26 else {
27 changedFree += 1;
28 }
29 } else {
30 missingChanged +=1;
31 }
32 }
33
34
35 // iterate through the entire tree
36 for(OcTree::tree_iterator it=tree.begin_tree(),
37 end=tree.end_tree(); it!= end; ++it) {
38 if (it.isLeaf()) {
39 if (tree.isNodeOccupied(*it)) {
40 actualOccupied += 1;
41 }
42 else {
43 actualFree += 1;
44 }
45 }
46 }
47
48 cout << "change detection: " << changedOccupied << " occ; " << changedFree << " free; "<< missingChanged << " missing" << endl;
49 cout << "actual: " << actualOccupied << " occ; " << actualFree << " free; " << endl;
50
51 tree.prune();
52}
53
54
55

Callers 1

mainFunction · 0.85

Calls 5

changedKeysBeginMethod · 0.80
changedKeysEndMethod · 0.80
isNodeOccupiedMethod · 0.80
begin_treeMethod · 0.80
end_treeMethod · 0.80

Tested by

no test coverage detected