Repository navigation
fix(blocks): DiffSteer NameError and VehiclePlot shared defaults, with types and docstrings - #775
Merged
Merged
Conversation
The default branch for x0 used the misspelt name slef, so DiffSteer() without x0 could not be created. Bicycle and Unicycle were fine. A test constructs each of the three vehicle blocks without x0. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…iclePlot shared defaults
File review of blocks/mobile.py, following the NameError fix:
- x0 is validated and converted with base.getvector, so a wrong length is a
ValueError (was an assert) and the stored state is an ndarray, not whatever
was passed
- VehiclePlot: polyargs={} and labels=[...] were mutable defaults and polyargs
was updated in place, so a size given to one VehiclePlot leaked into every
later one; now copied. An ndarray scale crashed; a [min, max] scale is
applied to both axes for any sequence. Removed a leftover print('done')
- types: ArrayLike3, R3, float, Callable[[Axes], None], SimulationState instead
of Any
- docstrings: wrong defaults for DiffSteer speed_max and steer_max, 'Inital',
Diffsteer class reference, .. deprecated:: with its version (1.4.0),
redundant :type: lines removed, :raises: added
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
It was never read and nothing in RTB or RVC3 passes it. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 high |
🟢 Metrics 82 complexity · 13 duplication
Metric Results Complexity 82 Duplication 13
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #775 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 143 143
Lines 14663 14671 +8
=====================================
- Misses 14663 14671 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…cated path -> path_style, init -> init_func, scale -> limits (it is the axis limits, and clashed with VehiclePolygon's scale, which is the vehicle size), polyargs -> polygon_style. The old names still work and warn. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
What
A fix and a review of
blocks/mobile.py(the bdsim vehicle blocks).Bugs fixed
DiffSteer()withoutx0raisedNameError(slefforself), so the block could not be created with its default.BicycleandUnicyclewere fine.VehiclePlothad mutable default arguments (polyargs={},labels=[...]) and updatedpolyargsin place, so asizegiven to oneVehiclePlotleaked into every later one.VehiclePlot(scale=<ndarray>)crashed onscale != "auto". Any sequence is accepted now; a[min, max]applies to both axes.x0was checked with anassert(skipped under-O) and stored as given. It is now converted and checked withbase.getvector: a wrong length is aValueErrorand the state is always an ndarray.print("done")inVehiclePlot.startis removed.Removed
The unused
aargument of theDiffSteerblock. Nothing in RTB or the RVC3 notebooks and figure scripts passes it.Types and docstrings
ArrayLike3,R3,float,Callable[[Axes], None]and bdsim'sSimulationStatereplaceAny.DiffSteerblock (speed_max,steer_max), "Inital", a misspelt class reference,.. deprecated::with its version (1.4.0), redundant:type:lines removed,:raises:added.Testing
Ten new tests in
MobileBlockTest, each of which failed before its fix. The vehicle-block calls in the RVC3 figure scripts still work (x0as list or array,scale=[0, 10],size,shape,init). mypy is clean.Renamed (old names deprecated, still work)
VehiclePlot:path→path_style,init→init_func,scale→limits(it is the axis limits, and clashed withVehiclePolygon'sscale, the vehicle size),polyargs→polygon_style. See petercorke/rvc-ecosystem#15 for the convention.🤖 Generated with Claude Code