Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] The right way of using TraCI Clients in C++

Hi,

i've got a question concerning the appropriate way of implementing and using TraCI C++ for controlling sumo externally.

Currently, there seems to be two distinct ways of, e.g., subscribing to sumo quantities (such as vehicle position and speed):


(A)   According to [1]: Here, an exemplary minimal TraCIClient is demonstrated which makes use of function calls which are inherited directly from the TraCIAPI class, such as simulationStep() or close(). Also, here i could subscribe to variables using TraCIAPI::SimulationScope::subscribe(...).


(B)   The TraCITestClient, which is also provided with sumo, demonstrates two ways of subscribing to variables:
On the one hand, variables are subscribed using the beforementioned call to the subscribe() function oft he TraXIAPI class. On the other side, in the run() method, the function commandSubscribeObjectVariable() from the TraCITestClient itself is used to subscribe to variables.

So now looking at the details, both are calling

*         TraCIAPI ::send_commandSubscribeObjectVariable() and

*         TraCIAPI:: check_resultState()
from the base class, but seem to handle the following steps differently:
Whereas TraCIAPI::SimulationScope::subscribe() calls check_commandGetResult() and readVariableSubscription() additionally, the other way the TraCITestClient, first, handles possibly thrown exceptions, then secondly and more important, calls TraCITestClient::validateSubscribe().

So, my question is what is the appropriate way of variable subscription?

Best regards!


[1] http://sumo.dlr.de/wiki/TraCI/C%2B%2BTraCIAPI


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/sumo-user


Back to the top