0
votes

Using the sumo_supervisor example in /usr/local/webots/projects/default/controllers, I am able to generate and delete a vehicle (bmwx) in webots simulation using traci controller. However when I try to specify ros_automobile as my controller instead of sumo using the following modification in Objects.py file

defName = "EGO_VEHICLE%d" % index
    vehicleString = "DEF " + defName + " " + model + " {\n"
    #vehicleString += "  translation 10000 0.5 0\n"
    vehicleString += "  translation -3.16697 0.317 -173.705\n"
    vehicleString += "  controller \"ros_automobile\"\n"
    vehicleString += "  sensorsSlotCenter [\n"
    vehicleString += "    GPS {\n"
    vehicleString += "    }\n"
    vehicleString += "   ]\n"

I get the following error ([ros_automobile] Error: Only nodes based on the 'Car' node can used the car library.) enter image description here

I will highly appreciate any guidance that you guys can provide. Thank you for your time.

1

1 Answers

1
votes

The sumo supervisor is using a simplified version of the vehicle instead of the the usual one, this is to make the simulation run smoother: https://cyberbotics.com/doc/automobile/car#simple-vehicles

Instead of modifying the sumo controller, you should rather already add the vehicle with the correct controller in your simulation and set the appropriate DEF name so that the sumo supervisor will use it when needed: https://cyberbotics.com/doc/automobile/sumo-interface#use-vehicles-already-present-in-the-world

If your are just interested to insert and remove vehicle and not to use the SUMO interface, to add robot from the controller, it is quite simple you just have to use the supervisor API: - https://cyberbotics.com/doc/guide/supervisor-programming - https://cyberbotics.com/doc/reference/supervisor In particular these functions can be used to import new nodes: https://cyberbotics.com/doc/reference/supervisor#wb_supervisor_field_import_mf_node