sumo
sumo copied to clipboard
Retrieve segment id and segment index from vehicle
I added two functions to retrieve segment ID and segment index.
Tested with both libsumo
and traci
via Python.
In the mesoscopic simulation, calling these two functions will return the corresponding segment info (e.g. "EG_23_2_1:1"
and 1
.
In the microscopic simulation, calling these two functions will return the empty string ""
and INVALID_INT_VALUE
(-1073741824).
Refs #14681 and #14670.
It's my first time to create a pull request. I follow all the steps here: https://sumo.dlr.de/docs/FAQ.html#how_do_code_contributions_work.
I am not sure about the following two things:
- How do I choose a new constant in
src/libsumo/TraCIConstants.h
? Currently, I use0xa1
and0xa2
forVAR_SEGMENT_ID
andVAR_SEGMENT_INDEX
, respectively. - Is
tools/traci/_vehicle.py
generated fromsrc/libtraci/Vehicle.cpp
or it can be manually edited? Currently, I manually edit it based on what I've done insrc/libtraci/Vehicle.cpp
.
Please let me know how I can improve this pull request.