-
Notifications
You must be signed in to change notification settings - Fork 779
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
How to use PythonAPI to make ego vehicle follow waypoints ? #1626
Comments
This is not currently supported. We are working on a ego class to follow random waypoints currently. Once this releases, maybe we can add this feature next. Doing this currently is not supported. Here are the needed changes.
Why can't you do this with a NPC vehicle that is supported? You could even create custom sensors that attach to an npc that you want using spectator vehicle. |
Thanks for the reply, these features will help a lot.
How could I attach sensors to npc vehicle and make it publish data to bridge ? |
You can do anything you want really with sensor plugins. You could look for the first NPC spawned, create a gameobject with a class that detects/collects data and then pass that data back to the sensor to send over bridge. That is why we created the spectator vehicle so users can focus on NPCs or Pedestrians in a simulation. You could also setup Autoware/Apollo/LGSVLControl to drive the ego but that is more involved. Look to Unity documentation on parenting. |
But I need to add multiple sensors to the ego vehicle, and then use LGSVL webui to set position for each sensor on the ego vehicle. Thanks. |
Why would this not work with multiple sensors? What do you mean automatically? |
Sorry for the confusion. Because I want to create lots of scenarios of driving vehicle. I would like to use PythonAPI to create scenario including ego vehicle driving path, pedestrian moving path, npc moving path and collect the data of multiple sensors from the scenario. Thanks. |
No worries. It seems you will need to wait until waypoint following is created for VSE. In the meantime, why can't you use Apollo or Autoware to drive to destinations instead? |
Thank for your suggestion. I would like to collect the IVehicleInputs of VehicleController when use KeyBoardControlSensor or WheelControlSensor to drive the ego vehicle. Is it a good way ? @EricBoiseLGSVL |
You could create a sensor like the Keyboard but publish the data instead. Then subscribe to the topics that return the inputs and apply it to IVehicleInputs. |
I found that the input frequency of KeyboardControlSensor(WheelControlSensor) is controlled by FPS. If I collect the inputs from IVehicleInputs, I will get unstable data which depends on FPS of Simulator. It seems to me that VehicleSMI is the real controller of ego vehicle, But I'm not sure the relation between "VehicleControllder(IAgentController)"、"VehicleSMI(IVehicleDynamices)、"VehicleActions(IVehicleActions)". Any documents to explain that ? |
Yes it is based on Update(). You can definitely use the IVehicleDynamics class. |
@EricBoiseLGSVL I collect SteerInput, AccellInput, HandBrake, Reverse for the driving recorder. But I got an issue, when I make a sharp turn at high speed. the record was incorrect. Any Ideas ? |
This is probably issues with Unity's wheel colliders. You might have slipping or bouncing. What speed are you having these issues? |
Thanks for the reply. But when I make a sharp turn at low speed. ( maybe 5 - 10 miles/h ) |
Hmm, not sure but keep in mind FixedUpdate can return values multiple times per frame. Update doesn't do this so maybe the calculations need to be adjusted for this? |
I think that the physics motion of ego vehicle is calculated through FixedUpdate ? |
no the update cycle is once per frame. Fixed update can happen multiple times per frame, so a calc that uses previous frame data may give bad data because of logic happening multiple times in one frame instead of the expected one (commonly input in engines are captured in update). Maybe try to debug more on the frames you get the odd data. |
Got it. I will do some analysis for the record/apply process. |
Hi LGSVL Teams,
I would like to automatically record some scenario from simulator via PythonAPI.
So I need to make ego vehicle follow waypoints which creates by VSE.
Any ideas to make it works !?
Thanks.
The text was updated successfully, but these errors were encountered: