0

I'm currently working on a school project where we have to set up a traffic simulation. We decided to use TraaS.

TraaS has a method to retrieve the current X and Y coordinates of a given vehicle (see getPosition). However these X and Y coordinates are not the actual map coordinates, but they are relative to the SUMO net.

The question is: How to convert these relative coordinates to geo coordinates?

TraaS has a method named convertGeo to convert X and Y coordinates to geo coordinates, however the method throws an exception. As far as I can tell I'm passing the correct arguments to the method; two doubles and a string which indicates whether you are converting to or from geo coordinates. The method throws the following exception:

SUMO error for command 171: Source position type not supported

//Get a random vehicle from the list of current vehicles in the simulation.
String vehicle = getRandomVehicle(); //Retrieves a random ID of an existing vehicle in the simulatio, don't worry about it,

SumoPosition2D pos = (SumoPosition2D) conn.do_job_get(Vehicle.getPosition(vehicle)); //Retrieves the last X and Y coordinates of the vehicle (example -> X: 6997.111901690444, Y: 7564.062169389001)

Object obj = conn.do_job_get(Simulation.convertGeo(pos.x, pos.y, "False")); //Throws an exception -> SUMO error for command 171: Source position type not supported) 
4

2 回答 2

1

通过查看代码,我会说该命令尚未在 TraaS 中实现。您可以使用TraCI4J或 python 客户端(推荐,因为它是最新的客户端),它已经与 sumo 和 jython 捆绑在一起(如果您需要坚持使用 java)。

于 2017-05-20T08:12:52.190 回答
0

谢谢你的建议,迈克尔。

我已经联系了 TraaS 的创建者,他确实确认这是一个错误。该问题已在 r48 ( https://sourceforge.net/p/traas/code/48/ ) 中得到修复。convertGeo 的参数也从 (double, double, String) 变成了 (double, double, boolean)。

于 2017-05-22T13:22:26.647 回答