Make a Safer "Continuous Jog" for Game Controller Operation#211
Merged
Conversation
…, 3) repsectively
…associated axis value from the last axis event
…axis values are in the dead zone
…s_for_after_motion
…motion_group if the motion group is NOT moving
… when motion begins
… when motion stops
…oved.emit to dedicated method _handle_axis_move
…lly check the joystick axes
…ion instead of using the event payload position
… is in the deadzone
… the joystick-axis is not in the deadzone
…tionGroup ... add annotations
… size associated with joystick controls)
…d hide for interactive
…n an axis actor is linked
…ead of stop_move()
…nd of stop_move() to ensure the motion is stopped
…he step distance from the associated AxisControlWidget.joystick_delta_input
rocco8773
marked this pull request as ready for review
July 24, 2026 19:17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the motors would go into a continuous jog whenever operated by the joystick of a game controller. This presented a serious risk if the software would ever crash. The continuous jog will keep moving until it receives a stop signals, so if(when) the software crashes there can never be a signal to stop the motors. The user would have to run up and manually stop the motors.
The STM23X (or STM24X) has features to mitigate this issue: software limits (
LMandLP) and network watchdogs (ZA). However, our motors do NOT have these features.To mitigate this risk, the PR has created an artificial "continuous jog". How does this work...
What has changed...
stop()method onMotor,Axis,Drive, andMotionGrouphas been update to have a consistent signature across all.Drive.stophas been updated so a specific axis can be stopped or all axes can be stopped.MotionGroup.stophas been updated so a specific axis can be stopped or all axes can be stopped.AxisControlWidgethas been updated to include a field for setting the joystick macro step. This field is hidden whenAxisControlWidgetis initialized in interactive mode, and made available with initialized in read-only mode.DriveGameController.stop_movewill issue aQTimerat the end of its execution to double check if the motor has been properly stopped. I [@rocco8773] implemented this because when the joystick was just flicked the motor would just start moving, when it should not be moved at all.DriveGameController._handle_axis_moveis re-written to perform the macro jog step, instead of the continuous jog.DriveGameController._handle_axis_moveno longer tries to make decisions based on its own joystick dead-zone. Instead it relies on thePyGameJoystickRunnerdead-zone handling.PyGameJoystickRunner: Thesignalsattribute was changed from a class attribute to a instance attribute.PyGameJoystickRunner: created methodsblockSignalsandsignalsBlockedPyGameJoystickRunner: put signal connections into dedicated method_connect_signalsPyGameJoystickRunner: re-worked handling of the joystick behavior_handle_axis_movepygamedo NOT consistently nor dependably pickup joystick motion.)MGWidget: made dedicated methods to handle motion start (_handle_movement_started) and motion stop (_handle_movement_stopped).MGWidget._handle_movement_stoppedputs a callback to enabling the configuration controls into aQTimerset for 500 ms. This is done so every time the new "continuous jog" comes to a stop and starts up again the configuration controls are NOT enabled and disabled again. This enable-disable cycle would cause delays in the start of the next macro jog.