[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -127,14 +127,14 @@ NUM_WRITE_RETRY = 20
|
|||||||
|
|
||||||
def convert_ticks_to_degrees(ticks, model):
|
def convert_ticks_to_degrees(ticks, model):
|
||||||
resolutions = MODEL_RESOLUTION[model]
|
resolutions = MODEL_RESOLUTION[model]
|
||||||
# Convert the ticks to degrees
|
# Convert the ticks to degrees
|
||||||
return ticks * (360.0/resolutions)
|
return ticks * (360.0 / resolutions)
|
||||||
|
|
||||||
|
|
||||||
def convert_degrees_to_ticks(degrees, model):
|
def convert_degrees_to_ticks(degrees, model):
|
||||||
resolutions = MODEL_RESOLUTION[model]
|
resolutions = MODEL_RESOLUTION[model]
|
||||||
# Convert degrees to motor ticks
|
# Convert degrees to motor ticks
|
||||||
return int(degrees * (resolutions/360.0))
|
return int(degrees * (resolutions / 360.0))
|
||||||
|
|
||||||
|
|
||||||
def adjusted_to_homing_ticks(
|
def adjusted_to_homing_ticks(
|
||||||
@@ -158,7 +158,7 @@ def adjusted_to_homing_ticks(
|
|||||||
drive_mode = 0
|
drive_mode = 0
|
||||||
if motorbus.calibration is not None:
|
if motorbus.calibration is not None:
|
||||||
drive_mode = motorbus.calibration["drive_mode"][motor_id - 1]
|
drive_mode = motorbus.calibration["drive_mode"][motor_id - 1]
|
||||||
|
|
||||||
if drive_mode:
|
if drive_mode:
|
||||||
ticks *= -1
|
ticks *= -1
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ def adjusted_to_motor_ticks(
|
|||||||
drive_mode = 0
|
drive_mode = 0
|
||||||
if motorbus.calibration is not None:
|
if motorbus.calibration is not None:
|
||||||
drive_mode = motorbus.calibration["drive_mode"][motor_id - 1]
|
drive_mode = motorbus.calibration["drive_mode"][motor_id - 1]
|
||||||
|
|
||||||
if drive_mode:
|
if drive_mode:
|
||||||
adjusted_pos *= -1
|
adjusted_pos *= -1
|
||||||
|
|
||||||
@@ -508,7 +508,6 @@ class FeetechMotorsBus:
|
|||||||
values = np.round(values).astype(np.int32)
|
values = np.round(values).astype(np.int32)
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
def read_with_motor_ids(self, motor_models, motor_ids, data_name, num_retry=NUM_READ_RETRY):
|
def read_with_motor_ids(self, motor_models, motor_ids, data_name, num_retry=NUM_READ_RETRY):
|
||||||
if self.mock:
|
if self.mock:
|
||||||
import tests.mock_scservo_sdk as scs
|
import tests.mock_scservo_sdk as scs
|
||||||
@@ -736,4 +735,3 @@ class FeetechMotorsBus:
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
if getattr(self, "is_connected", False):
|
if getattr(self, "is_connected", False):
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def run_full_arm_calibration(arm: MotorsBus, robot_type: str, arm_name: str, arm
|
|||||||
print(f"\n calibration of {robot_type} {arm_name} {arm_type} done!")
|
print(f"\n calibration of {robot_type} {arm_name} {arm_type} done!")
|
||||||
|
|
||||||
# Force drive_mode values: motors 2 and 5 -> drive_mode 1; all others -> 0. 1 = clockwise = positive range (0..180), 0 = clockwise = negative range (0..-180)
|
# Force drive_mode values: motors 2 and 5 -> drive_mode 1; all others -> 0. 1 = clockwise = positive range (0..180), 0 = clockwise = negative range (0..-180)
|
||||||
drive_modes = [0, 1, 0, 0, 1, 0]
|
drive_modes = [0, 1, 0, 0, 1, 0]
|
||||||
|
|
||||||
calib_dict = {
|
calib_dict = {
|
||||||
"homing_offset": encoder_offsets.astype(int).tolist(),
|
"homing_offset": encoder_offsets.astype(int).tolist(),
|
||||||
|
|||||||
Reference in New Issue
Block a user