-
Notifications
You must be signed in to change notification settings - Fork 135
Pure Pursuit Controller Implementation + Lane Error calculation Script #357
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
base: ScenicControllers
Are you sure you want to change the base?
Pure Pursuit Controller Implementation + Lane Error calculation Script #357
Conversation
Eric-Vin
left a comment
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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'
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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
pytestand/or other meansAdditional 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