11 """Markers map generator 13 Generate map file for aruco_map nodelet. 16 genmap.py <length> <x> <y> <dist_x> <dist_y> [<first>] [<x0>] [<y0>] [--top-left | --bottom-left] 17 genmap.py (-h | --help) 20 <length> Marker side length 21 <x> Marker count along X axis 22 <y> Marker count along Y axis 23 <dist_x> Distance between markers along X axis 24 <dist_y> Distance between markers along Y axis 25 <first> First marker ID [default: 0] 26 <x0> X coordinate for the first marker [default: 0] 27 <y0> Y coordinate for the first marker [default: 0] 28 --top-left First marker is on top-left (default) 29 --bottom-left First marker is on bottom-left 32 rosrun aruco_pose genmap.py 0.33 2 4 1 1 0 > $(catkin_find aruco_pose map)/test_map.txt 35 from __future__
import print_function
37 from docopt
import docopt
40 arguments = docopt(__doc__)
42 length = float(arguments[
'<length>'])
43 first = int(arguments[
'<first>']
if arguments[
'<first>']
is not None else 0)
44 x0 = float(arguments[
'<x0>']
if arguments[
'<x0>']
is not None else 0)
45 y0 = float(arguments[
'<y0>']
if arguments[
'<y0>']
is not None else 0)
46 markers_x = int(arguments[
'<x>'])
47 markers_y = int(arguments[
'<y>'])
48 dist_x = float(arguments[
'<dist_x>'])
49 dist_y = float(arguments[
'<dist_y>'])
50 bottom_left = arguments[
'--bottom-left']
52 max_y = y0 + (markers_y - 1) * dist_y
54 print(
'# id\tlength\tx\ty\tz\trot_z\trot_y\trot_x')
55 for y
in range(markers_y):
56 for x
in range(markers_x):
57 pos_x = x0 + x * dist_x
58 pos_y = y0 + y * dist_y
61 print(
'{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}'.format(first, length, pos_x, pos_y, 0, 0, 0, 0))