Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WillB97 committed May 21, 2024
1 parent 62f061b commit 55220b3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions sbot/simulator/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ def __init__(self, camera_info: BoardInfo) -> None:

# Check the camera is connected
response = self._make_request("*IDN?")
if response.split(b":")[1].lower().startswith(b"cam"):
if not response.split(b":")[1].lower().startswith(b"cam"):
raise RuntimeError(f"Camera not connected to a camera, returned: {response}")

# Get the calibration data for this camera
response = self._make_request("CAM:CALIBRATION?")

# The calibration data is returned as a string of floats separated by colons
self.calibration = tuple(map(float, response.split(b":")[1].split(b":")))
self.calibration = tuple(map(float, response.split(b":")))
assert len(self.calibration) == 4, f"Invalid calibration data: {self.calibration}"

# Get the image size for this camera
response = self._make_request("CAM:RESOLUTION?")
self.image_size = tuple(map(int, response.split(b":")[1].split(b"x")))
self.image_size = tuple(map(int, response.split(b":")))
assert len(self.image_size) == 2, f"Invalid image dimensions: {self.image_size}"

def read(self, fresh: bool = True) -> NDArray:
Expand Down
2 changes: 1 addition & 1 deletion sbot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def get_simulator_boards(board_filter: str = '') -> list[BoardInfo]:
for board_data in simulator_data:
board_data = board_data.rstrip('/')
board_fragment, serial_number = board_data.rsplit('/', 1)
board_url, board_type = board_fragment.split('/', 1)
board_url, board_type = board_fragment.rsplit('/', 1)

board_info = BoardInfo(url=board_url, serial_number=serial_number, type_str=board_type)

Expand Down

0 comments on commit 55220b3

Please sign in to comment.