Skip to content

Add display - #569

Merged
tigroo merged 6 commits into
masterfrom
add_display
Sep 11, 2026
Merged

tigroo merged 6 commits into
masterfrom
add_display

Conversation

@tigroo

@tigroo tigroo commented Jul 22, 2026 •

Copy link
Copy Markdown
Collaborator

Changes

  • IoT3 SDK:
    • mobility add helpers on quadtree
  • examples:
    • display: create the server and the log and the mqtt readers

Close #568

Close #369

Test

How to test

  1. Create a log file with 1 CAM + 1 CPM with 1 perceived object (Toulouse area):
mkdir -p /tmp/logs
cat > /tmp/logs/its.log << 'EOF'
{"message_type":"cam","origin":"self","version":"2.4.0","source_uuid":"car_001","timestamp":1784727122140,"message":{"protocol_version":1,"station_id":555,"generation_delta_time":64291,"basic_container":{"station_type":5,"reference_position":{"latitude":436004000,"longitude":14500000,"position_confidence_ellipse":{"semi_major":10,"semi_minor":50,"semi_major_orientation":1},"altitude":{"value":14750,"confidence":1}}},"high_frequency_container":{"basic_vehicle_container_high_frequency":{"heading":{"value":1800,"confidence":2},"speed":{"value":144,"confidence":3},"drive_direction":0,"vehicle_length":{"value":40,"confidence":0},"vehicle_width":20,"longitudinal_acceleration":{"value":10,"confidence":2},"curvature":{"value":11,"confidence":4},"curvature_calculation_mode":0,"yaw_rate":{"value":562,"confidence":2}}}}}
{"message_type":"cpm","origin":"self","version":"2.1.1","source_uuid":"car_001","timestamp":1784727122141,"message":{"protocol_version":1,"station_id":555,"management_container":{"station_type":15,"reference_time":711612002141,"reference_position":{"latitude":436004000,"longitude":14500000,"position_confidence_ellipse":{"semi_major":10,"semi_minor":50,"semi_major_orientation":1},"altitude":{"value":14750,"confidence":1}}},"perceived_object_container":[{"object_id":1,"measurement_delta_time":-525,"position":{"x_coordinate":{"value":500,"confidence":20},"y_coordinate":{"value":-200,"confidence":30}},"velocity":{"cartesian_velocity":{"x_velocity":{"value":0,"confidence":127},"y_velocity":{"value":0,"confidence":127}}},"object_perception_quality":0}],"originating_rsu_container":[]}}
EOF
  1. Execute the 3 display example binaries following the documentation into the README file.
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/examples/display_log_reader /tmp/logs 26 /tmp/display.db`
INFO [libits::client::logger] Logger ready on stdout
📂 Input directory: /tmp/logs
📊 Zoom level: 26
🗄️  Database: /tmp/display.db

📂 Scanning directory: /tmp/logs
   Found 1 log file(s)
🗄️  Opening database: /tmp/display.db
📖 Parsing at zoom level 26...

  📄 Processing: /tmp/logs/its.log

✅ Parsing complete:
   - Files processed: 1
   - Messages stored: 3
   - Messages skipped (no position): 0
   - Duplicates skipped: 0
   - Errors: 0
   - Database: /tmp/display.db
📊 Database Statistics
   Database: /tmp/display.db
   Total unique quadtiles: 2
   Total messages: 3

📅 Days with data: 1
   2026-07-22 : 3 messages

📨 Message types:
   cam : 1 messages
   cpm : 1 messages
   cpm po : 1 messages

🔝 Top 10 quadkeys (global):
Quadkey                       Count Mean Confidence    Type(s)
----------------------------------------------------------------------
12022203022221313333211031          2             0.0    cam,cpm
12022203022221313333300331          1            25.0     cpm po
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
     Running `target/debug/examples/display_mqtt_reader --config examples/config.ini`
INFO [libits::client::logger] Logger ready on stdout
INFO [libits::transport::mqtt] Transport: standard MQTT; TLS enabled
🔌 Connecting to MQTT broker: test.mosquitto.org:8886
   Client ID: com_app_its-client-1
   Topics: ["#"]
   Zoom level: 18
   Database: examples/display.db
✅ Subscribed to topics
📡 Listening for messages...
JSON parse error on topic Ahoydtu_Kraftwerk120240107/version: trailing characters at line 1 column 4
...
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/examples/display_server --config examples/config.ini`
INFO [libits::client::logger] Logger ready on stdout
📊 Database Statistics
   Database: /tmp/display.db
   Total unique quadtiles: 2
   Total messages: 3

📅 Days with data: 1
   2026-07-22 : 3 messages

📨 Message types:
   cam : 1 messages
   cpm : 1 messages
   cpm po : 1 messages

🔝 Top 10 quadkeys (global):
Quadkey                       Count Mean Confidence    Type(s)
----------------------------------------------------------------------
12022203022221313333211031          2             0.0    cam,cpm
12022203022221313333300331          1            25.0     cpm po

🚀 Server running on http://0.0.0.0:3000 (DB: /tmp/display.db)
📍 Open your browser and navigate to the URL above

Select the date (DAY) 2026-07-22. You should see 1 CAM and 1 CPM with 1 PO (3 messages).

imatge
  1. Publish another CAM + CPM from nearby (slightly different location):
docker run -it --rm eclipse-mosquitto mosquitto_pub -h test.mosquitto.org -p 8886 -t default/outQueue/v2x/cam/car_002_fixdate/1/2/0/2/2/2/0/3/0/2/2/2/2/1/3/1/3/3/3/3/1/1/3/3/2/2 --tls-version tlsv1.2 --capath /etc/ssl/certs/ -m '{"message_type":"cam","origin":"self","version":"2.4.0","source_uuid":"car_002_fixdate","timestamp":1784727122142,"message":{"protocol_version":1,"station_id":666,"generation_delta_time":64291,"basic_container":{"station_type":5,"reference_position":{"latitude":436005000,"longitude":14501000,"position_confidence_ellipse":{"semi_major":10,"semi_minor":50,"semi_major_orientation":1},"altitude":{"value":14750,"confidence":1}}},"high_frequency_container":{"basic_vehicle_container_high_frequency":{"heading":{"value":1800,"confidence":2},"speed":{"value":144,"confidence":3},"drive_direction":0,"vehicle_length":{"value":40,"confidence":0},"vehicle_width":20,"longitudinal_acceleration":{"value":10,"confidence":2},"curvature":{"value":11,"confidence":4},"curvature_calculation_mode":0,"yaw_rate":{"value":562,"confidence":2}}}}}'
docker run -it --rm eclipse-mosquitto mosquitto_pub -h test.mosquitto.org -p 8886 -t default/outQueue/v2x/cpm/car_002_fixdate/1/2/0/2/2/2/0/3/0/2/2/2/2/1/3/1/3/3/3/3/1/1/3/3/2/2 --tls-version tlsv1.2 --capath /etc/ssl/certs/ -m '{"message_type":"cpm","origin":"self","version":"2.1.1","source_uuid":"car_002_fixdate","timestamp":1784727122143,"message":{"protocol_version":1,"station_id":666,"management_container":{"station_type":15,"reference_time":711612002143,"reference_position":{"latitude":436005000,"longitude":14501000,"position_confidence_ellipse":{"semi_major":10,"semi_minor":50,"semi_major_orientation":1},"altitude":{"value":14750,"confidence":1}}},"perceived_object_container":[{"object_id":1,"measurement_delta_time":-525,"position":{"x_coordinate":{"value":500,"confidence":4096},"y_coordinate":{"value":-200,"confidence":4096}},"velocity":{"cartesian_velocity":{"x_velocity":{"value":0,"confidence":127},"y_velocity":{"value":0,"confidence":127}}},"object_perception_quality":0}],"originating_rsu_container":[]}}'

NB: if a huge traffic is on the broker, you may retry to be served.

Select the date (TODAY) , e.g 2026 09 9.

Refresh the map - you should now see 2 CAMs and 2 CPMs with 1 PO at different locations (6 messages).

imatge

@tigroo tigroo self-assigned this Jul 22, 2026
@tigroo tigroo added the Rust Rust code label Jul 22, 2026
@tigroo tigroo added this to Kanban Jul 22, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in Kanban Jul 22, 2026
@tigroo tigroo moved this from Backlog to In progress in Kanban Jul 22, 2026
@tigroo
tigroo requested a review from nbuffon July 22, 2026 14:43
@tigroo
tigroo marked this pull request as ready for review July 22, 2026 14:57

@nbuffon nbuffon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wonder why theses "examples" are barely using libits, and mostly rewriting parsing and data manipulation functions.
What's the rational behind not using the messages' structures through Message to access the values they carry for example ?

Comment thread rust/src/mobility/quadtree.rs Resolved
Comment thread rust/src/mobility/quadtree/quadkey.rs Resolved
Comment thread rust/src/mobility/quadtree/tile.rs Resolved
Comment thread rust/src/mobility/quadtree/tile.rs Resolved
Comment thread rust/examples/display/mqtt/main.rs Resolved
Comment thread rust/examples/display/server/main.rs Resolved
Comment thread rust/examples/display/database.rs Resolved
@tigroo
tigroo marked this pull request as draft August 6, 2026 13:01
@tigroo
tigroo force-pushed the add_display branch 11 times, most recently from 908396d to d73a6bc Compare August 10, 2026 14:39
@tigroo
tigroo marked this pull request as ready for review August 10, 2026 14:49
@tigroo
tigroo requested a review from nbuffon August 10, 2026 14:49
@tigroo
tigroo force-pushed the add_display branch 2 times, most recently from b9515eb to 702389e Compare September 7, 2026 14:38

@nbuffon nbuffon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sending a CAM did correctly add a point on the map
But CPM failed

JSON parse error on topic default/outQueue/v2x/cpm/car_002/1/2/0/2/2/2/0/3/0/2/2/2/2/1/3/1/3/3/3/3/1/1/3/3/2/2: data did not match any variant of untagged enum Message at line 1 column 618

Comment thread rust/src/mobility/quadtree/tile.rs Resolved
Comment thread rust/src/mobility/quadtree/tile.rs Resolved
Comment thread rust/src/mobility/quadtree.rs Resolved
Comment thread rust/src/mobility/quadtree.rs Resolved
Comment thread rust/src/mobility/quadtree.rs Resolved
Comment thread rust/examples/display/helpers.rs Resolved
Comment thread rust/examples/display/helpers.rs Resolved
@tigroo

tigroo commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Sending a CAM did correctly add a point on the map But CPM failed

JSON parse error on topic default/outQueue/v2x/cpm/car_002/1/2/0/2/2/2/0/3/0/2/2/2/2/1/3/1/3/3/3/3/1/1/3/3/2/2: data did not match any variant of untagged enum Message at line 1 column 618

I fixed the cpm example into the description, a bad copy/paste on my side :(.

Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
Precise the minor versions of dependencies.
Remove useless dev dependency.

Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
Add comments on Rust elements.
Provide a coordinate / tile converter
Factorize caracter conversion.
Use a Result to manage the slashes.
Use "quadkey" everywhere (no "quad_key").
Add position_confidence() to Mobile trait with default implementation.
Implement position_confidence() in CAM, DENM, CPM, CAM113.
Add confidence_mean() to PositionConfidenceEllipse (v2.x and v1.1.3).
Declare the 3 examples.

Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
Add a log parser,
a mqtt client
and a web server.
Describe the database.
Provide the configuration file.

Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>

rust: add debug logging to display server

Signed-off-by: Frédéric Gardes <frederic.gardes@orange.com>
@tigroo
tigroo merged commit 4d8b46b into master Sep 11, 2026
344 of 448 checks passed
@tigroo
tigroo deleted the add_display branch September 11, 2026 07:41
@github-project-automation github-project-automation Bot moved this from In progress to Done in Kanban Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Rust code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Metrics display Remove flexi_logger from dev-dependencies

2 participants