lgsvl / simulator

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

Intersection and waypoint following #1919

Open DestinyFrank opened 2 years ago

DestinyFrank commented 2 years ago

We are working on designing a delivery robot that drives on the sidewalk. I am currently working on annotating intersections. Is there a way to make the vehicle drive along the waypoint lanes in the simulation? Also, is there a way to annotate the lanes so the vehicle can drive in either direction on the lane?

Capture_intersection

EricBoiseLGSVL commented 2 years ago

We have a VehicleWaypointFollowSMI.cs that you can replace the VehicleSMI.cs with and it will follow lanes like npcs. No, we don't support driving in the opposite direction. You will need to heavily edit the waypoint follow class.

DestinyFrank commented 2 years ago

Where can I find the VehicleWaypointFollowSMI.cs script to use in the project?

EricBoiseLGSVL commented 2 years ago

In the project under Assets/Scripts/Dynamics/Examples/VehicleWaypointFollowSMI.cs

DestinyFrank commented 2 years ago

I found the script and added it to the vehicle. Do you need to plug in the map you are planning to use? Is there anything else I need to plug into the code?

image ipt how

EricBoiseLGSVL commented 2 years ago

nope that looks good. Just be sure to remove VehicleSMI. You can only have one dynamics class on a vehicle. Build the bundle and upload to webui as a different vehicle so you know which one has waypoint follow. Then run a sim. You may need to edit the class to get the desired behavior.

DestinyFrank commented 2 years ago

It is still doesn't seem to work. How would I edit the class?

EricBoiseLGSVL commented 2 years ago

What exactly doesn't work? I do see you didn't enable which wheels are for steering. I also see that you have 6 wheels. This class is for 4 wheeled vehicles. I recommend just using the first and last until you can edit the class. You need a IDE like Visual Studio, VS Code, etc. Lastly, did you remove VehicleSMI from the prefab?

DestinyFrank commented 2 years ago

The Vehicle doesn't move and stays in the spawn position when I run a simulation. Is there a way to edit the class to have six wheels? I have Visual Studios, and I removed the Vehicle SMI from the prefab.

EricBoiseLGSVL commented 2 years ago

Did you remove the center wheels from the wheels data list and tick the steering for the front two? Did you test on CubeTown or Borregas?

To support 6 wheels, which shouldn't be hard because the LaneFollowSMI moves the rigidbody, steering should just be for wheel angle. Do you have any errors when you run? What does the player.log say, after the above tests?

DestinyFrank commented 2 years ago

Yes, I did turn off the middle wheels and change the steering. When I ran a test with the Borregas map, I still had the same issue. There does not appear to be any errors, but the vehicle still doesn't move.

EricBoiseLGSVL commented 2 years ago

Hmm, we haven't seen this in our testing. We used the Jag with the LaneFollow on Borregas. Can you try with the Jag to see if it's an issue with how you created your EGO model? Are you using articulated bodies?

DestinyFrank commented 2 years ago

I do not believe that I am using articulated bodies. Would I need to change the Configration to get the lane following to work? When it is working how should the vehicle move? I tested with the Jag and moved the car but did not see any lane following.

EricBoiseLGSVL commented 2 years ago

No that is good then. We haven't tested VehicleLaneFollowSMI with articulated bodies. What do you mean change the configuration?

Keyboard sensor will not work with LaneFollowing. If it worked on your test then you are not using the correct vehicle. Be very sure that your loaded vehicle is the lane follow smi. You can run in the editor and select the vehicle to check.

Vehicle lane follow will make the EGO behave like a NPC. It will be moved by the rigidbody. It will no longer use inputs and will randomly follow the closet lane. It will despawn and respawn when it runs out of annotated lanes.

Be sure the spawn position is on a valid lane as well. You can use any other sensor but control sensors. If you want control with lane follow I suggest using an ad stack like apollo or autoware. This is how the simulator is designed.