Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Subscribing to simulation variables

The first parameter is ignored when subscribing to simulation context.
Please also be aware of https://github.com/eclipse/sumo/issues/12306

Am Di., 13. Dez. 2022 um 13:09 Uhr schrieb Matthew Jones <Matthew.Jones@xxxxxxxxx>:
Hello,

I am trying to debug some simulation problems, from C++ code.
Our main class is 
    class TrafficModel : public TraCIAPI
and in its constructor we have this, which works:
    mStartTime = simulation.getTime();
    mDeltaTime = simulation.getDeltaT();
however, if I call
    simulation.getIDCount();
or
    simulation.getIDList();
they block and the application freezes.

What I am actually trying to do is
    const std::vector<int> varsSimulation{
      libsumo::VAR_TELEPORT_STARTING_VEHICLES_NUMBER,
      libsumo::VAR_TELEPORT_STARTING_VEHICLES_IDS,
      libsumo::VAR_TELEPORT_ENDING_VEHICLES_NUMBER,
      libsumo::VAR_TELEPORT_ENDING_VEHICLES_IDS,
      libsumo::VAR_ARRIVED_VEHICLES_NUMBER,
      libsumo::VAR_ARRIVED_VEHICLES_IDS,
    };

    simulation.subscribeContext("", libsumo::CMD_GET_SIM_VARIABLE, 99999, varsSimulation, 0, 999999999);

but this also blocks, so I was trying to work out what to pass for the first parameter to subscribeContext.

Obviously I'm doing something wrong but I can't work out what it is!
I couldn't find anything in the documentation about what the first parameter for subscribeContext means when we are dealing with the simulation scope.
Are there restrictions on when any of these methods can be called?

Thanks,

Matthew.





Matthew Jones
Senior Software Engineer
rFpro Limited

E: matthew.jones@xxxxxxxxx
W:  www.rFpro.com

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system sender. This message may contain confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.

_______________________________________________
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