Пример #1
0
home_degree = [75, 72, 75, 100, 70, 85]  #angulos para home

servos = []

for i in range(6):
    servos.append(
        servo.Servo(pca.channels[pca_channels[i]], min_pulse=a, max_pulse=b))
    servos[i].angle = home_degree[i]
    t.sleep(0.5)

import borra_functions as bf
import numpy as np
import math
from time import sleep

base_points = bf.base_points(base_length)

angles = [0.0, 0.0, 0.0]
translation = [0, 0, 110]

print("Done ...")
sleep(0.5)


#Ticker
class ticker(object):
    def __init__(self, initial=0, update_interval=0.001):
        self.ticker = initial
        self.update_interval = update_interval

    def init(self):
import borra_functions as bf
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from time import sleep
import importlib
###Create a new figure to graph  3D

#Draw base
base_points = bf.base_points(92)

#Draw plate
plate_points = bf.plate_points(72.91,6,[0,-6,0],[0,0,117])
#Draw servo
servo_links = [16.46,117.22]

theta1,theta2= bf.get_servo_angle(plate_points,servo_links,base_points)

#print("\n{}Finalizo correctamente{}".format("-"*35,"-"*35))
#for i in range(6):
#    print("Punto {}:\n    theta1 = {}\n    theta2 = {}".format(i,theta1[i],theta2[i]))
    

#####Graficar
plt.ion()
fig = plt.figure()
ax = fig.add_subplot(111,projection='3d')
bf.draw_axis(110,110,220,ax,fig)

bf.draw_by_points(base_points,ax,fig,'orangered')
bf.draw_by_points(plate_points,ax,fig,'dodgerblue')