This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dataclasses import dataclass | |
import os | |
import sys | |
import termios | |
import time | |
import tty | |
from lerobot.common.robot_devices.motors.feetech import FeetechMotorsBus as MotorBus | |
PORT = "/dev/tty.usbmodem<YOUR PORT>" # Put YOUR port here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from lerobot.common.robot_devices.motors.feetech import FeetechMotorsBus as MotorBus | |
PORT = "/dev/tty.usbmodem<INSERT YOUR PORT>" # Put YOUR port here | |
BAUDRATE = 1_000_000 | |
MODEL = "sts3215" | |
MAX_MOTOR_ID = 10 # S100 only has 6... | |
SCAN_IDS = list(range(1, MAX_MOTOR_ID)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from typing import ( | |
List, | |
Dict, | |
Callable, | |
Union, | |
) | |
import numpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
def first_non_whitespace_index(lineText): | |
''' Find the index of the first non-whitespace character on line. ''' | |
pat = re.compile(r'(\s*)(\S)') | |
m = pat.match(lineText) | |
if m: | |
# start(2) gets start of 2nd group | |
return m.start(2) | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
USAGE: | |
Let's say you have a "find_words_with_letter" function (not method) in a script called "script_name.py"... | |
def find_words_with_letter(fileName, letter = "g"): | |
#fxn code here | |
...you can then call the function in the script from the command line - function name 1st argument, function args follow. |