Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sumo-user] Need Assistance with TraCI Constants and Subscription Domains in SUMO

Hello, my version info:

TraCI VERSION 21
'SUMO 79d8ebc13' (updated today)
Ubuntu 18.04.6 LTS

On seeing traci.exceptions.TraCIException: Could not add subscription. Get Vehicle Variable: unsupported variable 0x23 specified for some traci constants I was trying to use for subscriptions, I realized that maybe the domain I was using was wrong. So I figured the domain out for some of them like tc.VAR_COLLISIONS is used in traci.simulation.subscribe(), tc.VAR_ACCEL in traci.vehicletype.subscribe() tc.VAR_SPEED in traci.vehicle.subscribe() - all by trial and error/guesswork. I still can't figure out the correct domains for the following constants:

tc.VAR_ALLOWED_SPEED (assumed it was lane domain, but nope)
tc.VAR_PREV_SPEED (should have been vehicle domain, but nope)

However, for some constants:

tc.LCA_WANTS_LANECHANGE,
tc.LCA_WANTS_LANECHANGE_OR_STAY,
tc.LANE_CHANGES,
tc.LANE_ALLOWED,
tc.LANECHANGE_LEFT,
tc.LANECHANGE_RIGHT,

the error is very different:
Traceback (most recent call last):
File "code_tester.py", line 38, in <module>
tc.LCA_WANTS_LANECHANGE, # (or whatever the constant is in the list)
File "/home/alice/sumo/tools/traci/domain.py", line 188, in subscribe
self._connection._subscribe(self._subscribeID, begin, end, objectID, varIDs, parameters)
File "/home/alice/sumo/tools/traci/connection.py", line 295, in _subscribe
result = self._sendCmd(cmdID, (begin, end), objID, format, *args)
File "/home/alice/sumo/tools/traci/connection.py", line 212, in _sendCmd
packed = self._pack(format, *values)
File "/home/alice/sumo/tools/traci/connection.py", line 170, in _pack
packed += struct.pack("!B", int(v))
struct.error: ubyte format requires 0 <= number <= 255


How can I fix this from my end? I have attached the minimum code to reproduce this as a zip. P.S. The reason I have to use TraCI for this case is because that's the only way I have been able to use the GUI for years.

Thank you.

Sincerely,
Hriday

Attachment: traci_constants_subscriptions.zip
Description: Zip archive


Back to the top