Пример #1
0
    def __init__(self, hardware):
        self.id = _get_uuid()
        self.pipettes = {}
        self.current_mount = None
        self.current_model = None
        self.tip_length = None
        self.points = {k: None for k in expected_points().keys()}
        self.z_value = None
        self.cp = None
        self.pipette_id = None
        self.adapter = hardware.sync
        self.current_transform = identity_deck_transform()

        robot_configs.backup_configuration(self.adapter.config)
        # Start from fresh identity matrix every calibration session
        self.adapter.update_config(gantry_calibration=list(
                map(lambda i: list(i), self.current_transform)))
Пример #2
0
async def save_transform(data):
    """
    Calculate the transormation matrix that calibrates the gantry to the deck
    :param data: Information obtained from a POST request.
    The content type is application/json.
    The correct packet form should be as follows:
    {
      'token': UUID token from current session start
      'command': 'save transform'
    }
    """
    if any([v is None for v in session.points.values()]):
        message = "Not all points have been saved"
        status = 400
    else:
        # expected values based on mechanical drawings of the robot
        expected_pos = expected_points()
        expected = [
            expected_pos[p] for p in expected_pos.keys()]
        # measured data
        actual = [session.points[p] for p in sorted(session.points.keys())]

        # Generate a 2 dimensional transform matrix from the two matricies
        flat_matrix = solve(expected, actual).round(4)

        # replace relevant X, Y and angular components
        # [[cos_x, sin_y, const_zero, delta_x___],
        # [-sin_x, cos_y, const_zero, delta_y___],
        # [const_zero, const_zero, const_one_, delta_z___],
        # [const_zero, const_zero, const_zero, const_one_]]
        session.current_transform = add_z(flat_matrix, session.z_value)

        session.adapter.update_config(gantry_calibration=list(
                map(lambda i: list(i), session.current_transform)))

        robot_configs.save_deck_calibration(session.adapter.config)
        robot_configs.backup_configuration(session.adapter.config)
        message = "Config file saved and backed up"
        status = 200
    return web.json_response({'message': message}, status=status)
Пример #3
0
def backup_configuration(hardware, tag):
    robot_configs.backup_configuration(hardware.config, tag)