sumo icon indicating copy to clipboard operation
sumo copied to clipboard

Retrieve segment id and segment index from vehicle

Open zihaooo opened this issue 6 months ago • 0 comments

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:

  1. How do I choose a new constant in src/libsumo/TraCIConstants.h? Currently, I use 0xa1 and 0xa2 for VAR_SEGMENT_ID and VAR_SEGMENT_INDEX, respectively.
  2. Is tools/traci/_vehicle.py generated from src/libtraci/Vehicle.cpp or it can be manually edited? Currently, I manually edit it based on what I've done in src/libtraci/Vehicle.cpp.

Please let me know how I can improve this pull request.

zihaooo avatar Aug 13 '24 04:08 zihaooo