Skip to content

Commit

Permalink
MNT: Added a board representation of the ChArUco board
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampex1 committed Jun 19, 2024
1 parent 3586525 commit 90b4b9a
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/board_builder/structures/charuco_board.py
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

0 comments on commit 90b4b9a

Please sign in to comment.