From 351b33cc5ffe815d9156987f1536f42e285d658f Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Fri, 6 Mar 2020 02:04:19 +0300 Subject: [PATCH] genmap.py: make top-left by default (#220) * genmap.py: make top-left by default * docs: make top left by default in genmap * genmap.py: fix usage string --- aruco_pose/src/genmap.py | 21 +++++++++++---------- docs/en/aruco_map.md | 2 +- docs/ru/aruco_map.md | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/aruco_pose/src/genmap.py b/aruco_pose/src/genmap.py index 0bc6fbca..25898887 100755 --- a/aruco_pose/src/genmap.py +++ b/aruco_pose/src/genmap.py @@ -13,17 +13,18 @@ Generate map file for aruco_map nodelet. Usage: - genmap.py [--top-left] + genmap.py [--top-left | --bottom-left] genmap.py (-h | --help) Options: - Marker side length - Marker count along X axis - Marker count along Y axis - Distance between markers along X axis - Distance between markers along Y axis - First marker ID - --top-left First marker is on top-left (not bottom-left) + Marker side length + Marker count along X axis + Marker count along Y axis + Distance between markers along X axis + Distance between markers along Y axis + First marker ID + --top-left First marker is on top-left (default) + --bottom-left First marker is on bottom-left """ from __future__ import print_function @@ -39,7 +40,7 @@ markers_x = int(arguments['']) markers_y = int(arguments['']) dist_x = float(arguments['']) dist_y = float(arguments['']) -top_left = arguments['--top-left'] +bottom_left = arguments['--bottom-left'] max_y = (markers_y - 1) * dist_y @@ -47,7 +48,7 @@ for y in range(markers_y): for x in range(markers_x): pos_x = x * dist_x pos_y = y * dist_y - if top_left: + if not bottom_left: pos_y = max_y - pos_y print('{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t'.format(first, length, pos_x, pos_y, 0, 0, 0, 0)) first += 1 diff --git a/docs/en/aruco_map.md b/docs/en/aruco_map.md index a17d758d..c515db42 100644 --- a/docs/en/aruco_map.md +++ b/docs/en/aruco_map.md @@ -53,7 +53,7 @@ Grid maps may be generated using the `genmap.py` script: rosrun aruco_pose genmap.py length x y dist_x dist_y first > ~/catkin_ws/src/clever/aruco_pose/map/test_map.txt ``` -`length` is the size of each marker, `x` is the marker count along the *x* axis, `y` is the marker count along the *y* axis, `dist_x` is the distance between the centers of adjacent markers along the *x* axis, `dist_y` is the distance between the centers of the *y* axis, `first` is the ID of the first marker (bottom left marker, unless `--top-left` is specified), `test_map.txt` is the name of the generated map file. The optional `--top-left` parameter changes the numbering of markers, making the top left marker the first one. +`length` is the size of each marker, `x` is the marker count along the *x* axis, `y` is the marker count along the *y* axis, `dist_x` is the distance between the centers of adjacent markers along the *x* axis, `dist_y` is the distance between the centers of the *y* axis, `first` is the ID of the first marker (top left marker, unless `--bottom-left` is specified), `test_map.txt` is the name of the generated map file. The optional `--bottom-left` parameter changes the numbering of markers, making the bottom left marker the first one. Usage example: diff --git a/docs/ru/aruco_map.md b/docs/ru/aruco_map.md index 94daffc1..5d50254d 100644 --- a/docs/ru/aruco_map.md +++ b/docs/ru/aruco_map.md @@ -53,7 +53,7 @@ id_маркера размер_маркера x y z угол_z угол_y уго rosrun aruco_pose genmap.py length x y dist_x dist_y first > ~/catkin_ws/src/clever/aruco_pose/map/test_map.txt ``` -Где `length` – размер маркера, `x` – количество маркеров по оси *x*, `y` - количество маркеров по оси *y*, `dist_x` – расстояние между центрами маркеров по оси *x*, `y` – расстояние между центрами маркеров по оси *y*, `first` – ID первого (левого нижнего) маркера, `test_map.txt` – название файла с картой. Дополнительный ключ `--top-left` позволяет нумеровать маркеры с левого верхнего угла. +Где `length` – размер маркера, `x` – количество маркеров по оси *x*, `y` - количество маркеров по оси *y*, `dist_x` – расстояние между центрами маркеров по оси *x*, `y` – расстояние между центрами маркеров по оси *y*, `first` – ID первого (левого нижнего) маркера, `test_map.txt` – название файла с картой. Дополнительный ключ `--bottom-left` позволяет нумеровать маркеры с левого нижнего угла. Пример: