hello-robot / stretch_web_teleop

Remote web teleoperation for the Stretch mobile manipulators from Hello Robot Inc.
Other
13 stars 0 forks source link

Fix Predictive Display speed bug #80

Closed hello-amal closed 1 month ago

hello-amal commented 1 month ago

Description

Currently, there is a bug in predictive display where the max speed when moving forward is lower than the max speed when using the button pad to move forward. The reason for this is that the speed multiplier in predictive display is computed by taking the distance between the base and the cursor and dividing it by the distance between the base and the corner (e.g., the max distance possible in the image). As a result, the robot only ever moves at max speed when the cursor is in the corner of the image (e.g., it is turning), and there is no way to have it move at max speed when it is moving straight.

This PR addresses that by refactoring the speed multiplier to be: the distance between the base and the cursor, divided by the distance between the base and the point that would be reached if extending the ray from the base to the cursor till the end of the image. As a result, in every direction, it is now possible to move at max speed by extending the cursor towards the end of the image.

Further, an unfortunate reality of PredictiveDisplay was that users would never reach max speed, because doing so requires the cursor to be on the edge of the image, which makes it very easy for the cursor to leave the image. Hence, this PR also adds a threshold -- fixed at 90% -- so that as long as the cursor is 90% of the way to the edge of the image (in that direction), the robot will reach max speed.

Testing procedure

Before opening a pull request

From the top-level of this repository, run:

To merge