This PR fixes the issue with the Robot.wait_command(), which polls until all the joints have stopped after executing motion on multiple robot joints using Robot.push_command().
As stated in this issue https://github.com/hello-robot/stretch_body/issues/321 previously, the wait command fails to poll until all the robot joints have completed the motion and returns too quickly or inaccurately. The reason for this issue was because of using is_moving / is_moving_filter boolean status flag to poll. is_moving is generated by applying velocity thresholds, which was observed to be very noisy irrespective of the applying smoothing filter which further added in-accuracy.
The above issue is fixed using the is_moving_mg boolean flag instead, which is set by the stepper firmware's motion generator handle when the motor tracks a command. This works reliably and aligns well with the expected use case of Robot.wait_command().
This PR also introduces the new argument use_motion_generator to the Robot.wait_command() set to True by default. If users want to use velocity thresholds instead of motion generators to poll, they can set this argument to false. (This might be helpful in niche cases where a user wants to poll until back-driving the robot is completed)
Run the test script test_wait_command.py which will validate the working of the Robot.wait_command().
This PR fixes the issue with the
Robot.wait_command()
, which polls until all the joints have stopped after executing motion on multiple robot joints usingRobot.push_command()
.is_moving
/is_moving_filter
boolean status flag to poll.is_moving
is generated by applying velocity thresholds, which was observed to be very noisy irrespective of the applying smoothing filter which further added in-accuracy.is_moving_mg
boolean flag instead, which is set by the stepper firmware's motion generator handle when the motor tracks a command. This works reliably and aligns well with the expected use case ofRobot.wait_command()
.use_motion_generator
to theRobot.wait_command()
set to True by default. If users want to use velocity thresholds instead of motion generators to poll, they can set this argument to false. (This might be helpful in niche cases where a user wants to poll until back-driving the robot is completed)