Skip to content

Conversation

@aryavenkatesan
Copy link

@aryavenkatesan aryavenkatesan commented Jul 3, 2025

Description

Added a new simulation file for testing purposes. Added code to behaviors.scenic, simulators.py, and controllers.py in src/scenic/domains/driving.

Issue Link

N/A

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

Will refine the algorithm within this branch. Once quality is reached, I will autoformat everything and add the proper documentation before attempting to merge this branch to main.

Here is some footage of the algorithm in action: https://drive.google.com/file/d/1MYkoEuXbe4OmTyklxB5KJ-kcIxRbGGbJ/view?usp=sharing

@Eric-Vin Eric-Vin self-requested a review August 2, 2025 12:07
Copy link
Collaborator

@Eric-Vin Eric-Vin left a comment

Choose a reason for hiding this comment

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

Looking good so far! There are a few changes we should make to the code, and we need to add tests (ensuring we get as close to 100% coverage of new lines as possible) and ideally we should move the CSV-based plots to a Python script that we can put under utils.


param map = localPath('../../assets/maps/CARLA/Town05.xodr')
param carla_map = 'Town05'
param time_step = 1.0/10
Copy link
Collaborator

Choose a reason for hiding this comment

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

A more reliable way to get timestep length in Scenic is to use the simulation function, and then accessing the timestep property (see here). Note that this can only be done at simulation time, but that's probably the only time you need to get the timestep anyway.

Copy link
Author

@aryavenkatesan aryavenkatesan Aug 2, 2025

Choose a reason for hiding this comment

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

This code was copied from Scenic/examples/driving/badlyParkedCarPullingIn.scenic- I can make changes to this if you want me to.

pid_err.csv Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of CSVs, I think we should go with a Python script that runs Scenic programs live and then generates a plot in matplotlib. That way we don't have these bulky files in the repo, and if we run the benchmarks we know the results are relevant to the current state of the code.

# Sometimes no point is found, this is an error
# In that case, dont touch steering wheel
# Pure Pursuit is a self correcting algorithm so it should be fine
cte = self.past_cte
Copy link
Collaborator

Choose a reason for hiding this comment

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

How do we handle reaching the end of a desired trajectory? We might want to add some proper handling for this. Any thoughts @psduggirala?

return lon_controller, lat_controller

def getPurePursuitControllers(self, agent, cl = 4.5, ld = 7, clwbr = 0.65):
dt = self.timestep
Copy link
Collaborator

Choose a reason for hiding this comment

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

As above, let's grab this directly from simulator().timestep

Copy link
Author

Choose a reason for hiding this comment

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

I changed this to dt = Simulation.timestep and got AttributeError: type object 'Simulation' has no attribute 'timestep'

Copy link
Author

Choose a reason for hiding this comment

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

Also, simulator is an undefined variable

Copy link
Author

Choose a reason for hiding this comment

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

make this being passed from scenic to python

@aryavenkatesan aryavenkatesan changed the title Initial Pure Pursuit implementation using binary search Pure Pursuit Controller Implementation + Lane Error calculation Script Aug 11, 2025
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.

2 participants