-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
tools/sim: Implement MetaDrive
simulator
#27373
Conversation
self.params.put_bool("WideCameraOnly", not arguments.dual_camera) | ||
self.params.put_bool("DisengageOnAccelerator", True) |
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.
Should we add this...?
Hmmm... But anw we can't throttle_out
while openpilot selfdrive is running...
Nice job! Some quick comments until I have some time to properly run and review this:
This is my rough plan for openpilot simulator support:
We're still in step 1, which I expect will take a bit of time. |
img = np.frombuffer(image.raw_data, dtype=np.dtype("uint8")) | ||
img = np.reshape(img, (H, W, 4)) | ||
img = img[:, :, [0, 1, 2]].copy() | ||
def cam_send_yuv_wide_road(self, yuv): |
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.
we don't really need this anymore... (plus there's no point sending an image twice - except maybe to keep openpilot happy? Getting some CommIssue
alerts now and again...
8ffa275
to
1899b41
Compare
Done, done. CARLA bridge is already factored.
The integration test is not going perfectly on local due to
Could you explain this in greater detail? My plan:Regarding MetaDrive simulator:
Blocked on:
|
@@ -1,553 +1,24 @@ | |||
#!/usr/bin/env python3 |
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.
If I rename this file run_bridge.py
, the line-by-line changes between bridge.py/common.py
would be easier to review. The reviewer can let me know if they prefer this. Then when we merge, we can rename to bridge.py.
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.
renamed to run_bridge.py
for now. Let's close this thread once we rename to back to bridge.py
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.
Rmb to do this before merge.
…n/monkey-patch-bridge
I'd also like to re-enable the Carla integration test since we've refactored it (probably with errors) and I can't verify locally... |
It was working perfectly at time of submission, and then stopped working so well after merging main a couple of times. I'll debug this. |
You will have to tweak the Part of the bottleneck is running the model with OnnxCpuEP and the other half is the generation of the image data from the simulator. I'll see if there are any panda3D settings that can help further with the latter. |
I haven't. The diff is massive (500+ files) on that branch, so it's not easy to see what I'd be running.
You're right. Though any after this one will have to be significantly less work to be merged since we're putting in the effort to review the first PR.
What do you mean? What needs to go in there that's openpilot specific? |
I added metadrive to the base dir of openpilot. That was the simplest way for me to develop the changes. It would be added as a submodule in the end. The changes I made include the custom controller, the custom camera adjuster, and the IPC streamer. The streamer increases multi-thread performance. |
…n/monkey-patch-bridge
The problem for me actually seems to be the CL kernel now. It is sometimes takine 200ms, and 400ms.
Oops, turns out that `LOGPRINT=debug` was actually causing the issue since a voluminous amount of logs is captured and printed on every frame... the observer effect is real!
I don't recall seeing this initially. In the worst case, I even get:
4.7 seconds to run the OpenCL kernel. It seems that modeld's use of OpenCL is interfering. See for instance: However, I don't understand what is clogging up the queue so badly. It may be some recent changes to master. @adeebshihadeh do you have any idea of recent changes that may have increased the usage of OpenCL kernels by openpilot?
|
This should be fixed now. Just needed to merge master.
Let me know how it goes with Btw, could you be more specific about what is the base spec we are targetting? Are we targetting laptops with no dGPU (like my current unfortunate setup?)
Cleaned up the stdout |
Reminder |
@jon-chuang we can break up the first stage of the bounty/project, so $500 of the $2k for this PR to be merged with the following goals:
Most of the parts are here, just needs to be rebased and cleaned up a bit. I just merged the MetaDrive package in (#29736), so that should reduce the diff a bit. |
Hello @adeebshihadeh , I'm no longer working on this project @MoreTore can take over if he wants. |
Alright, thanks for kicking this off! |
took stuff from this PR and upstreamed it here: #29935 thanks again! |
Description
Add
MetaDrive
simulator.Runs at 10 FPS on 1928 X 1208 inputs on an iGPU (Ryzen 6850H - Laptop).
We disable render screen.
Misc notes:
bridge.py
into cleanSimulatorBridge
abstraction that shares common logic betweenCarlaBridge
andMetaDriveBridge
bridge.py
now accepts--simulator
,--ticks_per_frame
MetaDrive
methods for improved performanceWideCameraOnly
for performance, in particular, needing to run inExperimentalMode
fov=160
as the comma three wide camera & CARLA simulator cameraVerification
Adding an integration test similar to carla simulator's
First part of: #27284
Next steps: