Summary of parameter to tweak: [help needed]
When 1x1x1 cube is a centimetre on edge:
GameObject:
Transform:
Scale: 1, 1, 1
RigidBody:
Mass: ?
Collision Detection: Continuous
Physics:
Gravity: 0, -981, 0
Time:
Fixed Time Stamp: 0.0035
Hello all, I have the intention to carry some investigation of ML agents for simulation of real-world robotics. My initial idea was to simulate and hexapod robot and compare it with a real counterpart. For doing so I intend to use small cheap servos like SG90 and here comes the problem:
We are talking about 2.2cm x 1cm x 2.2 cm and about 9 grams on this servo motor (so we are talking about masses around grams and scales around centimetres)and I wish I could simulate the physics of this as precisely as possible. As I understand, Unity doesn't have exactly a unit system, but stuff is configured to work as it was set in kg and meter units. apparently, if I take my models to this scale everything just goes crazy(even trying to tweak some variables in physics settings). I guess it is a mix of bad params and lack of floating point precision in the scales.
I am also very confused about units in parameters like drag and forces.
Anyone had good results in simulations like mine? If someone can help me figure this out I would be glad to share my results as open source examples for robotics simulations.
This is more of a Unity physics problem than a ML problem, so you might have better luck at Unity Answers than here.
I've had similar issues, and you can just scale everythinig (i.e. assume 1 unit = 1 centimeter and 1 mass =10g), so long as you tweak the rest of your physics parameters such as gravity. I've never used Unity to attempt to simulate real physics, so I'm not sure how you'd convert IRL forces into Unity's.
General physics advice is just to spend a bit of time reading the docs and experimenting, learn to use configurablejoint for everything, and if you need some in depth clarification look at PhysX's documentation.
Well I've brought it here cause a big use case of ml agents is to simulate homebrew robotics inside unity. it would be big can train models in unity then 'export' than for real world. (no more money spent in broken servos and stuff like that). Brig makers comunity inside would be great, but the current state of physics engine is somethar prohibitive exactly because of all that fine tunnning requirements.
Would be great if ml-agents came with some sort of exemple already configured for that use case.
I've had a hard time trying to simulate a robot in Unity too and still am. However there's one setting that'll fix most of them and it's the fixed time interval under project settings > time. I had to bring it down to 0,0035 to achieve a stable enough environment. That's ok to do if you're not going to have a lot of rigidbodies going around in the environment.
@Ziadj can you please share the other settings you tweaked?
That's about all you need to change when it comes to global settings. Then it's a question of correctly tweaking the robot joints and wheel colliders if you're using them. The lighter they are the higher their resonnance frequency so the more timing accuracy you'll need. The smaller they are the more movement accuracy it'll require so again reducing the calculation time interval will help provide it.
Another trick you might try is to multiply all dimensions, masses and forces by, say, 10 or even 100 globally depending on how small and lightweight your robots are. I haven't tried it yet myself but feel free to let us know if that works for you.
Thank you for your comments. We鈥檝e documented your feedback and will prioritize when appropriate.
I created an summary of parameters to tweak, I hope some help could be provided for some more experienced user. @ZiadJ ?
Thank you for the discussion. We are closing this issue due to inactivity. Feel free to reopen it if you鈥檇 like to continue to discussion though.
hey has anyone had more luck with physics simulations by now?
Hi @Sposito
Unity has experimental support for PhysX 4, which provides more accurate physics simulation for small object manipulation. You can find preview builds here: https://forum.unity.com/threads/physx-4-1-in-unity-experimental-builds.634960/