Skip to content

Switch from websocket to UDP #58

Closed

Description

@felixchenier

Problem statement

Currently, when we want to collect data from the wheel using two different processes, we need two connections to the wheel and therefore the wheel streams each data twice. This is a waste of resources and unnecessarily complex.

Proposition

The wheel should simply stream data to a given address and port, and each process would manage its own buffer.

Activity

  1. doumdi commented on Oct 20, 2026

    @doumdi
    Collaborator

    @felixchenier Here is the output you should have when starting the new firmware:

    16:22:41.946 > ets Jul 29 2019 12:21:46
    16:22:41.947 > 
    16:22:41.947 > rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
    16:22:41.952 > configsip: 0, SPIWP:0xee
    16:22:41.952 > clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
    16:22:41.957 > mode:DIO, clock div:2
    16:22:41.963 > load:0x3fff0030,len:1184
    16:22:41.963 > load:0x40078000,len:13232
    16:22:41.969 > load:0x40080400,len:3028
    16:22:41.969 > entry 0x400805e4
    16:22:42.421 > Enabling sensors: 0
    16:22:42.422 > NextWheel version: 0.1.1
    16:22:42.422 > GlobalConfig:
    16:22:42.422 > accel_range: 2
    16:22:42.427 > gyro_range: 250
    16:22:42.427 > mag_range: 2500
    16:22:42.427 > imu_sample_rate: 60
    16:22:42.432 > adc_sample_rate: 120
    16:22:42.432 > encoder_sample_rate: 60
    16:22:42.432 > udp_broadcast_address: 255.255.255.255
    16:22:42.438 > udp_broadcast_port: 12345
    16:22:42.438 > Current time: 2001-01-01 00:00:00 
    16:22:42.443 > Buttons::begin()
    16:22:42.443 > Starting worker tasks
    16:22:42.449 > Starting sensor tasks
    16:22:42.449 > SDCardWorkerTask::run Priority: 4 Core: 0 
    16:22:42.455 > ADCTask::run Priority: 5 Core: 1 
    16:22:42.455 > ADCSensorTask sample_rate: 60
    16:22:42.460 > WebServerTask::run Priority: 2 Core: 0 
    16:22:42.460 > Main Loop: priority = 5
    16:22:42.465 > Main Loop: Executing on core 1
    16:22:42.465 > IMUSensorTask::run Priority: 4 Core: 1 
    16:22:42.471 > IMUSensorTask sample_rate: 60
    16:22:42.471 > QuadEncoderSensorTask::run Priority: 3 Core: 1 
    16:22:42.477 > PowerSensorTask::run Priority: 3 Core: 1 
    16:22:42.482 > Enabling sensors: 1
    16:22:42.482 > DACActuatorTask::run Priority: 2 Core: 1 
    16:22:42.489 > Configured 1 of 1 INA220 current sensors
    16:22:42.714 > IP address changed: 10.0.1.3
    16:22:43.066 > Connected to WiFi IP: 10.0.1.3
    16:22:43.370 > ------------------------------------
    16:22:43.370 > Sensor:       BMX160
    16:22:43.370 > Type:         Acceleration (m/s2)
    16:22:43.375 > Driver Ver:   1
    16:22:43.375 > Unique ID:    5642
    16:22:43.381 > Min Value:    -19.60
    16:22:43.381 > Max Value:    19.61
    16:22:43.381 > Resolution:   0.00
    16:22:43.386 > ------------------------------------
    16:22:43.386 > 
    16:22:43.386 > ------------------------------------
    16:22:43.392 > Sensor:       BMX160
    16:22:43.392 > Type:         Gyroscopic (deg/s)
    16:22:43.397 > Driver Ver:   1
    16:22:43.397 > Unique ID:    5643
    16:22:43.397 > Min Value:    -248.00
    16:22:43.403 > Max Value:    250.00
    16:22:43.403 > Resolution:   0.01
    16:22:43.403 > ------------------------------------
    16:22:43.408 > 
    16:22:43.408 > ------------------------------------
    16:22:43.408 > Sensor:       BMX160
    16:22:43.414 > Type:         Magnetic (uT)
    16:22:43.414 > Driver Ver:   1
    16:22:43.414 > Unique ID:    5644
    16:22:43.420 > Min Value:    -2500.00
    16:22:43.420 > Max Value:    2500.00
    16:22:43.427 > Resolution:   0.30
    16:22:43.427 > ------------------------------------
    16:22:43.427 > 
    16:22:43.485 > PowerSensorTask::run: Low battery. Voltage: 4.660000
    
  2. added 2 commits that reference this issue on Oct 20, 2026
  3. doumdi commented on Oct 20, 2026

    @doumdi
    Collaborator

    I can see that the RTC does not work on my system, the battery is probably dead too.
    16:22:42.438 > Current time: 2001-01-01 00:00:00

  4. felixchenier commented on Oct 20, 2026

    @felixchenier
    CollaboratorAuthor

    @doumdi OK I can connect to router. The problem had a face and it strangely looked like mine. (Forgot that I changed the SSID of the 2.4 GHz band - the one ESP32 connects to).

  5. felixchenier commented on Oct 20, 2026

    @felixchenier
    CollaboratorAuthor

    @doumdi It works! 🎉
    (including the two pushes you just did)

    OK then next week I'll try flashing the wheels at IRGLM and try the new Python module with two class instances and see how it goes. Merci !!! :-)

  6. doumdi commented on Oct 20, 2026

    @doumdi
    Collaborator

    I will have a look at the NTP part later this week.

  7. added a commit that references this issue on Oct 21, 2026
  8. felixchenier commented on Oct 27, 2026

    @felixchenier
    CollaboratorAuthor

    Salut @doumdi

    Ça marche :-D

    J'ai flashé les roues du simulateur, et avec le nouveau protocole UDP je n'ai aucun problème à utiliser les roues avec deux modules différents. Je vais probablement merger dans le main, mais avant, voulais-tu cleaner des résidus de code ?

  9. linked a pull request that will close this issueUDP Streaming & Time sync with NTP #61on Oct 28, 2026
  10. doumdi commented on Oct 28, 2026

    @doumdi
    Collaborator

    11. Salut @doumdi
    Ça marche :-D
    J'ai flashé les roues du simulateur, et avec le nouveau protocole UDP je n'ai aucun problème à utiliser les roues avec deux modules différents. Je vais probablement merger dans le main, mais avant, voulais-tu cleaner des résidus de code ?

    J'ai corrigé les problèmes pour que tes tests / formattage / qualité passent. J'ai fait un PULL request à réviser. Je crois que c'est pas mal déjà nettoyé.

  11. doumdi commented on Oct 28, 2026

    @doumdi
    Collaborator

    @felixchenier Dis-moi si je peux faire autre chose avant de merger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions