-
Notifications
You must be signed in to change notification settings - Fork 1
171 add odometry calibration tool #187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bb55b90 to
31363a8
Compare
ecourtois
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
Please check few comments anyway.
a8b96f4 to
849bb23
Compare
ecourtois
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check 3 new comments and you can merge once fixed.
cogip/models/firmware_parameter.py
Outdated
| @cache | ||
| def fnv1a_hash(string: str) -> int: | ||
| """Compute FNV-1a hash of a string. | ||
|
|
||
| Results are cached to avoid recomputing hashes for previously seen strings, | ||
| since parameter names are typically accessed repeatedly. | ||
|
|
||
| Args: | ||
| string: The string to hash | ||
|
|
||
| Returns: | ||
| The 32-bit hash value as an unsigned integer | ||
|
|
||
| Example: | ||
| >>> hex(fnv1a_hash("parameter")) | ||
| '0x100b' | ||
| """ | ||
| # FNV-1a constants | ||
| FNV_OFFSET_BASIS = 0x811C9DC5 | ||
| FNV_PRIME = 0x01000193 | ||
|
|
||
| hash_value = FNV_OFFSET_BASIS | ||
|
|
||
| for byte in string.encode("utf-8"): | ||
| hash_value ^= byte | ||
| hash_value = (hash_value * FNV_PRIME) & 0xFFFFFFFF # Keep it 32-bit | ||
|
|
||
| return hash_value | ||
|
|
||
|
|
||
| class FirmwareParameterBase(BaseModel): | ||
| """Base firmware parameter type""" | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This replacement must be done in the previous commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
| by communicating with the firmware via SocketIO through cogip-server. | ||
| """ | ||
|
|
||
| from __future__ import annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required using Python 3.13?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required with Python 3.13. Removed.
| "scikit-learn~=1.6.1", | ||
| "watchfiles==0.24.0", | ||
| "websocket-client==1.7.0", | ||
| "rich==14.2.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to commit uv.lock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rich already exist in the merged uv.lock so there is nothing new to commit.
Move fnv1a to utils folder because this is not a model and can be used everywhere. Add @cache decorator to avoid recomputing hashes for repeated parameter names. Parameter names are typically accessed multiple times during firmware communication and hashes never changes, so we can cache it during the whole execution lifetime.
- Align architecture with other tools implementation pattern - Enable integration within existing stack without conflicts - Add firmware_parameters namespace to server - Route parameter operations through copilot socket.io events This tool is designed to be used through another client as setting/getting parameter is useful for other tool integration.
- Define PB_Telemetry message schema for mcu-firmware data - Generate Python bindings and type stubs - Enable real-time monitoring of firmware internal state
- Enable parsing and validation of telemetry messages from firmware - Provide easy access to latest valid data by key or full message - Ensure data consistency with pydantic validation
- Enable firmware telemetry data broadcast to connected clients - Follow existing tools architecture for consistency - Allow embedding in other Socket.IO clients (Monitor, etc.) - Store telemetry in TelemetryStore with key/hash access
- Enable firmware telemetry broadcast to connected tools - Register /telemetry namespace for Planner, Monitor, Calibration tools - Support multiple concurrent client connections - Route telemetry events from copilot through server
- Enable tools to receive firmware telemetry via copilot Socket.IO - Register /telemetry namespace on host client connection - Store telemetry data in TelemetryStore with key/hash access - Design for embedding in Monitor, Calibration tools
- Enable calibration tools to send pose commands via Socket.IO - Allow remote control of robot pose during calibration process - Extend copilot event handling for calibration workflow
- Enable calibration tools to communicate via server Socket.IO - Route calibration commands between tools and copilot - Follow existing namespace architecture pattern
- Provide reusable terminal UI components for calibration tools
- Orchestrate calibration via Socket.IO connection to cogip-server - Coordinate firmware operations through FirmwareAdapter - Provide interactive user interface via ConsoleUI - Include calculation engine for odometry parameter tuning
849bb23 to
d402c69
Compare
Odometry Calibration Tool & Telemetry Infrastructure
This PR adds an interactive odometry calibration tool with the supporting telemetry infrastructure to enable real-time firmware monitoring.
Changes
Telemetry System
/telemetrynamespace on server for broadcasting to toolsFirmwareTelemetryManagerfor use in Calibration toolsCalibration Tool
/firmware_calibrationnamespace on server for tool-to-firmware communicationConsoleUIutilities for terminal-based tool interfacesFirmwareAdapterOther
Why
Closes #171