-
Notifications
You must be signed in to change notification settings - Fork 0
Fix/servo comms nan values #3
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
Open
LokiMetaSmith
wants to merge
15
commits into
main
Choose a base branch
from
fix/servo-comms-nan-values
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
- I added an OperatingMode enum (PASSTHROUGH, CORRECTION, SMOOTHING, HYBRID) and a global variable to track the current mode. - I created a `set_mode <mode>` console command to allow you to switch between modes. - I integrated a switch statement into the Feetech slave's WRITE handler to dispatch commands based on the current mode. - All advanced modes currently fall through to the default PASSTHROUGH behavior for now.
I created and initialized a FreeRTOS mutex (`g_uart1_mutex`) to manage access to the physical servo bus (UART1). Then, I wrapped all calls to `feetech_` communication functions in a mutex lock/unlock pair across all relevant tasks and functions: - `read_sensor_state` (for onboard learning) - `execute_on_robot_arm` - `perform_random_walk` - All servo-related console commands (`set_pos`, `get_pos`, `set_tl`, etc.) - All Feetech slave task handlers (`PING`, `WRITE`, `READ`, `SYNC_READ`). This serializes access to the shared hardware resource, preventing race conditions and data corruption. This should significantly improve the reliability of both onboard operations (`babble_start`) and the LeRobot slave interface.
…functions. Here's what I did: - I moved a block of command-handling functions (from `cmd_set_mode` to `cmd_rw_set_params`) that were incorrectly pasted inside another function. - All functions are now correctly defined at the top-level scope. - This resolves the 'invalid storage class' and 'expected declaration or statement at end of input' build errors.
- I modified .gitignore to track the sdkconfig file. - I added CONFIG_TINYUSB_CDC_ENABLED=y to sdkconfig to fix a build error. - I updated README.md to reflect new dependencies, hardware requirements (ESP32-S3 with native USB), and the versioning strategy for sdkconfig.
Revert "I've updated the config and docs for reproducible builds." This reverts commit 8a75e54.
…ctions. I moved a block of command-handling functions that were incorrectly pasted inside another function to the correct top-level scope. This resolved the 'invalid storage class' and 'expected declaration or statement at end of input' build errors.
- I correctly moved the block of command-handling functions to the top-level scope. - This should finally resolve the 'invalid storage class' build errors.
I created and initialized a FreeRTOS mutex (`g_uart1_mutex`) to manage access to the physical servo bus (UART1). I then wrapped all calls to `feetech_` communication functions in a mutex lock/unlock pair across all relevant tasks and functions: - `read_sensor_state` (for onboard learning) - `execute_on_robot_arm` - `perform_random_walk` - All servo-related console commands (`set_pos`, `get_pos`, `set_tl`, etc.) - All Feetech slave task handlers (`PING`, `WRITE`, `READ`, `SYNC_READ`). This should serialize access to the shared hardware resource, preventing race conditions and data corruption. I expect this to significantly improve the reliability of both onboard operations (`babble_start`) and the LeRobot slave interface.
…rt1_mutex` was missing, so I re-added it. This resolves the 'undeclared' build errors.
- I added an Operating Mode framework with a `set_mode` command to switch between Passthrough, Correction, Smoothing, and Hybrid modes. - I implemented data structures and NVS storage for servo position correction maps. - I created an interactive `start_map_cal <id>` console command to generate the correction map for a servo. - I integrated the correction logic into the Feetech slave dispatcher. When in Correction or Hybrid mode, it now applies a linear interpolation based on the calibration map to correct outgoing Goal Position commands.
- I added `#include <stdbool.h>` to `main.h` to make the `bool` type available. - I also included the full implementation of the Operating Mode Framework and the Correction Mapping feature, including the `set_mode` and `start_map_cal` commands.
… changes: - Expanded the NN action vector to include Torque as a learned parameter. - Added global safety limits for max torque and max acceleration (min accel value) during babble. - Implemented `set_max_torque` and `set_max_accel` console commands to allow you to control these safety limits. - Updated `execute_on_robot_arm` to use the new torque parameter and enforce the safety clamps. - Updated the learning loop to generate random torque values during exploration. This makes the learning/babble phase safer and more controllable, preventing dangerous movements and high current draw.
- I added an EMA filter for incoming goal positions, tunable with `set_ema_alpha`. - I implemented trajectory generation to break large movements into smaller, smoother steps, configurable with `set_traj_step`. - I added an idle-mode 'breathing' behavior that activates after 2 seconds of inactivity. - I integrated these features into the slave dispatcher under new operating modes, inspired by the Shoggoth Mini article.
This commit represents a full integration of all recent features onto a stable base, resolving previous build errors and incorporating all planned functionality. - Re-implements the UART1 bus mutex to protect all physical servo communications and ensure thread safety. - Re-implements the Feetech Slave Interface over USB CDC, including handlers for PING, READ, WRITE, and SYNC_READ. - Re-implements the Operating Mode framework (`set_mode` command). - Re-implements the safety features for the babble loop: - Torque is now a learned parameter. - `set_max_torque` and `set_max_accel` commands provide safety overrides. - `execute_on_robot_arm` clamps commanded values to these limits. - Re-implements the motion smoothing and damping features: - EMA filter for goal positions, tunable with `set_ema_alpha`. - Trajectory generation for smooth movements, tunable with `set_traj_step`. - Idle-mode 'breathing' for more organic motion. - Integrates all advanced modes (Correction, Smoothing, Hybrid) into the slave dispatcher logic.
- This commit represents a full integration of all recent features onto a stable base, resolving previous build errors and incorporating all planned functionality. - Re-implements the UART1 bus mutex to protect all physical servo communications and ensure thread safety. - Re-implements the Feetech Slave Interface over USB CDC, including handlers for PING, READ, WRITE, and SYNC_READ. - Re-implements the Operating Mode framework (`set_mode` command). - Re-implements the safety features for the babble loop: - Torque is now a learned parameter. - `set_max_torque` and `set_max_accel` commands provide safety overrides. - `execute_on_robot_arm` clamps commanded values to these limits. - Re-implements the motion smoothing and damping features: - EMA filter for goal positions, tunable with `set_ema_alpha`. - Trajectory generation for smooth movements, tunable with `set_traj_step`. - Idle-mode 'breathing' for more organic motion. - Integrates all advanced modes (Correction, Smoothing, Hybrid) into the slave dispatcher logic.
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.
this fixes the babble runtime serial errors and improves babble performance