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
In order to connect to a controller, you must be "focused" (meaning that you have physically clicked onto the application) onto the browser running the code. Press at least one button for the browser to capture the controller connected events- You must stay focused in the browser in order for the browser to detect what buttons are being pressed
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
incontrollerEvents.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