science_jubilee.Machine#
Driver for Controlling Jubilee
Attributes#
Exceptions#
Raise this error if there is something wrong with how the machine is configured |
|
Raise this error if the machine is in the wrong state to perform the requested action. |
Classes#
A class representation of Jubilee used to send motion commands and polling the machine state. |
Functions#
Return the path to the duckbot directory. |
|
|
Decorator used to check if the machine is homed before performing certain actions. |
|
Decorator used ot check if a deck has been configured before performing certain actions. |
|
Decorator used to ensure the deck is at a safe height before performing certain actions. |
Module Contents#
- 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.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.
- 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]#
A class representation of Jubilee used to send motion commands and polling the machine state.
- connect()[source]#
Connects to Jubilee over http.
- Raises:
MachineStateError – If the connection to the machine is unsuccessful.
- 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:
- 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:
Note: This list is obtained directly from the tools added to the machine’s config.g file.
- 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:
- 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:
- 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:
Note: This list is obtained directly from the tools added to the machine’s config.g file.
- 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:
- load_deck(deck_filename: str, path: str = os.path.join(os.path.dirname(__file__), 'decks', 'deck_definition'))[source]#
Load a deck configuration file onto the machine.
- gcode(cmd: str = '', timeout=None, response_wait: float = 60)[source]#
Send a G-Code command to the Machine and return the response.
- Parameters:
- Returns:
The response message from the machine. If too long, the message might not display in the terminal.
- Return type:
- delay_time(n)[source]#
Calculate delay time for next request. dumb hard code for now, could be fancy exponential backoff
- 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
- home_xyu()[source]#
Home the XYU axes. Home Y before X to prevent possibility of crashing into the tool rack.
- home_z()[source]#
Home the Z axis. Note: The deck must be clear first. Will ask for user input to verify.
- _move_xyzev(x: float = None, y: float = None, z: float = None, e: float = None, v: float = None, s: float = 6000, param: str = None, wait: bool = False)[source]#
Move X/Y/Z/E/V axes. Set absolute/relative mode externally.
- 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)
- 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)
- 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)
- _get_tool_index(tool_item: int | science_jubilee.tools.Tool.Tool | str)[source]#
Return the tool index from the provided tool item.
This method is allows the user to call a toll by its index, its name, or to use a
Tool
object directly.
- load_tool(tool: science_jubilee.tools.Tool.Tool = None)[source]#
Add a new tool for use on the machine.
- reload_tool(tool: science_jubilee.tools.Tool.Tool = None)[source]#
Update a tool which has already been loaded.
- pickup_tool(tool_id: int | str | science_jubilee.tools.Tool.Tool)[source]#
Pick up the tool specified by a tool index, name or
Tool
object.- Parameters:
tool_id (Union[int, str, Tool]) – The tool index, name, or
Tool
object- Raises:
MachineConfigurationError – If the tool is not loaded on the machine.
ValueError – If the indicated tool_id is not of type Union[int, str, Tool].
- 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:
- 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