-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MNT: Added a board representation of the ChArUco board
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class CharucoBoard: | ||
""" | ||
Representation of the Charuco Board | ||
Marker 0 is at the top left, origin is at the bottom left. | ||
Positive x goes from left to right, positive y goes upwards, positive z goes out of the board | ||
""" | ||
|
||
_board_marker_ids = list[int] | ||
_board_marker_positions = list[list[int]] | ||
|
||
def __init__(self): | ||
self._board_marker_ids = [] | ||
self._board_marker_positions = [] | ||
|
||
def _generate_board(self): | ||
for i in range(40): | ||
self._board_marker_ids.append(i) | ||
|
||
for marker_id in self._board_marker_ids: | ||
x_coords = [30.0, 70.0, 110.0, 150.0, 10.0, 50.0, 90.0, 130.0] | ||
x = x_coords[marker_id % 8] | ||
y = 190.0 - (marker_id // 4) * 20.0 | ||
z = 0.0 | ||
self._board_marker_positions.append([x, y, z]) | ||
|
||
def get_ids(self): | ||
self._generate_board() | ||
return self._board_marker_ids | ||
|
||
def get_positions(self): | ||
return self._board_marker_positions | ||
|