Skip to content

Instantly share code, notes, and snippets.

View ConnorRigby's full-sized avatar
🏎️

Connor Rigby ConnorRigby

🏎️
View GitHub Profile
@ConnorRigby
ConnorRigby / sequence.md
Created December 22, 2016 21:04
add name into sequence args

Changes

here is the old interface

export interface Sequence {
  kind: "sequence";
  args: {
    version: number;
  };
  comment?: string | undefined;
 body?: (MoveAbsolute

Problem

We basically have two different RPC's with the introduction of celery script.

JSON rpc (version 1.0)

  • only used over mqtt
  • most things that come with JSON RPC are converted to Celery Script anyway
  • maintaining two "interfaces" for the same thing
    • example: here is the interface for the JSONrpc version of move_absolute,
      interface RPCRequest{
        method: string;
export interface botStatus {
mcu_params: {
[name: string]: integer
};
location: [number,number,number];
pins: {
[name: string]:
{mode: 0 | 1,
value: number
}};
%Farmbot.BotState.Monitor.State{configuration: %Farmbot.BotState.Configuration.State{configuration: %{fw_auto_update: false,
os_auto_update: false, steps_per_mm: 2500, timezone: "America/Los_Angeles"},
informational_settings: %{compat_version: 0, controller_version: "2.1.8",
environment: :prod, private_ip: "loading...", target: "rpi3",
throttled: "0x0"}, locks: []},
hardware: %Farmbot.BotState.Hardware.State{end_stops: {-1, -1, -1, -1, -1, -1},
location: [-1, -1, -1],
mcu_params: %{encoder_enabled_x: 0, encoder_enabled_y: 0,
encoder_enabled_z: 0, movement_home_up_x: 0, movement_home_up_y: 0,
movement_home_up_z: 1, movement_invert_endpoints_x: 0,
def home(%{axis: "all"}, []) do
home(%{axis: "z"}, []) # <= Home z FIRST to prevent plant damage
home(%{axis: "y"}, [])
home(%{axis: "x"}, [])
end
def home(%{axis: axis}, [])
when is_bitstring(axis) do
[cur_x, cur_y, cur_z] = Farmbot.BotState.get_current_pos
speed = 100
export interface ConfigFileNetIface {
/** false means the interface is brought up, but not started.
* "hostapd" starts in host mode.
* "static" is static ip settings
* "dhcp" is dhcp ip settings
*/
type: IfaceType
default: false | "hostapd" | "static" | "dhcp";
settings: {
/** ip address for static or host mode. */
"{\"verb\":\"POST\",\"url\":\"//storage.googleapis.com/farmbot-staging/\",\"form_data\":{\"key\":\"temp1/b8333d4d-e47e-407b-92fd-073454dfd8f5.jpg\",\"acl\":\"public-read\",\"Content-Type\":\"image/jpeg\",\"policy\":\"eyJleHBpcmF0aW9uIjoiMjAxNy0wMS0xM1QyMDowMzo1NVoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJmYXJtYm90LXN0YWdpbmcifSx7ImtleSI6InRlbXAxL2I4MzMzZDRkLWU0N2UtNDA3Yi05MmZkLTA3MzQ1NGRmZDhmNS5qcGcifSx7ImFjbCI6InB1YmxpYy1yZWFkIn0seyJDb250ZW50LVR5cGUiOiJpbWFnZS9qcGVnIn0sWyJjb250ZW50LWxlbmd0aC1yYW5nZSIsMSw0MTk0MzA0XV19\",\"signature\":\"VY/brZdXTxW7SdZBp7JcvEEiMvY=\",\"GoogleAccessId\":\"GOOGSDXDNLBL7DHPNZTT\",\"file\":\"REPLACE_THIS_WITH_A_BINARY_JPEG_FILE\"},\"instructions\":\"Send a 'from-data' request to the URL provided.Then POST the resulting URL as an 'attachment_url' (json) to api/images/.\"}"

IDEA(Connor): Farmware will just be specially constructed zipfile with a json manifest? we keep the scripts in organized folders under FS.path() <> "/farmware" so we would have something along the lines of:

[/state/farmware]
|-- [plant_detection]
|    |- PlantDetection.py
|    |- farmware.json
|
interface Install {
kind: "install_farmware";
args: {
url: string;
};
body: any[];
}
interface Uninstall {
kind: "uninstall_farmware";
{
// these are the "user accessable" processes. things can only be started if they
// are indexed in here.
process_info: {
events: [
{name: "user friendly tag?", uuid: "1234-asdf-1111", status: "running"},
{name: ":+1:", uuid: "6767-1234-asdf", status: "fuuuuu"}
],
regimens: [
{name: "water plants @ 4:00 pm", uuid: "1111-aaaa-1234", status: "failed"}