lgsvl / simulator

A ROS/ROS2 Multi-robot Simulator for Autonomous Vehicles
Other
2.29k stars 779 forks source link

Vehicle physics pro (VPP) vehicle import? #1959

Open JeyP4 opened 2 years ago

JeyP4 commented 2 years ago

Hello

I have been through the below posts LGSVL-VPP (Vehicle Physics Pro) Integration #515 & Post#1113 But they couldn't lead to a deterministic approach.

Those posts are also old. I was wondering if there is any more-updated approach available to import VPP vehicles in LGSVL.

For good autonomous driving simulation, detailed vehicle dynamics is better to have. Maybe I overlooked it, but I couldn't find the moment of inertia (J) in the default Jaguar vehicle.

Could anyone suggest something regarding VPP vehicles import in LGSVL?

EricBoiseLGSVL commented 2 years ago

Are you looking for the center of mass?

JeyP4 commented 2 years ago

Are you looking for the center of mass?

No, I am looking for rotational Inertia which is also known as moment of inertia kg-m2.

This is missing in Jaguar prefab. This is a critical parameter in real vehicle dynamics.

EricBoiseLGSVL commented 2 years ago

So this and/or this?

JeyP4 commented 2 years ago

So this and/or this?

Thanks for replying. Yes, I am aware of rigid body tensor. But they are automatically calculated by the mesh collider. And mesh collider assumes uniform weight distribution (which is an oversimplification). That's why in the single-track vehicle model, a reasonable J is used.

image

For example, in Vehicle physics pro correct J value is 2200 kg-m2. Rigid body collider calculates ~3100 kg-m2. image

VPP contains a very nice vehicle prefab (In the community version itself), it would be an awesome value addition to LGSVL if a connecting component is available. Maybe for future expansion. As VPP is a good option for realistic vehicle dynamics simulation. 😀

EricBoiseLGSVL commented 2 years ago

Ah, I see. I wasn't aware it allowed you to set this. Yes, VPP is great. We have integrated VPP but we can't release because of license issues. Some other users have as well.

We implemented custom dynamics and VPP can be added to the binary. What is the issue that you are having integrating exactly?

JeyP4 commented 2 years ago

What is the issue that you are having integrating exactly?

I have converted VPP material to HDRP. So now it is ready to be seen in LGSVL scene in unity. Then I dragged Jaguar and VPP vehicle in a scene to compare them. image

I have seen the LGSVL - Creating a new ego vehicle tutorial. I think this tutorial is valid in case of just modifying the vehicle dimensions and look, keeping the same vehicle dynamics.

I have seen the LGSVL - EGO Vehicle Dynamics. But I don't know which section is useful for me 'Full Model Interface' or 'Robotics'.

Basically, I am confused which are the next steps for me.

EricBoiseLGSVL commented 2 years ago

Like the post you linked earlier, you need to create a new dynamicsSMI class that works with VPP.

lemketron commented 2 years ago

@JeyP4

Basically, I am confused which are the next steps for me.

You can check out my VehicleVPP.cs file in a VPP fork of SVL that includes the (free) VPP community DLL here: https://github.com/lemketron/simulator/tree/WIP-AddVPP-on-2021.3

This work was used by some of the Indy Autonomous Challenge teams for simulation prior to their autonomous racing events in Indianapolis last October and at CES in Las Vegas in January, 2022.

Hope this helps.

It would be great to have an open source vehicle with the VPP changes in it, but unfortunately we don't have anything available that we can share publicly share.

EricBoiseLGSVL commented 2 years ago

Thanks @lemketron

JeyP4 commented 2 years ago

Thanks @lemketron

I tried using the scripts you suggested in the following way. image

So some scripts from VPP default, some from your repo, and some from Jaguar. Is it the correct way? But in simulation, the vehicle is sinking inside the ground. Kazam_screencast_00006 I think it stops when body 'Collider' hits the ground.

The wheel colliders are in place. image Could you suggest something?

Thanks ! 🙏😀

EricBoiseLGSVL commented 2 years ago

You need to change the code to support VPP wheel colliders, not Unity wheel colliders. Make sure it is on the default physics layer. Also, fix all null errors.

lemketron commented 2 years ago

You need to change the code to support VPP wheel colliders, not Unity wheel colliders. Make sure it is on the default physics layer. Also, fix all null errors.

This might help: https://vehiclephysics.com/components/wheel-collider/