Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] libsumo returning 0, empty lists for vehicle queries

Simulation.getLoadedNumber returns the number of vehicles loaded from file in the *current* step. It does not give an accumulated count of all vehicles loaded in previous steps.

Am Fr., 11. Nov. 2022 um 03:49 Uhr schrieb Nine, Harmon S via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello.

I have a java program (shown below).  I can load and step through the model, and it even warns that some vehicles have to perform emergency braking.

However, vehicle queries like "Simulation.getLoadedNumber()" are returning 0 when this clearly should not be.

Anyone know what's wrong?  I'm using sumo-1.8.0.

=========================
package sumotest;

import org.eclipse.sumo.libsumo.Simulation;
import org.eclipse.sumo.libsumo.StringVector;


public class App {

    public static void main(String[] args) {
        System.loadLibrary("libsumojni");
        Simulation.load(new StringVector(new String[] {"-c", "SUMO/subway.sumo.cfg"}));
        Simulation.subscribe();
        for(int ix = 0 ; ix < 50000 ; ++ix) {
            Simulation.step();
        }
        System.out.println("Loaded vehicles: " + Simulation.getLoadedNumber()); // prints "0"
        Simulation.close();
    }
}
==========================

-- Harmon
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top