Skip to content

Conversation

@sca075
Copy link
Owner

@sca075 sca075 commented Jul 30, 2025

Correction of the angle for rand 256

@sca075 sca075 self-assigned this Jul 30, 2025
@sca075 sca075 requested a review from Copilot July 30, 2025 16:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR corrects the angle calculation for the Rand256 robot in the Valetudo map parser. The change improves how negative robot angles are converted to their positive equivalents and simplifies the overall angle transformation logic.

Key changes:

  • Simplified angle calculation algorithm for robot positioning
  • Added special handling for -180 degree angle to avoid 360 degree output
  • Updated version number to 0.1.9b60

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
pyproject.toml Version bump from 0.1.9b59 to 0.1.9b60
SCR/valetudo_map_parser/map_data.py Corrected robot angle calculation logic with improved negative angle handling


@staticmethod
def get_rrm_robot_angle(json_data: JsonType) -> tuple:
def get_rrm_robot_angle(json_data) -> tuple:
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parameter type annotation was removed. The function should maintain type safety by keeping the JsonType annotation for the json_data parameter.

Suggested change
def get_rrm_robot_angle(json_data) -> tuple:
def get_rrm_robot_angle(json_data: JsonType) -> tuple:

Copilot uses AI. Check for mistakes.
import numpy as np

from .config.types import ImageSize, JsonType
from .config.types import ImageSize, JsonType, LOGGER
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOGGER is imported but not used in the visible code changes. Consider removing unused imports to keep the code clean.

Suggested change
from .config.types import ImageSize, JsonType, LOGGER
from .config.types import ImageSize, JsonType

Copilot uses AI. Check for mistakes.
Comment on lines +313 to +316
if angle_c == -180:
angle = 359 # -180 becomes 359 (avoiding 360)
else:
angle = 360 + angle_c # -10 -> 350, -90 -> 270
Copy link

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The special case for -180 becoming 359 seems arbitrary. Consider whether this should follow the same conversion pattern as other negative angles (360 + angle_c = 180) for consistency.

Suggested change
if angle_c == -180:
angle = 359 # -180 becomes 359 (avoiding 360)
else:
angle = 360 + angle_c # -10 -> 350, -90 -> 270
angle = 360 + angle_c # Convert all negative angles consistently

Copilot uses AI. Check for mistakes.
Signed-off-by: Sandro Cantarella <sandro@fc694b21-8021-441f-8c0f-f58e8fc4533a.fritz.box>
Signed-off-by: Sandro Cantarella <sandro@fc694b21-8021-441f-8c0f-f58e8fc4533a.fritz.box>
@sca075 sca075 merged commit 69f2b72 into main Jul 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants