Skip to content
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

Newtonian Simulator Fixes and Cleanup #309

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Newtonian Simulator Fixes and Cleanup #309

wants to merge 5 commits into from

Conversation

Eric-Vin
Copy link
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 linked an issue Oct 25, 2024 that may be closed by this pull request
3 tasks
Copy link

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 1 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

Copy link
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.

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