Skip to content

Make EventActor.run (and its subclasses) more efficient#210

Merged
rocco8773 merged 8 commits into
mainfrom
debug_actor_run
Jul 22, 2026
Merged

Make EventActor.run (and its subclasses) more efficient#210
rocco8773 merged 8 commits into
mainfrom
debug_actor_run

Conversation

@rocco8773

@rocco8773 rocco8773 commented Jul 22, 2026

Copy link
Copy Markdown
Member

When a Motor instance was initialized it was executing _configure_before_run() up to 8 times. If the motor is not reachable, this causes a long delay before control is given back to the user. This is then compounded when a run configuration has multiple motors.

To mitigate this behavior, EventActor.run is updated with a force_run keyword argument. This keyword is not explicitly used by EventActor.run but is intended for EventActor sub-classes to utilized. By default force_run is True, which means whenever .run() is executed it will try to fully run or restart the actor. By setting force_run to False (which is done during the __init__ of sub-classes) the actor will can respect certain designed flags to abort a run or restart. For example, the Motor actor will NOT try to restart (or run) when Motor.connected is False and force_run is False.


What has changed?

  • Keyword argument force_run (Default: True) is added to EventActor.run.
  • force_run is set False in EventActor.__init__.
  • Motor.run is updated to respect the force_run keyword, and NOT run if Motor.connected is False when force_run=False.
  • force_run is set False in Motor.__init__.
  • Motor._configure_before_run() is immediately returned if not connected after attempting self.connect().
  • Axis.run is updated to respect the force_run keyword. Axis itself does NOT have a flag to abort running / restarting.
  • force_run is set False in Axis.__init__.
  • Motor spawning is moved out of Axis.__init__ and into Axis._configure_before_run so the motor actor is NOT spawned multiple times during instantiation.
  • Drive.run is updated to respect the force_run keyword. Drive itself does NOT have a flag to abort running / restarting.
  • force_run is set False in Drive.__init__.
  • MotionGroup.run is updated to respect the force_run keyword. MotionGroup itself does NOT have a flag to abort running / restarting.
  • force_run is set False in MotionGroup.__init__.
  • RunManager.run is updated to respect the force_run keyword. RunManager itself does NOT have a flag to abort running / restarting.
  • force_run is set False in RunManager.__init__.
  • RunManager.run removed the if-clause that prevent a terminated MotionGroup from being restarted.

@rocco8773
rocco8773 marked this pull request as ready for review July 22, 2026 01:29
@rocco8773
rocco8773 merged commit 91986dc into main Jul 22, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this from Tasks to Done in BaPSF Motion Jul 22, 2026
@rocco8773
rocco8773 deleted the debug_actor_run branch July 22, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant