science_jubilee package#

Subpackages#

Submodules#

science_jubilee.Machine module#

Driver for Controlling Jubilee

class science_jubilee.Machine.Machine(port: str = None, baudrate: int = 115200, address: str = None, deck_config: str = None, simulated: bool = False, crash_detection: bool = False, crash_handler=None)[source]#

Bases: object

A class representation of Jubilee used to send motion commands and polling the machine state.

LOCALHOST = '192.168.1.2'[source]#
property active_tool_index[source]#

Return the index of the current active tool.

Returns:

The index of the current active tool. If no tool is active, returns -1.

Return type:

int

property axis_limits[source]#

Return (in XYZU order) a list of tuples specifying (min, max) axis limit

Returns:

A list of tuples specifying (min, max) axis limit

Return type:

list

Note: This list is obtained directly from the tools added to the machine’s config.g file.

property configured_axes[source]#

Return the configured axes of the machine. This is a list of all configured axis on the machine. Usually these are [‘X’, ‘Y’, ‘Z’, ‘U’]. If a tool has a an associated driver, it will be appended at the end of the axis list.

Returns:

A list of configured axes.

Return type:

list

property configured_tools[source]#

Returns a list of configured tools.

Returns:

A list of configured tools.The tool name is queried from the config.g file on the machine.

Return type:

list

Note: This list is obtained directly from the tools added to the machine’s config.g file.

connect()[source]#

Connects to Jubilee over http.

Raises:

MachineStateError – If the connection to the machine is unsuccessful.

delay_time(n)[source]#

Calculate delay time for next request. dumb hard code for now, could be fancy exponential backoff

disconnect()[source]#

Close the connection.

download_file(filepath: str = None, timeout: float = None)[source]#

Download a file into a file object. Full machine filepath must be specified. Example: /sys/tfree0.g

Parameters:
  • filepath (str, optional) – The full filepath of the file to download, defaults to None

  • timeout (float, optional) – The time to wait for a response from the machine, defaults to None

Returns:

The file contents

Return type:

file object

dwell(t: float, millis: bool = True)[source]#

Pauses the machine for a period of time.

Parameters:
  • t (float) – time to pause, in milliseconds by default

  • millis (bool, optional) – boolean, set to false to use seconds. default unit is milliseconds.

gcode(cmd: str = '', timeout=None, response_wait: float = 60)[source]#

Send a G-Code command to the Machine and return the response.

Parameters:
  • cmd (str, optional) – The G-Code command to send, defaults to “”

  • timeout (float, optional) – The time to wait for a response from the machine, defaults to None

  • response_wait (float, optional) – The time to wait for a response from the machine, defaults to 30

Returns:

The response message from the machine. If too long, the message might not display in the terminal.

Return type:

str

get_position()[source]#

Get the current position of the machine control point in mm.

Returns:

A dictionary of the machine control point in mm. The keys are the axis name, e.g. ‘X’

Return type:

dict

home_all()[source]#

Home all axes.

home_e()[source]#

Home the extruder axis (syringe)

home_in_place(*args: str)[source]#

Set the current location of a machine axis or axes to 0.

home_u()[source]#

Home the U (tool) axis

home_v()[source]#

Home the V axis

home_x()[source]#

Home the X axis

home_xyu()[source]#

Home the XYU axes. Home Y before X to prevent possibility of crashing into the tool rack.

home_y()[source]#

Home the Y axis

home_z()[source]#

Home the Z axis. Note: The deck must be clear first. Will ask for user input to verify.

load_deck(deck_filename: str, path: str = '/home/docs/checkouts/readthedocs.org/user_builds/science-jubilee/checkouts/latest/docs/../src/science_jubilee/decks/deck_definition')[source]#

Load a deck configuration file onto the machine.

Parameters:
  • deck_filename (str) – The name of the deck configuration file.

  • path (str, optional) – The path to the deck configuration .json files for the labware, defaults to the ‘deck_definition/’ in the science_jubilee/decks directory.

Returns:

A Deck object

Return type:

Deck

load_labware(labware_filename: str, slot: int, path: str = None, order: str = 'rows')[source]#
Function that loads a labware and associates it with a specific slot on the deck.

The slot offset is also applied to the labware asocaite with it.

Parameters:
  • labware_filename (str) – The name of the labware configuration file.

  • slot (int) – The index of the slot to load the labware into.

  • path (str, optional) – The path to the labware configuration .json files for the labware.

  • order (str, optional) – The order in which the labware is arranged on the deck. Can be ‘rows’ or ‘columns’, defaults to ‘rows’.

Returns:

The Labware object that has been loaded into the slot.

Return type:

Labware

load_tool(tool: Tool = None)[source]#

Add a new tool for use on the machine.

move(dx: float = 0, dy: float = 0, dz: float = 0, de: float = 0, dv: float = 0, s: float = 6000, param: str = None, wait: bool = True)[source]#

Move relative to the current position

Parameters:
  • dx (float, optional) – change in x position, in whatever units have been set (default mm)

  • dy (float, optional) – change in y position, in whatever units have been set (default mm)

  • dz (float, optional) – change in z position, in whatever units have been set (default mm)

  • de (float, optional) – change in e position, in whatever units have been set (default mm)

  • dv (float, optional) – change in v position, in whatever units have been set (default mm)

  • s (float, optional) – speed at which to move (default 6000 mm/min)

move_to(x: float = None, y: float = None, z: float = None, e: float = None, v: float = None, s: float = 6000, param: str = None, wait: bool = True)[source]#

Move to an absolute X/Y/Z/E/V position.

Parameters:
  • x (float, optional) – x position on the bed, in whatever units have been set (default mm)

  • y (float, optional) – y position on the bed, in whatever units have been set (default mm)

  • z (float, optional) – z position on the bed, in whatever units have been set (default mm)

  • e (float, optional) – extruder position, in whatever units have been set (default mm)

  • v (float, optional) – v axis position, in whatever units have been set (default mm)

  • s (float, optional) – speed at which to move (default 6000 mm/min)

park_tool(*args, **kwds)[source]#
pickup_tool(*args, **kwds)[source]#
pop_machine_state()[source]#

Recover previous machine state

property position[source]#

Returns the current machine control point in mm.

Returns:

A dictionary of the machine control point in mm. The keys are the axis name, e.g. ‘X’

Return type:

dict

push_machine_state()[source]#

Push machine state onto a stack

reload_tool(tool: Tool = None)[source]#

Update a tool which has already been loaded.

reset()[source]#

Issue a software reset.

safe_z_movement()[source]#

Move the Z axis to a safe height to avoid crashing into labware.

set_tool_offset(tool_idx=None, x=None, y=None, z=None)[source]#
split_response_objects(s)[source]#

Split text strings from gcode responses when multiple responses held in Duet buffer

tool_lock()[source]#

Runs Jubilee tool lock macro. Assumes tool_lock.g macro exists.

tool_unlock()[source]#

Runs Jubilee tool unlock macro. Assumes tool_unlock.g macro exists.

property tool_z_offsets[source]#

Return (in tool order) a list of tool’s z offsets.

Note: This list is obtained directly from the tools added to the machine’s config.g file.

Returns:

A list of tool z offsets, in the order of the tool index

Return type:

list

exception science_jubilee.Machine.MachineConfigurationError[source]#

Bases: Exception

Raise this error if there is something wrong with how the machine is configured

exception science_jubilee.Machine.MachineStateError[source]#

Bases: Exception

Raise this error if the machine is in the wrong state to perform the requested action.

science_jubilee.Machine.get_root_dir()[source]#

Return the path to the duckbot directory.

science_jubilee.Machine.machine_homed(func)[source]#

Decorator used to check if the machine is homed before performing certain actions.

science_jubilee.Machine.requires_deck(func)[source]#

Decorator used ot check if a deck has been configured before performing certain actions.

science_jubilee.Machine.requires_safe_z(func)[source]#

Decorator used to ensure the deck is at a safe height before performing certain actions.

Module contents#