fix: use full-range field maps and field-aware kickoff positioning - #1064
Draft
jaagut wants to merge 2 commits into
Draft
fix: use full-range field maps and field-aware kickoff positioning#1064jaagut wants to merge 2 commits into
jaagut wants to merge 2 commits into
Conversation
Member
Author
|
Regeneration recipe (kept here rather than shipped in the repository): Run this from the repository root through """Regenerate distance maps from saved generator inputs.
Run through Pixi with the soccer_field_map_generator package on PYTHONPATH.
Legacy fields without generator inputs retain their existing map geometry.
"""
from pathlib import Path
import cv2
import numpy as np
import yaml
from soccer_field_map_generator.generator import generate_map_image
ROOT = Path("src/bitbots_misc/bitbots_parameter_blackboard/config/fields")
def main():
for directory in sorted(ROOT.iterdir()):
source = directory / "gui-config.yaml"
if directory.name == "hsl_kid":
source = directory / "hsl_kid.yaml"
output = directory / "lines.png"
if source.exists():
parameters = yaml.safe_load(source.read_text())["parameters"]
image = generate_map_image(parameters)
elif output.exists():
image = cv2.imread(str(output), cv2.IMREAD_UNCHANGED)
if image.max() == 100:
image = np.rint(image.astype(float) * 255 / 100).astype(np.uint8)
else:
continue
if not cv2.imwrite(str(output), image):
raise OSError(f"Could not write {output}")
if __name__ == "__main__":
main()Fields with saved generator inputs are regenerated; legacy maps are rescaled without changing geometry. Demo has no map. The full-range auxiliary binary images were already correctly encoded. Existing blackboard goal-depth overrides are preserved. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Field maps previously encoded grayscale values in 0–100. This migrates all nine localization maps to 0–255 and updates localization to normalize inverted byte intensities correctly. OccupancyGrid output remains 0–100, out-of-field score parameters retain their percentage semantics, and measurement marker colors use the normalized score directly.
Adds
field.markings.center_circle.diameterto every field config. During opponent kickoff preparation (READY/SET), the central offense player usescircle radius + kickoff_striker_circle_marginas its distance behind the center. The margin defaults to 0.4 m. This applies only to normal/extra-time kickoff preparation with no other set play active. Other role positions and formation/set-play clearance retain their existing behavior.Maps with saved generator inputs were regenerated as distance maps. Legacy maps without inputs were rescaled to preserve raster geometry; demo has no map. Every map retains its dimensions and exact zero-valued line mask. Existing goal-depth overrides remain intact. Circle diameters come from saved inputs or legacy raster geometry; demo declares no circle. The regeneration recipe is provided in this PR comment, rather than shipped as a tool.
Related upstream drafts:
Validation through Pixi:
No robot or simulator runtime validation was performed.