Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stage: integrate into the system (replace NavigationController) #48

Merged
merged 18 commits into from
Dec 30, 2024

Conversation

ianohara
Copy link
Collaborator

This replaces NavigationController with AbstractStage, and starts pulling apart the different pieces that depended on signals from afar in various pieces.

Still To Do:

  • Fix click to move
  • Test all the use cases we know are actually used in HW
  • Test all the sign issues that were uncovered and make sure it is all consistent now (eg: backlash direction, dz for acquisitions, etc)

@@ -1610,1207 +1311,23 @@ def add_current_coords_to_focus_map(self):
self.focus_map_coords.append((x,y,z))
print(f"Added triple ({x},{y},{z}) to focus map")


class MultiPointWorker(QObject):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to move this back from core.multipoint.py just so we can see what actually changed, and then break core.py apart into pieces in multiple subsequent pr.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it’s time to make this independent of pyqt (remove dependence on signaling, for example for updating the illumination and channel settings)?

@@ -3785,122 +2285,6 @@ def scale_contrast_limits(self, target_dtype):
self.acquisition_dtype = target_dtype


class PlateReaderNavigationController(QObject): # Not implemented for Prior stage
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was unused. ag PlateReaderNavigationController only showed this occurence.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this obsolete and can be deleted.

# update the displacement measurement
self.measure_displacement()

def set_reference(self):
# turn on the laser
self.microcontroller.turn_on_AF_laser()
self.wait_till_operation_is_completed()
self.microcontroller.wait_till_operation_is_completed()
# get laser spot location
x,y = self._get_laser_spot_centroid()
# turn off the laser
self.microcontroller.turn_off_AF_laser()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add the wait back here.

@@ -1,216 +0,0 @@
# set QT_API environment variable
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was very broken, so delete it for now. We can restore it later.

self.navigationController.signal_joystick_button_pressed.connect(self.trackingControlWidget.slot_joystick_button_pressed)
else:
self.navigationController.signal_joystick_button_pressed.connect(self.autofocusController.autofocus)
# TODO(imo): Fix joystick after removal of navigation controller
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO needs to be addressed before merge

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the joystick buttons are not implemented in the firmware. Previously joystick is connected directly to the microcontroller (arduino). Now it’s joystick -> teensy lc -> teensy 4.1 -> computer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was broken already, so removing it for now. We can restore + fix it later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this. The malaria “app” is now in Heguang’s repo.

@@ -591,6 +591,11 @@ def analog_write_onboard_DAC(self,dac,value):
cmd[4] = value & 0xff
self.send_command(cmd)

def set_piezo_um(self, z_piezo_um):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It probably makes sense to move this here since it requires intricate knowledge of the micro dac setup. An alternative would be to figure out how to have AbstractStage handle this (eg: in its Z axis)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we’ll need to think about how to deal with the different z stage options: stepper alone, stepper + piezo, direct drive stage alone (Dover Motion DOF-5 or PI V-308), piezo alone.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @hongquanli said this actually needs to work, but hopefully the way we'd do it is to just use a PriorStage instead of CephlaStage (and then everything should just work).

The only caveat is populating any special controls for the CephlaStage and PriorStage in the ui. For that, I think we are stuck doing isinstance checks for now.

self.add_components()
self.setFrameStyle(QFrame.Panel | QFrame.Raised)

self.position_update_timer = QTimer()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one way to do position updates. It is nice because we only need to pass in pieces of the future Microscope API, and otherwise the widgets can be independent of each other.

An alternative, if we don't like the Timer/polling approach, is to define a standard collection of Signal that any Widget can assume exists and pass them as an init argument. Then each Widget can just connect itself to any of those signals if needed at init time, but doesn't need to be passed the entire machinery behind other Widgets.

ianohara added a commit that referenced this pull request Dec 30, 2024
This is starting work on the "X, Y, Z Motion stage" task in
https://www.notion.so/cephla/Headless-Mode-and-Scripting-Design-1452dfbf6ae480c3b444ee0847f532a5
.

This adds the `AbstractStage` concept, and implements the `CephlaStage`.  It also adds basic simulated stage tests.

See #48 for integration of this into the system.
@ianohara ianohara changed the base branch from ian-stage-breakout to master December 30, 2024 20:42
@ianohara ianohara marked this pull request as ready for review December 30, 2024 20:42
@ianohara ianohara merged commit 98f3f09 into master Dec 30, 2024
1 of 3 checks passed
beniroquai pushed a commit to beniroquai/octopi-research that referenced this pull request Jan 20, 2025
@ianohara ianohara deleted the ian-use-stage branch February 4, 2025 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants