Update
This commit is contained in:
parent
a35c0ceb22
commit
c65b1e9a78
@ -7,7 +7,7 @@ from odrive.enums import (AXIS_STATE_IDLE,
|
|||||||
INPUT_MODE_POS_FILTER)
|
INPUT_MODE_POS_FILTER)
|
||||||
|
|
||||||
odrive_params = {
|
odrive_params = {
|
||||||
'current_lim': 10, # A
|
'current_lim': 50, # A
|
||||||
'vel_lim': 60000, # Rev/s
|
'vel_lim': 60000, # Rev/s
|
||||||
'accel_lim': 1000000/1.2,
|
'accel_lim': 1000000/1.2,
|
||||||
'decel_lim': 1000000/1.2,
|
'decel_lim': 1000000/1.2,
|
||||||
@ -31,21 +31,21 @@ class Motors:
|
|||||||
self.params = params
|
self.params = params
|
||||||
if odrive_sn:
|
if odrive_sn:
|
||||||
try:
|
try:
|
||||||
self.odrive = odrive.find_any(serial_number=odrive_sn)
|
self.drive = odrive.find_any(serial_number=odrive_sn)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logging.error(f"Encountered error: {err}")
|
logging.error(f"Encountered error: {err}")
|
||||||
else:
|
else:
|
||||||
self.odrive = odrive.find_any()
|
self.drive = odrive.find_any()
|
||||||
self.enable_estop()
|
self.enable_estop()
|
||||||
self.set_parameters()
|
self.set_parameters()
|
||||||
logging.info(f"Odrive ready, voltage: {self.drive.vbus_voltage}V")
|
logging.info(f"Odrive ready, voltage: {self.drive.vbus_voltage}V")
|
||||||
|
|
||||||
def digital_estop(self):
|
def digital_estop(self, *_):
|
||||||
axis0 = self.odrive.axis0
|
axis0 = self.drive.axis0
|
||||||
axis1 = self.odrive.axis1
|
axis1 = self.drive.axis1
|
||||||
axis0.requested_state = AXIS_STATE_IDLE
|
axis0.requested_state = AXIS_STATE_IDLE
|
||||||
axis1.requested_state = AXIS_STATE_IDLE
|
axis1.requested_state = AXIS_STATE_IDLE
|
||||||
logging.warn('Estop triggered, motors set to Idle')
|
logging.warning('Estop triggered, motors set to Idle')
|
||||||
|
|
||||||
def enable_estop(self):
|
def enable_estop(self):
|
||||||
signal.signal(signal.SIGINT, self.digital_estop)
|
signal.signal(signal.SIGINT, self.digital_estop)
|
||||||
@ -61,7 +61,7 @@ class Motors:
|
|||||||
axis.trap_traj.config.vel_limit = self.params.get('vel_lim', 1)
|
axis.trap_traj.config.vel_limit = self.params.get('vel_lim', 1)
|
||||||
axis.trap_traj.config.accel_limit = self.params.get('accel_lim', 1)
|
axis.trap_traj.config.accel_limit = self.params.get('accel_lim', 1)
|
||||||
axis.trap_traj.config.decel_limit = self.params.get('decel_lim', 1)
|
axis.trap_traj.config.decel_limit = self.params.get('decel_lim', 1)
|
||||||
axis.controller.config.input_filter_bandwidth = self.params.get('pos_filter', 2)
|
# axis.controller.config.input_filter_bandwidth = self.params.get('pos_filter', 2)
|
||||||
|
|
||||||
def run_calibration(self):
|
def run_calibration(self):
|
||||||
self.drive.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
|
self.drive.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user