OrbApi 1.0.4
Provide and OrbApi interface to an Orb running Rust from Python.

# Example

### Run Demo Script

from OrbApi.demo import demo_script
from OrbApi.constant.constant import Constant
Constant.ORB_IP = "192.168.1.35" <- You need to set this to the ip of your ORB
demo_script()

### Run a demo RGB Livestream (will save and stream RGB)

from OrbApi.rgb_livestream import rgb_livestream
rgb_livestream()

### Run a demo IR Livestream (will stream IR)

from OrbApi.ir_livestream import ir_livestream
ir_livestream()

### Create a test_script

from OrbApi.api.interface.orb_interface import OrbInterface
from OrbApi.api.functions.orb import Orb
from OrbApi.constant.constant import Constant
Constant.ORB_IP = "192.168.1.35" <- Needs to be set to your ORB IP

orb_interface = OrbInterface() <- Needs to be initialize
orb = Orb(orb_interface) <- Needs to be initialize

//Now you are ready to play!

//Example:

orb.biometric_capture.start_biometric_capture('850', 300)
orb.biometric_capture.stop_biometric_capture()

orb.mcu.set_white_leds(255)

### Create a Livestream

from OrbApi.livestream.livestream import Livestream
from OrbApi.constant.constant import Constant
Constant.ORB_IP = "192.168.1.35"

def rgb_livestream():
rgb_livestream = Livestream("rgb", port=5553, save_data=(True, "rgb_save"))
rgb_livestream.start()

# Structure

OrbApi
│   README.md
│   file001.txt
│
└───api
│   │   __init__.py
│   └───functions
│   │   │   __init__.py
│   │   │   biometric_capture.py
│   │   │   ir_camera.py
│   │   │   mcu.py
│   │   │   mirror.py
│   │   │   orb.py
│   │   │   rgb_camera.py

│   └───interface
│       │   __init__.py
│       │   command_interface.py
│       │   orb_interface.pyß
│
└───constant
│   init__.py
│   constant.py

└───livestream
│   ____init____.py
│   livestream.py

## biometric_capture

### Start

Start the biometric capture

- **function:** `start_biometric_capture`
- **Tag**: `"BiometricCapture"`
- **param:** `[cluster: str, duration: int]` -> "850", "940", "740", "850_left", "850_right", "940_left", "940_right"

### Stop

Stop the biometric capture

- **function:** `stop_biometric_capture`
- **Tag**: `"BiometricCaptureStop"`
- **param:** `None`

## ir_camera

### Shutter Left

Set the left shutter side (proto 0s and proto 1 only)

- **function:** `set_shutter_left`
- **Tag**: `"Shutter"`
- **param:** `"Left"`

### Shutter Right

Set the right shutter side (proto 0s and proto 1 only)

- **function:** `set_shutter_right`
- **Tag**: `"Shutter"`
- **param:** `"Right"`

### Camera Power ON

Turn on the IR Camera

- **function:** `camera_power_on`
- **Tag**: `"CameraPower"`
- **param:** `True`

### Camera Power Off

Turn off the IR Camera

- **function:** `camera_power_off`
- **Tag**: `"CameraPower"`
- **param:** `False`

### Camera Start Capture

Start the IR Camera capture

- **function:** `start_capture`
- **Tag**: `"Capturing"`
- **param:** `True`

### Camera Stop Capture

Stop the IR Camera capture

- **function:** `stop_capture`
- **Tag**: `"Capturing"`
- **param:** `False`

### Focus

Set the Liquid Lens Focus

- **function:** `set_focus`
- **Tag**: `"Focus"`
- **param:** `value: int` -> range is (-750, 750)

### IR Camera Framerate

Set the IR Camera Framerate

- **function:** `set_framerate`
- **Tag**: `"FrameRate"`
- **param:** `value: int` -> Value between 0 and 60

### Initialize IR Camera Capture

Initialize IR Camera Capture

- **function:** `initialize_ir_capture`
- **Tag**: `None`
- **param:** `framerate: int` -> Value between 0 and 60

## MCU

### Shutter Left

Set the white LED brightness.

- **function:** `set_white_leds`
- **Tag**: `"WhiteLedBrightness"`
- **param:** `value: int` -> Value between 0 and 255

### Set IR LEDs Duration (need to configure the led_cluster first)

Set the currently configured LED duration.

- **function:** `set_ir_led_duration`
- **Tag**: `"IrLedDuration"`
- **param:** `"value: int"`

### Configure IR LED Cluster (will only configure on MCU, not turn them on)

Configure the IR LED Cluster

- **function:** `configure_ir_led_cluster`
- **Tag**: `"IrLed"`
- **param:** `cluster: str` -> "850", "940", "740", "850_left", "850_right", "940_left", "940_right"

### Set ToF Timing

Set the timing of the ToF

- **function:** `set_tof_timing`
- **Tag**: `"TofTiming"`
- **param:** `Needs to be fixed` -> Does not do anything for now (can crash)

### Calibrate ToF

Set the ToF Calibration

- **function:** `tof_calibration
- **Tag**: `"TofCalibration"`
- **param:** `Needs to be fixed` -> Does not do anything for now (can crash)`

### Get MCU Firmware Version

Retrieve the firmware version on the main MCU. Funtion currently do not return anything.

- **function:** `get_mcu_firmware_version`
- **Tag**: `"Version"`
- **param:** `None`

## Mirror

### Set Mirror Point

Set the desired angle of the Mirrors.

- **function:** `set_mirror_point`
- **Tag**: `"SetPoint"`
- **param:** `left_horizontal: int, left_vertical: int, right_horizontal: int, right_vertical: int`

### Get MCU Firmware Version

Set the mirror to neutral position (45 degree horizontal, 0 degree vertical)

- **function:** `get_mcu_firmware_version`
- **Tag**: `"Version"`
- **param:** `None`

## Orb

### Set Mirror Point

Set the mirror to neutral position

Turn off White LEDs

Turn off IR LEDs

Set Focus to neutral (0)

- **function:** `reset_hardware`
- **Tag**: `"ResetHardware"`
- **param:** `None`

### Shutdown

Shutdown the device after a given delay (secs)

- **function:** `shutdown`
- **Tag**: `"Shutdown"`
- **param:** `delay: int`

### Start IR LEDs

Start the IR LEDs, it initialize the IR Camera, sets the Framerate, Start Capturing, and sets the LED cluster.

Thats all the step needed to start the IR LEDs as the trigger is linked to the IR Camera.

- **function:** `start_ir_leds`
- **Tag**: `None`
- **param:** `cluster_set: str, framerate: int`

### Stop IR LEDs

Turn Off IR LEDs

- **function:** `stop_ir_leds`
- **Tag**: `None`
- **param:** `None`

## rgb_camera

### Camera Power ON

Turn on the IR Camera

- **function:** `camera_power_on`
- **Tag**: `"CameraPower"`
- **param:** `True`

### Camera Power Off

Turn off the IR Camera

- **function:** `camera_power_off`
- **Tag**: `"CameraPower"`
- **param:** `False`

### Camera Start Capture

Start the IR Camera capture

- **function:** `start_capture`
- **Tag**: `"Capturing"`
- **param:** `True`

### Camera Stop Capture

Stop the IR Camera capture

- **function:** `stop_capture`
- **Tag**: `"Capturing"`
- **param:** `False`

### RGB Camera Framerate

Set the IR Camera Framerate

- **function:** `set_framerate`
- **Tag**: `"FrameRate"`
- **param:** `value: int` -> Value between 0 and 60

### Initialize RGB[](https://) Camera Capture

Initialize IR Camera Capture

- **function:** `initialize_ir_capture`
- **Tag**: `None`
- **param:** `framerate: int` -> Value between 0 and 60

## constant

ORB_IP = ""

RGB_STREAM_PORT = 5553 <- Port that Rust Uses to send the Data over ZMQ for RGB Camera

IR_STREAM_PORT = 5554 <- Port that Rust Uses to send the Data over ZMQ for IR Camera

## Livestream

init:

- name:str
- port
- save_data=False (optional, default is False)
- save_dir=None (optional, default is None thus will save the data in home directory)

start

- Run start() to see the livestream and/or save the images