Conversation
|
Will test on hardware in the next days. |
| self.pre_homing: bool = pre_homing | ||
| """Moves motors to safe position before homing.""" | ||
|
|
||
| self.pre_homing_direction: float = pre_homing_direction |
There was a problem hiding this comment.
Shouldn't this direction be specified per motor?
| for motor in self.motors: | ||
| motor.pre_home(self.pre_homing_direction) | ||
| elif self.sequential_homing: | ||
| next(self.motors_unhomed).home() |
There was a problem hiding this comment.
Don't you need to recreate the motors_unhomed iterator here? Homing can be called more than once per Being lifetime.
|
|
||
| def next_homing(self): | ||
| """Controls one by one homing.""" | ||
| if any(motor.homing_state() is HomingState.ONGOING for motor in self.motors): |
There was a problem hiding this comment.
I thought you may want to pass the motor instance (and probably the event type too) to this method in subscribe() like it's done in server.py - then you know directly which event you are reacting to and don't need to scan all motors.
| try: | ||
| next(self.motors_unhomed).home() | ||
| except StopIteration: | ||
| self.logger.debug('All motors are homed.') |
There was a problem hiding this comment.
This message may deserve level 'info'.
| self.logger.debug('pre_home()') | ||
| if self.homing.ongoing: | ||
| self.homing.stop() | ||
| self.wasEnabled = False # Do not re-enable motor since not homed anymore |
There was a problem hiding this comment.
Don't see a use of this variable anywhere.
| self.logger.info('home_motors()') | ||
| for motor in self.motors: | ||
| motor.home() | ||
| if self.pre_homing: |
There was a problem hiding this comment.
Interaction of pre-homing with homing is not totally clear, for instance here it looks like you either use pre-homing or sequential homing or parallel homing - whereas in fact pre_homing apparently will trigger homing internally. I'm wondering if there is a better place for all pre-homing-related as an extension of existing methods in homing.py.
|
Additional observations after testing:
|
|
Implements 2 features: