Skip to content

Conversation

@phmbressan
Copy link
Collaborator

@phmbressan phmbressan commented Sep 20, 2025

Pull request type

  • Code changes (bugfix, features)

Checklist

  • Tests for the changes have been added. Note: could be expanded
  • Docs have been reviewed and added / updated
  • Lint (make format && make pylint) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

Controllers are not correctly encoded nor decoded; this is especially regarding rockets with AirBrakes which are currently not exportable to an .rpy file. Sensors are also not correctly decoded.

New behavior

This PR brings the encoding and decoding of Controller and Sensor classes. The main challenge for it is that the Controllers observe a set of interactable_objects, which must be the same ones as the ones added to the Rocket.

It is important to note that a naive decoding would create a copy of the interactable_objects. Therefore, hashes were added to the signature of rocketpy objects so as to allow linking them after the decoding to the correct controller.

Retro compatibility should be carefully examined, but it was taken into consideration when writing this PR. The test that uses an v1.8 .rpy file is passing normally.

Breaking change

  • Yes
  • No

@phmbressan phmbressan added this to the Release v1.X.0 milestone Sep 20, 2025
@phmbressan phmbressan self-assigned this Sep 20, 2025
@phmbressan phmbressan added the Enhancement New feature or request, including adjustments in current codes label Sep 20, 2025
@phmbressan phmbressan requested a review from a team as a code owner September 20, 2025 19:23
@phmbressan phmbressan added Controllers Controlling rocket flight methods Outputs Dedicated to visualizations enhancements like prints and plots labels Sep 20, 2025
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

LGTM,

great work.

Can yoiu check if all the modified lines are included in coverage? tks for the improvement

@github-project-automation github-project-automation bot moved this from Backlog to Next Version in LibDev Roadmap Sep 20, 2025
@codecov
Copy link

codecov bot commented Sep 21, 2025

Codecov Report

❌ Patch coverage is 86.48649% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.09%. Comparing base (f17893b) to head (c7e94f8).
⚠️ Report is 24 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/rocket/aero_surface/fins/fins.py 28.57% 5 Missing ⚠️
rocketpy/_encoders.py 76.47% 4 Missing ⚠️
rocketpy/control/controller.py 86.36% 3 Missing ⚠️
rocketpy/tools.py 84.61% 2 Missing ⚠️
rocketpy/rocket/rocket.py 94.73% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #849      +/-   ##
===========================================
+ Coverage    80.02%   80.09%   +0.07%     
===========================================
  Files           98      103       +5     
  Lines        12004    12634     +630     
===========================================
+ Hits          9606    10119     +513     
- Misses        2398     2515     +117     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@phmbressan
Copy link
Collaborator Author

phmbressan commented Sep 21, 2025

LGTM,

great work.

Can yoiu check if all the modified lines are included in coverage? tks for the improvement

Could you @Gui-FernandesBR re-review the changes I made to the .git actions? The tkinter and tcl errors were happening in the windows actions for unknown reasons to me (always these libraries). I tried an experimental test with a non-interative matplotlib backend and everything seem to have run smoothly.

@phmbressan phmbressan force-pushed the enh/controller-encoding branch from 789fb3b to 759e1c2 Compare September 22, 2025 10:09
@phmbressan phmbressan merged commit 8c82c3a into develop Sep 22, 2025
10 checks passed
@phmbressan phmbressan deleted the enh/controller-encoding branch September 22, 2025 13:44
@github-project-automation github-project-automation bot moved this from Next Version to Closed in LibDev Roadmap Sep 22, 2025
uniKorqi422 added a commit to uniKorqi422/RocketPy that referenced this pull request Oct 14, 2025
* ENH: add an option to discretize callable sources encoding.

* ENH: allow for disallowing pickle on encoding.

* MNT: Update CHANGELOG.

* ENH: support for air brakes, controller and sensors encoding.

* STY: solve linting and style remarks.

* BUG: parachute callbacks attribute naming.

* GIT: test agg backend for matplotlib workflows.

* TST: include sensors and controllers encoding tests as non slow.

* MNT: change recursive to iterative approach on hash search.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Controllers Controlling rocket flight methods Enhancement New feature or request, including adjustments in current codes Outputs Dedicated to visualizations enhancements like prints and plots

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

3 participants