rsmp-nordic / rsmp_sxl_traffic_lights

RSMP Signal Exchange List (SXL) for Traffic Controllers
MIT License
12 stars 4 forks source link

Add message for getting speed distribution #169

Open emiltin opened 1 year ago

emiltin commented 1 year ago

There's currently no way to get aggregated data about speed distribution. You can only get the average for vehicles detected since last update. If you use sendOnChange (rpeviously known as updateRate=0) you get a message for each vehicles detected, and can then do the computations yourself later, but it can take a lot of bandwidth to send a message for every vehicle.

We could either add a message that provides an aggregated speed distribution for vehicles since the last update, eg:

0-5km/h:  3
5-10km/h:  76
15-20km/h:  344
25-30km/t  123
...

But should the bins be configuration..?

Or we design a more general way to fetch data about each detection since last update, that can include speed, vehicle type, direction, etc. eg:


{
  "at":"2023-09-26T12:49:01.599Z","class":"bicycle","speed":19,"direction":"southbound"},
  "at":"2023-09-26T12:49:03.234Z","class":"bicycle","speed":23,"direction":"southbound"},
  "at":"2023-09-26T12:49:24.622Z","class":"car","speed":42,"direction":"northbound"},
  "at":"2023-09-26T12:49:45.643Z","class":"bus","speed":34,"direction":"northbound"},
  "at":"2023-09-26T12:49:56.552Z","class":"bicycle","speed":23,"direction":"southbound"},
  ..
}