Repository navigation
Conversation
Concatenate the outlines of the 8 vehicle parts with NaN separators and draw them with one Axes.plot call per frame, instead of one call per part. Part of ShisatoYano#120 (Step 1)
This branch has not been deployed
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.
Summary
Step 1 of #120: draw the vehicle with a single
Axes.plotcall per frame instead of one call per part.Body,Chassis, the 4 tires and the 2 axles) now exposes its pose-transformed outline throughtransformed_outline()instead of plotting it itself.FourWheelsVehicle.draw()concatenates the 8 outlines with NaN separators (newXYArray.concatenate()) and issues oneAxes.plotcall for the whole vehicle, with the same line style as before.draw(axes, elems)contract of the components registered withGlobalXYVisualizeris unchanged, so Step 2 (reusing plot objects withset_data()) can be done component by component later.test_rear_axle.pywas updated to the new part-level API; itsMockAxesis no longer needed because the part no longer plots by itself.Part of #120 (Step 2 is left for a follow-up).
How I checked it works
bash run_test_suites.sh(pytest with the Agg backend): 130 passed after the change, same as before it.Runtime of
pure_pursuit_path_trackingin test mode (show_plot = False, 251 frames, best of repeated runs, macOS, Python 3.11, matplotlib 3.8):Axes.plotcalls per frameFourWheelsVehicle.drawshare of profiled runtimeOutput equivalence: frames 10, 100, 200 and 250 rendered before and after are the same except 0.006-0.011% of the pixels, all on the anti-aliased edges of the vehicle lines (every differing pixel is adjacent to a line stroke; max channel delta 56).
Images
Last frame of
pure_pursuit_path_tracking, before / after (the refactoring keeps the output the same):Vehicle zoom at frame 100, before (left) vs after (right):
Book