Coordinates
List of coordinate Python functions in the FarmBot Python library
check_position(coordinate, tolerance)
Returns True
if the device is within the tolerance range of the provided coordinate.
if fb.check_position({"x": 0, "y": 0, "z": 0}, 1.23):
fb.toast("FarmBot is at the home position", "success")
else:
fb.toast("FarmBot is not at the home position", "warn")
garden_size()
Returns the x
, y
, and z
of the length, width, and height in mm of FarmBot’s working volume according to the AXIS LENGTH settings.
size = fb.garden_size()
fb.toast(f"Length: {size['x']}mm")
fb.toast(f"Width: {size['y']}mm")
fb.toast(f"Height: {size['z']}mm")
get_seed_tray_cell(tray_name, tray_cell)
Calculates the coordinates of a seed tray cell, such as B3
, based on the cell label and the coordinates of the center of the seed tray. See the Pick from Seed Tray featured sequence for an example.
tray_cell
should be one of the following:
| | | | |
| —— | —— | —— | —— |
| "D1"
| "D2"
| "D3"
| "D4"
|
| "C1"
| "C2"
| "C3"
| "C4"
|
| "B1"
| "B2"
| "B3"
| "B4"
|
| "A1"
| "A2"
| "A3"
| "A4"
|
cell = fb.get_seed_tray_cell("Seed Tray", "B3")
cell_depth = 5
# Send message with cell info
fb.toast(f"Picking up seed from cell {tray_cell} ({cell.x, cell.y, cell.z - cell_depth})")
# Safe Z move to above the cell
fb.move(x=cell.x, y=ell.y, z=cell.z + 25, safe_z=True)
Tray ID lookups are cached. See clearing the cache.
get_xyz()
Gets the current x, y, and z coordinates of the FarmBot.
position = fb.get_xyz()
fb.toast(f"FarmBot's X coordinate is: {position['x']}")
safe_z()
Returns the value of the SAFE HEIGHT setting.
# Display the current Safe Height
fb.toast(f"Safe Z Height: {fb.safe_z()}")
# Move FarmBot's Z-axis to the Safe Height
fb.move(z=fb.safe_z())
safe_z()
on it’s own does not initiate a movement, and it should not be confused with adding a safe_z=True
argument to a move
command.