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

Cars in NewtonianSimulator do not always get rendered on correct coordinates #304

Closed
3 tasks done
JACY24 opened this issue Sep 19, 2024 · 1 comment · Fixed by #309
Closed
3 tasks done

Cars in NewtonianSimulator do not always get rendered on correct coordinates #304

JACY24 opened this issue Sep 19, 2024 · 1 comment · Fixed by #309
Labels
type: bug Something isn't working type: simulator Issue regarding a simulator

Comments

@JACY24
Copy link

JACY24 commented Sep 19, 2024

System Details

  1. Pytthon 3.10.8
  2. Scenic 3.0.0
  3. Microsoft Windows Version 23H2
  4. Newtonian simulator (the built in version)

Detailed Description

  1. When running a simulation with the newtonian simulator, the cars seem to not always get rendered on the location that they say they are. In the simulator, there is an if-else statement that draws a car if an object is a car and a polygon otherwise. I tried removing this statement and just drawing both, and the two do not overlap in the rendered simulation, see the screenshots.
  2. I ran scenic examples/driving/badlyParkedCarPullingIn.scenic --2d --simulate --model scenic.simulators.newtonian.driving_model --time 200
  3. scenario
    scenario_1

Steps To Reproduce

  1. Open Scenic\src\scenic\simulators\newtonian\simulator.py
  2. Go to line 217
  3. Replace the if-statement with:
            # if hasattr(obj, "isCar") and obj.isCar:
            self.rotated_car = pygame.transform.rotate(
                self.car, math.degrees(obj.heading)
            )
            self.screen.blit(self.rotated_car, (rect_x, rect_y))
            # else:
            corners = [self.scenicToScreenVal(corner) for corner in obj._corners2D]
            pygame.draw.polygon(self.screen, color, corners)

The only thing this should do is draw both a Polygon and a car, the logic of the location should not be changed.
4. In the terminal, run scenic examples/driving/badlyParkedCarPullingIn.scenic --2d --simulate --model scenic.simulators.newtonian.driving_model --time 200
6. See the resulting error

Issue Submission Checklist

  • I am reporting an issue, not asking a question
  • I checked the open and closed issues, forum, etc. and have not found any solution
  • I have provided all necessary code, etc. to reproduce the issue
@JACY24 JACY24 added status: triage Issue needs to be assessed type: bug Something isn't working labels Sep 19, 2024
@Eric-Vin Eric-Vin added type: simulator Issue regarding a simulator and removed status: triage Issue needs to be assessed labels Oct 16, 2024
@Eric-Vin
Copy link
Collaborator

Apologies for the late response! This definitely looks incorrect: I'll figure out what's wrong and make a patch.

@Eric-Vin Eric-Vin linked a pull request Oct 25, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working type: simulator Issue regarding a simulator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@Eric-Vin @JACY24 and others