Skip to content

Conversation

@Cbampeta
Copy link
Collaborator

Backend de la voiture avec le site pour monitoeer le tout

ExoRoy and others added 30 commits November 1, 2025 10:06
…rmations (vitesse reelles,vites que voit la camera etc...)

      Pour l'instat il n'y a que la recuperation de la vitesse reell vitesse cible
… modif de la classe camera donc en l'etat possible probleme avec les fonctions liées
# Conflicts:
#	src/HL/Camera.py
#	uv.lock
Copy link
Collaborator

@MatthiasBienvenu MatthiasBienvenu left a comment

Choose a reason for hiding this comment

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

good code quality overall but still I'd like you to fix some stuff

self.running = False
self.controls_car = False

if ON_START_CAMERA_STREAM:
Copy link
Collaborator

Choose a reason for hiding this comment

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

poorly named constant because it looks like this is a hook or something

while self.send_running:
try :
data = struct.pack('<ff', float(round(self.serveur.programme[self.serveur.last_programme_control].vitesse_d)), float(round(self.serveur.programme[self.serveur.last_programme_control].direction_d)))
data = struct.pack('<ff', float(round(self.serveur.vitesse_d)), float(round(self.serveur.direction_d)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you round but still send a float ? I would assume that if you rounded at least you could send and int ?

voltage_lipo = float(getattr(ard, "voltage_lipo", 0.0) or 0.0) if ard else 0.0
voltage_nimh = float(getattr(ard, "voltage_nimh", 0.0) or 0.0) if ard else 0.0
vitesse_r = float(getattr(ard, "vitesse_r", 0.0) or 0.0) if ard else 0.0

Copy link
Collaborator

Choose a reason for hiding this comment

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

the "or 0.0" is useless because you put 0.0 in getattr default argument

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

its better i thinks to leave that like that because if somebody change my code or the voltage isnt properly define in the initialisation of the I2C module and give "none" we risk to have a float(none) that will give an typeerror...


ws.onclose = () => {
console.warn("Telemetry WS disconnected, retrying...");
setTimeout(initTelemetryWS, 1000);
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe retry every few seconds when the ws closes to avoid having to reload the page? a little "disconnected" on the ui element could be useful as well

};

ws.onclose = () => {
console.warn("LIDAR WS disconnected");
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe retry every few seconds when the ws closes to avoid having to reload the page? a little "disconnected" on the ui element could be useful as well

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants