Hi there,
I hope you are doing well! So currently I am developing a robust controller for ADAS. One function we want to verify is that whether we can still control the wheel if one/several wheels are malfunctioned.
For example, some scenarios we want to simulate includes:
-
tire degradation/wear over time. Is there a way to control such parameters with the current python API? or is there any workaround?
-
Another key scenario is sudden tire puncture, for example we want to test this under high speed driving. I understand that this might not be possible and too complicated, but I am wondering is there any workaround for this? For example can we suddenly disable one of the wheels? or maybe suddenly decrease the pressure of one of the wheels? Are these doable with the current python API or is there any workaround?
Thank you so much for your great work and continuous support! Really appreciate it and looking forward to your reply!
I saw there is a method under vehicle that claims that it can deflate individual wheels, but when I tested it, it disable all the wheels at the same time. Is this a bug in the API?
Thank you so much!
Hello @alfredgu001324,
Our Python API supports deflation of a single wheel, using this function, which you already found. It has a bug in it, causing it to deflate all tires instead of only the desired one. You can follow these steps to fix the bug without waiting for the next release:
- Go to your BeamNG home directory.
- Open
./lua/vehicle/extensions/tech/techCore.lua
- Find (ctrl+F)
beamstate.deflateTires
- Replace with
beamstate.deflateTire
Now you should be able to deflate individual tires through the BeamNGpy. The function uses simple wheel_id values, for example 0, 1, 2, etc.
About your other question, at the moment we don’t simulate tire wear.
Let me know if this helps!
3 Likes
Hi @iskren_rusimov ,
Thank you so much for your prompt reply, I really appreciate it! Yes it works like a charm! Now I can see that it is working.
I have a few follow-up questions if you do not mind:
-
Is there a way to inflate the tire back after it is deflated, except for using the recover method?
-
I noticed that for different vehicles, the indices correspond to different wheels. For example, for etk800, index 1 means Rear Left. For Covet, index 1 means Front Left. Is this index actually tied to whether the vehicle is RWD or FWD rather than a specific wheel?
-
Is there a chance that you could also help me look at my other question in the forum, regarding swapping the surface friction on the fly using python API? Currently I have a custom mod that can do this, but for it to work I need to manually pull it out, and click on the button using a small GUI interface. I am wondering whether there is a way to pack this mod into the simulation and have python API to interact with it.
I saw that we can have custom vehicle extensions, but it seems that my custom mod is for more scenario, not for the vehicle. So not sure whether this is possible.
Thank you so much and wish you have a wonderful day!
Hi @alfredgu001324,
At the moment we don’t have a built-in functionality that inflates tires.
The wheel index isn’t tied to the type of drivetrain the vehicle has. There’s no particular consistent order. You could create a Lua extension that checks the positions of all wheels in 3D space and determines which wheel index corresponds to which wheel as a workaround.
I will check on your other post and let you know. Hope this helps and have a nice day!
1 Like
I see, makes sense to me. Thank you so much! Really appreciate all your help and support! This is really really helpful.
1 Like