Skip to main content

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

the answer is (A).
The special handling in (B) is only done to simplify our regression tests.

2017-10-19 8:50 GMT+02:00 Marc Rene Zofka via sumo-user <sumo-user@xxxxxxxxxxxxxxxxxxxxx>:

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!


Check out the vibrant tech community on one of the world's most
engaging tech sites,!
sumo-user mailing list
sumo-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top