Exemplo n.º 1
0
 def populate(self, serial: str) -> None:
     """
     Find the connected DIGIT based on the serial number and populate device parameters into the class
     :param serial: DIGIT serial number
     :return:
     """
     digit = DigitHandler.find_digit(serial)
     if digit is None:
         raise Exception(f"Cannot find DIGIT with serial {self.serial}")
     self.dev_name = digit["dev_name"]
     self.manufacturer = digit["manufacturer"]
     self.model = digit["model"]
     self.revision = int(digit["revision"])
     self.serial = digit["serial"]
Exemplo n.º 2
0
# This source code is licensed under the license found in the LICENSE file in the root directory of this source tree.

import logging
import pprint
import time

import cv2

from digit_interface.digit import Digit
from digit_interface.digit_handler import DigitHandler

logging.basicConfig(level=logging.DEBUG)

# Print a list of connected DIGIT's
digits = DigitHandler.list_digits()
print("Connected DIGIT's to Host:")
pprint.pprint(digits)

# Connect to a Digit device with serial number with friendly name
digit = Digit("D12345", "Left Gripper")
digit.connect()

# Print device info
print(digit.info())

# Change LED illumination intensity
digit.set_intensity(0)
time.sleep(1)
digit.set_intensity(255)
Exemplo n.º 3
0
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.

# This source code is licensed under the license found in the LICENSE file in the root directory of this source tree.

import logging
import pprint
import time

from digit_interface.digit import Digit
from digit_interface.digit_handler import DigitHandler

logging.basicConfig(level=logging.DEBUG)

# Print a list of connected DIGIT's
digits = DigitHandler.list_digits()
print("Connected DIGIT's to Host:")
pprint.pprint(digits)

# Connect to a Digit device with serial number with friendly name
digit = Digit("D12345", "Left Gripper")
digit.connect()

# Maximum value for each channel is 15
rgb_list = [(15, 0, 0), (0, 15, 0), (0, 0, 15)]

# Cycle through colors R, G, B
for rgb in rgb_list:
    digit.set_intensity_rgb(*rgb)
    time.sleep(1)

# Set all LEDs to same intensity