TrickfireRobotics / mission-control

The mission control user interface for "Viator" for the University Rover Challenge
1 stars 2 forks source link

Improve Gamepad Controller Input Latency #5

Open VladimirKupryukhin opened 4 months ago

VladimirKupryukhin commented 4 months ago

Context

While the controller input functions, it is not the best when it comes to lag.

The main issue is that if you move the joysticks for a long time, it floods the websocket with hundreds of ROS topic messages. Now imagine if multiple controllers are connected, the latency could potentially be quite bad. This latency is partially can_moteus's fault in the ROS code, but that is also to be rewritten to reduce latency by another person.

Current Behavior

Take a look at the controller code. The current way to mitigate the issue is to looking at the velocity at which the joysticks move. If the velocity is higher than a threshold (DELTA_SENSITIVTY = 0.01 in controllerEvents.ts), then we send the axis data.

How to Implement

Come up with an algorithm that mitigates flooding while keeping the responsiveness the same. Maybe take a look at how operating systems take care of keyboard input. You might even want to fully rewrite the controller code if you think that it is worth it. Keep the user friendly way of mapping buttons to ROS topic names.

Notes

VladimirKupryukhin commented 2 months ago

I think that the can_moteus rewrite fixed any latency. We should test this heavily to confirm