increase limitation

This commit is contained in:
Zhengyu Peng
2021-12-09 20:51:04 -05:00
parent 0a83d5e7fb
commit 9eed4f8a21
2 changed files with 16 additions and 9 deletions

View File

@ -1,20 +1,23 @@
# -*- coding: utf-8 -*-
import numpy as np
class Leg:
def __init__(self,
id,
junction_servos,
correction=[0, 0, 0],
constraint=[[45, 135], [45, 165], [30, 150]]):
constraint=[[35, 145], [30, 165], [30, 150]]):
self.id = id
self.junction_servos = junction_servos
self.correction = correction
self.constraint = constraint
def set_angle(self, junction, angle):
set_angle = min(
angle+self.correction[junction], self.constraint[junction][1])
set_angle = max(set_angle, self.constraint[junction][0])
set_angle = np.min(
[angle+self.correction[junction], self.constraint[junction][1]+self.correction[junction], 180])
set_angle = np.max(
[set_angle, self.constraint[junction][0]+self.correction[junction], 0])
self.junction_servos[junction].angle = set_angle
def move_junctions(self, angles):