cyberbotics / webots

Webots Robot Simulator
https://cyberbotics.com
Apache License 2.0
3.27k stars 1.71k forks source link

SUMO vehicle did not follow the presetting route and float everywhere #4315

Closed zhangcong0315 closed 2 years ago

zhangcong0315 commented 2 years ago

After building a vehicle in Webots, some vehicles generated in sumo cannot follow their original route to move. I used the following steps and saw the error:

  1. generate a webot vehicle
  2. use controller "sumo_supervisor" to reflect this vehicle into sumo
  3. reset controller to "my*controller"--I want to control the webot vehicle by setting it speed to 80 mph
  4. Run and See error: the other vehicles (generated in sumo) move out of the road (floating everywhere). I did not change any setting to control the sumo vehicles route. Why they cannot follow the original route? image
stefaniapedrazzi commented 2 years ago

I cannot reproduce the issue you reported, but I'm not sure I understand correctly the setup. Please check:

  1. In your world you should have a SumoInterface node that will communicate with sumo and update the position of the sumo controlled vehicles. This node will run the sumo_supervisor controller but won't represent any vehicle itself
  2. The vehicle that you want to control should also be added in the scene and its DEF name should be WEBOTS_VEHICLE0
    (adjust the number from 0 to any other unused name if needed) and set controller to your my*controller. Vehicles with name of the form WEBOTS_HOME<$id> are automatically added to traci.

Here are some sample simulations you could check: projects/vehicles/worlds/highway.wbt projects/vehicles/worlds/highway_overtake.wbt

BenjaminDeleze commented 2 years ago

I'm closing this for now, feel free to reopen it if you have additional issues.