Dear Hriday,
you can find a list of which values can be retrieved in each domain in the
docs <https://sumo.dlr.de/docs/TraCI.html#value_retrieval> .
tc.VAR_ALLOWED_SPEED is for vehicles (max speed on lane is
tc.VAR_MAXSPEED). There is no getter for tc.VAR_PREV_SPEED as this a value
provided by the user anyway. The remaining ones you listed do not belong to
the variables to retrieve but are simple constants used in some TraCI
functions.
Best regards
Mirko
-----Original-Nachricht-----
Betreff: [sumo-user] Need Assistance with TraCI Constants and Subscription
Domains in SUMO
Datum: 2023-12-20T17:41:22+0100
Von: "Hriday Sanghvi via sumo-user" <[email protected]>
An: "Sumo project User discussions" <[email protected]>
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
_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/sumo-user