From: zer0 Date: Sun, 7 Mar 2010 19:31:08 +0000 (+0100) Subject: tourel beacon X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=657979175089eef7f2de8918b6bff47dbd08f2e2;p=aversive.git tourel beacon --- diff --git a/projects/microb2010/tests/tourel_beacon/graph.py b/projects/microb2010/tests/tourel_beacon/graph.py index bee4540..4d71030 100644 --- a/projects/microb2010/tests/tourel_beacon/graph.py +++ b/projects/microb2010/tests/tourel_beacon/graph.py @@ -332,6 +332,15 @@ def do_graph_2d_ad_error(): title += "d'angle de %s deg et dist de %s %% (algo %s)"%(a, d, i) do_graph_2d(data, "error_da_%s_%s_%s.png"%(i, d, a), title) +def do_graph_2d_ad_error_mm(): + for d in ["5", "10", "20"]: + for a in ["0.0", "0.1", "0.5", "1.0"]: + print "do_graph_2d_ad_error_mm 0 %s %s"%(d, a) + data = get_data("./main da_error_mm 0 %s -%s"%(d, a)) + title = 'Erreur de position en mm, pour une erreur\n' + title += "d'angle de %s deg et dist de %s mm"%(a, d) + do_graph_2d(data, "error_da_%smm_%s.png"%(d, a), title) + def do_graph_2d_move_error(): i = 0 for period in [ 20, 40 ]: @@ -358,4 +367,5 @@ def do_graph_2d_move_error(): #do_random_test() #do_graph_2d_simple_error() #do_graph_2d_move_error() -do_graph_2d_ad_error() +#do_graph_2d_ad_error() +do_graph_2d_ad_error_mm() diff --git a/projects/microb2010/tests/tourel_beacon/main.c b/projects/microb2010/tests/tourel_beacon/main.c index 8c14f41..90fa109 100644 --- a/projects/microb2010/tests/tourel_beacon/main.c +++ b/projects/microb2010/tests/tourel_beacon/main.c @@ -529,14 +529,17 @@ int main(int argc, char **argv) } /* da_error algo errpercent errdeg */ - if (argc == 5 && strcmp(mode, "da_error") == 0) { + if ((argc == 5 && strcmp(mode, "da_error") == 0) || + (argc == 5 && strcmp(mode, "da_error_mm") == 0)) { int x, y, algo; double err_val_deg; double err_val_percent; + double err_val_mm; double err, d0, d1, a; algo = atoi(argv[2]); err_val_percent = atof(argv[3]); /* how many % of error for dist */ + err_val_mm = atof(argv[3]); /* how many mm of error for dist */ err_val_deg = atof(argv[4]); /* how many degrees of error */ for (x=0; x<300; x++) { @@ -547,9 +550,15 @@ int main(int argc, char **argv) posxy_to_abs_angles(pos, &a0, &a1, &a2, 0, err_val_deg); d0 = pt_norm(&pos, &beacon0); - d0 += d0 * err_val_percent / 100.; d1 = pt_norm(&pos, &beacon1); - d1 += d1 * err_val_percent / 100.; + if (strcmp(mode, "da_error") == 0) { + d0 += d0 * err_val_percent / 100.; + d1 += d1 * err_val_percent / 100.; + } + else { + d0 += err_val_mm; + d1 += err_val_mm; + } if (ad_to_posxya(&tmp, &a, algo, &beacon0, &beacon1, a0, a1, d0, d1) < 0)