Skip to content
Snippets Groups Projects
Commit 237f4a32 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Add correct README

parent 39e8d175
No related branches found
No related tags found
No related merge requests found
# Algorithm for Correction of Marker Rotation and Displacement Errors # Implementações de algoritmos e resoluções de problemas; estudo, treino e consulta para programação competitiva (maratona de programação)
The algorithm is described and explained at report.pdf Os algoritmos estão classificados por area de estudo e todos eles estão listados nas Issues.
# Get mid Points (First Step) A seleção dos problemas e contests foi feita com base na minha necessidade e curiosidade de aprender assuntos específicos.
Gets last PE point before each marker detection.
--md and --pe are the logs from marker detection and pose estimator from the path that needs to be optimized, this path needs the global pose update by markers turned on.
```
$ python script/get_mid_points.py --marker=data/logs/20180516-134720/marker/pose.csv --pe=data/logs/20180516-134720/pe/pose.csv > mid_data
```
# Parse Marker Error (Second Step)
Parse log from path without global position update by marker detection
```
$ python script/parse_marker_error.py --map=data/gvz_ext.yml --md=data/logs/20180516-133414/marker/pose.csv > correction_data
```
If no such path was captured, then the --md option should receive the same marker log that was used in the first step, in this case the "True values" in the algorithm's plot shall be ignored.
# Run Algorithm
Will plot the result and also create a file "fixed_gvz.yml", which is the gvz yml with the new values for the theta
```
$ python script/algorithm.py --inter=mid_data --correction=correction_data
```
# Plotter
Plots a path. The --show option specifies which logs need to be included in the plot (m=marker, p=pose, c=ctrl, i=inter). The inter log can be obtained from the First Step.
```
$ python script/plotter.py --map=data/gvz_ext.yml --log=data/logs/20180516-134720 --show=mpci
```
...@@ -22,45 +22,38 @@ void build_tree(int node = 1, int a = 0, int b = N) { ...@@ -22,45 +22,38 @@ void build_tree(int node = 1, int a = 0, int b = N) {
build_tree(node * 2, a, (a + b) / 2); build_tree(node * 2, a, (a + b) / 2);
build_tree(node * 2 + 1, 1 + (a + b) / 2, b); build_tree(node * 2 + 1, 1 + (a + b) / 2, b);
tree[node] = tree[node * 2] + tree[node * 2 + 1]; tree[node] = tree[node * 2] + tree[node * 2 + 1];
} }
int modification(int a, int b, int val) {
return ((b - a) + 1) * val; void push(int node, int val) {
tree[node] += value;
if (a != b) {
lazy[node * 2] += val;
lazy[node * 2 + 1] += val;
}
lazy[node] = 0;
} }
// Update segment [i,j] by adding value val // Update segment [i,j] by adding value val
void update_tree(int i, int j, int val, int node = 1, int a = 0, int b = N) { void update_tree(int i, int j, int val, int node = 1, int a = 0, int b = N) {
if (lazy[node] != 0) { if (lazy[node] != 0)
tree[node] += modification(a, b, lazy[node]); push(node, lazy[node]);
if (a != b) {
lazy[node * 2] += lazy[node];
lazy[node * 2 + 1] += lazy[node];
}
lazy[node] = 0;
}
if (a > b || a > j || b < i) if (a > b || a > j || b < i)
return; return;
if (a >= i && b <= j) { if (a >= i && b <= j) {
tree[node] += modification(a, b, val); push(node, val);
if (a != b) {
lazy[node * 2] += val;
lazy[node * 2 + 1] += val;
}
return; return;
} }
update_tree(i, j, node * 2, a, (a + b) / 2); update_tree(i, j, node * 2, a, (a + b) / 2);
update_tree(i, j, node * 2 + 1, 1 + (a + b) / 2, b); update_tree(i, j, node * 2 + 1, 1 + (a + b) / 2, b);
tree[node] = tree[node * 2] + tree[node * 2 + 1]; tree[node] = tree[node * 2] + tree[node * 2 + 1];
} }
...@@ -71,14 +64,7 @@ int query_tree(int i, int j, int node = 1, int a = 0, int b = N) { ...@@ -71,14 +64,7 @@ int query_tree(int i, int j, int node = 1, int a = 0, int b = N) {
return 0; return 0;
if (lazy[node] != 0) { if (lazy[node] != 0) {
tree[node] += modification(a, b, lazy[node]); push(node, val);
if (a != b) {
lazy[node * 2] += lazy[node];
lazy[node * 2 + 1] += lazy[node];
}
lazy[node] = 0;
} }
if (a >= i && b <= j) if (a >= i && b <= j)
...@@ -86,6 +72,5 @@ int query_tree(int i, int j, int node = 1, int a = 0, int b = N) { ...@@ -86,6 +72,5 @@ int query_tree(int i, int j, int node = 1, int a = 0, int b = N) {
int q1 = query_tree(i, j, node * 2, a, (a + b) / 2); int q1 = query_tree(i, j, node * 2, a, (a + b) / 2);
int q2 = query_tree(i, j, node * 2 + 1, 1 + (a + b) / 2, b); int q2 = query_tree(i, j, node * 2 + 1, 1 + (a + b) / 2, b);
return q1 + q2; return q1 + q2;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment