Update
This commit is contained in:
parent
cdb8f40109
commit
2495be7778
Binary file not shown.
@ -13,8 +13,8 @@ class Odrive:
|
||||
def set_zero(self):
|
||||
self.drive.axis0.encoder.set_linear_count(0)
|
||||
self.drive.axis1.encoder.set_linear_count(0)
|
||||
self.drive.axis0.controller.config.input_mode = 3
|
||||
self.drive.axis1.controller.config.input_mode = 3
|
||||
self.drive.axis0.controller.config.input_mode = 1
|
||||
self.drive.axis1.controller.config.input_mode = 1
|
||||
# self.drive.axis0.trap_traj.config.vel_limit = 100
|
||||
# self.drive.axis1.trap_traj.config.vel_limit = 100
|
||||
# self.drive.axis0.trap_traj.config.accel_limit = 50
|
||||
@ -25,8 +25,8 @@ class Odrive:
|
||||
# self.drive.axis1.controller.config.inertia = 0.02
|
||||
self.drive.axis0.controller.config.input_filter_bandwidth = 30
|
||||
self.drive.axis1.controller.config.input_filter_bandwidth = 30
|
||||
self.drive.axis0.motor.config.current_lim = 70
|
||||
self.drive.axis1.motor.config.current_lim = 70
|
||||
self.drive.axis0.motor.config.current_lim = 65
|
||||
self.drive.axis1.motor.config.current_lim = 65
|
||||
self.drive.axis0.motor.config.current_lim_margin = 30
|
||||
self.drive.axis1.motor.config.current_lim_margin = 30
|
||||
|
||||
@ -68,7 +68,9 @@ class Controller:
|
||||
self.a0_t = 0
|
||||
self.a1_t = 0
|
||||
self.v_max = self.drive.get_max_speed()
|
||||
self.y_multiplier = 1.1
|
||||
self.y_multiplier = 1.05
|
||||
self.x_multiplier = 1.95
|
||||
self.x_offset = 980
|
||||
# self.y_multiplier = 0.7
|
||||
|
||||
def calculate_angles(self, large_x, large_y):
|
||||
@ -123,7 +125,7 @@ class Controller:
|
||||
pygame.display.update()
|
||||
|
||||
if self.armed:
|
||||
self.a0, self.a1 = self.calculate_angles(mouse_y*self.y_multiplier, 990 - mouse_x*2)
|
||||
self.a0, self.a1 = self.calculate_angles(self.x_offset - mouse_x * self.x_multiplier, mouse_y*self.y_multiplier)
|
||||
self.drive.goto(self.a0, self.a1)
|
||||
|
||||
self.drive.set_idle()
|
||||
|
||||
27
stress_test.py
Normal file
27
stress_test.py
Normal file
@ -0,0 +1,27 @@
|
||||
import pygame
|
||||
import odrive
|
||||
from odrive.enums import *
|
||||
import time
|
||||
from pygame_control import Odrive
|
||||
|
||||
points = [[1.147, 2.023], [1.397, 3.556], [-0.121, 3.214], [-0.642, 1.584]]
|
||||
|
||||
class StressTest:
|
||||
def __init__(self) -> None:
|
||||
self.drive = Odrive()
|
||||
self.drive.drive.axis0.controller.config.vel_limit = 30
|
||||
self.drive.drive.axis1.controller.config.vel_limit = 30
|
||||
self.drive.set_zero()
|
||||
self.drive.set_idle()
|
||||
|
||||
def start(self):
|
||||
self.drive.set_closed_loop()
|
||||
while True:
|
||||
print(f"FET0: {self.drive.drive.axis0.fet_thermistor.temperature}")
|
||||
print(f"FET1: {self.drive.drive.axis1.fet_thermistor.temperature}")
|
||||
for p in points:
|
||||
self.drive.goto(p[0], p[1])
|
||||
time.sleep(0.3)
|
||||
|
||||
a = StressTest()
|
||||
a.start()
|
||||
Loading…
Reference in New Issue
Block a user