Skip to content

Newtonian Simulator Fixes and Cleanup#309

Merged
dfremont merged 5 commits intomainfrom
Issue304Fix
Nov 5, 2024
Merged

Newtonian Simulator Fixes and Cleanup#309
dfremont merged 5 commits intomainfrom
Issue304Fix

Conversation

@Eric-Vin
Copy link
Copy Markdown
Collaborator

@Eric-Vin Eric-Vin commented Oct 25, 2024

Description

This PR fixes several issues with the Newtonian simulator:

  • Previously scaling was done per dimension, warping the objects.
  • Objects were being drawn to a position that did not account for their rotation, leading to incorrect images and wobbling.
  • Car dimensions are no longer hard-coded and are now drawn from the object's width and height on a per-object basis.
  • Added a debug global parameter debugRender that always draws polygons to help verify that cars (or any future objects) are being drawn correctly.
  • General code cleanup, removing several unused lines.

Issue Link

This will resolve Issue #304.

Checklist

  • I have tested the changes locally via pytest and/or other means
  • I have added or updated relevant documentation
  • I have autoformatted the code with black and isort
  • I have added test cases (if applicable)

Additional Notes

To verify that this resolves Issue #304, run an example Scenic program with the debugRenderer parameter set to True. An example is included below:
scenic examples/driving/badlyParkedCarPullingIn.scenic --2d --simulate --model scenic.simulators.newtonian.driving_model --time 200 --count 1 -p debugRender True

I've also included several screenshots showing the correct behavior which is now present:
Screenshot from 2024-10-25 11-15-48
Screenshot from 2024-10-25 11-15-45

@Eric-Vin Eric-Vin requested a review from dfremont October 25, 2024 19:06
@Eric-Vin Eric-Vin linked an issue Oct 25, 2024 that may be closed by this pull request
3 tasks
@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.37%. Comparing base (0abbbcd) to head (77c9605).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/scenic/simulators/newtonian/simulator.py 96.87% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #309      +/-   ##
==========================================
- Coverage   91.37%   91.37%   -0.01%     
==========================================
  Files          54       54              
  Lines       13544    13555      +11     
==========================================
+ Hits        12376    12386      +10     
- Misses       1168     1169       +1     
Files with missing lines Coverage Δ
src/scenic/simulators/newtonian/simulator.py 90.00% <96.87%> (+0.05%) ⬆️

... and 2 files with indirect coverage changes

Comment thread src/scenic/simulators/newtonian/simulator.py
Comment thread src/scenic/simulators/newtonian/simulator.py
Copy link
Copy Markdown
Collaborator

@dfremont dfremont left a comment

Choose a reason for hiding this comment

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

Looks great, just one tiny fix and a question.

@Eric-Vin Eric-Vin requested a review from dfremont November 4, 2024 21:27
@dfremont dfremont merged commit 4ae8ee2 into main Nov 5, 2024
@dfremont dfremont deleted the Issue304Fix branch November 5, 2024 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cars in NewtonianSimulator do not always get rendered on correct coordinates

2 participants