Closed YenKang closed 5 years ago
I'm not sure what you are trying to accomplish. The function Simulation.findRoute is working as expected in our own TraaS test (https://github.com/eclipse/sumo/blob/master/tools/contributed/traas/examples/APITest.sh)
Dear @namdre , I was thankful for your fast reply yesterday, and my original goal is to accomplish this line
SumoStage stage = (SumoStage) conn.do_job_get(Simulation.findRoute(fromEdge, toEdge, vType, depart, routingMode));
However, the error occured
java.lang.IllegalStateException: Error reading byte, invalid list position specified for reading: 221 at de.uniluebeck.itm.tcpip.Storage.readByte(Storage.java:141) at de.uniluebeck.itm.tcpip.Storage.readString(Storage.java:502) at de.uniluebeck.itm.tcpip.Storage.readStringASCII(Storage.java:462) at de.tudresden.sumo.util.CommandProcessor.readStage(CommandProcessor.java:881) at de.tudresden.sumo.util.CommandProcessor.do_job_get(CommandProcessor.java:783) at it.polito.appeal.traci.SumoTraciConnection.do_job_get(SumoTraciConnection.java:366) at Main.main(Main.java:93)
After checking the APITest.sh, I started to git clone the newest version of SUMO and complied APITest.java by elicpse and runed this line
SumoStage stage = (SumoStage)conn.do_job_get(Simulation.findRoute("gneE0", "gneE2", "car", 0, 0));
The similar error happened again
Error reading byte, invalid list position specified for reading: 90
when I changed the pair of fromEdge and toEdge, the number in invalid list position specified for reading would changed.
My sepcific problem is how to fix Error reading byte and "invalid list position" problem.
ps. The [folder] includes all my files(https://github.com/YenKang/Smart-Logistics-Plan/tree/master/eclipse%20workspace/java_library/java_library).
Ich danke Ihnen!
Kang Yen
I would guess that the difference between your result and mine is due to a difference in the sumo version being called. APITest accepts the path to the sumo binary as the first command line argument. Please check what happens if you explicitly set the path to a sumo binary of version 1.2.0 or later.
Dear @namdre , After I downloaded the newest version of sumo (Version 1.2.0), configured the bin/sumo environment path and executed my previous codes of findRoute function,
Really Really thank for your useful and clear guide to my question!
Sincerely, Kang Yen
Yay!
Error of reading byte in findRoute function
Dear @behrisch, @mkrumnow , @namdre
I faced a failure in findRoute after I re-writed your version of java_library.
The findRoute function involved several files including Main.java, Simulation.java, SumoCommand.java and CommandProcessor.java and I did some repairment on those files.
However, The sumo-gui shut down and the console in eclipse showed the messages
1.Main.java
2.SumoCommand.java
The above adding codes were inserted in the constructor "public SumoCommand(Object input1, Object input2, Object input3, Object[] array, Object response, Object output_type)"
3.map_from_flow.rou.xml
4.CommandProcessor.java
Finally, I think there is a tricky problem in Traci/Simulation/findRoute.
Therefore, I was stuck on this issue.
Sincerely,
Kang Yen