Is it possible to implement some kind of sound features like the beep after the motor calibration method ?
For some robots or devices without rich interfaces it would be nice to make some sound if something is ready or in kind of failure.
What do you think about this?
The ‘beep’ is not a deliberately audible noise, but a side-effect of measuring the motor inductance using an AC signal during calibration.
You could add a beep as a current offset e.g. using the feed-forward terms of the usual commands.The main control loop runs at 8kHz so you would be limited to frequencies of 4kHz, 2kHz, 1kHz and maybe some in between may be possible.
Thanks for your help
Unfortunately i couldn’t find any good information what the feedforward terms actually mean. Did you mean the Torque FF…
Cloud you give me a hand again?
Maybe an example?
Yes, I mean the torque FF.
See Control | ODrive - The FF terms add an offset to the inner loops (torque or velocity) which can be useful if you are trying to do model-based control, or something like this (vibrate the motor while holding position)
But my suggestion only works if you are able to send commands to the ODrive at an extremely high rate (e.g. over CAN)
So for example:
bustype = 'socketcan'
channel = 'can1'
bus = can.interface.Bus(channel=channel, bustype=bustype)
ODCMD_SET_INPUT_POS = 0x00c
def odrive_can_cmd(node_id, cmd_id, data=, format=''):
data_frame = struct.pack(format , *data)
msg = can.Message(arbitration_id=((node_id << 5) | cmd_id), data=data_frame, is_extended_id=False)
node_id = 10
pos = 0
tff = 0
freq = 200
ampl = 1
t0 = time.time()
t = 10
# Send position 0 with a sinusoidal torque offset
while(time.time() - t0 < t):
tff = math.sin((time.time() - t0)*2*math.pi*freq) * ampl
odrive_can_cmd(node_id, ODCMD_SET_INPUT_POS, [pos, 0, tff], 'fhh')
time.sleep(0.001) # update at ~1kHz
really nice example, thanks for that!
I use a raspi and SPI CAN adapter, but i am unable to reproduce a nice sound noise.
I am unable to update the odrive fast enough even with CAN interface, the motor just sounds like a low frequency vibration noise. If i increase the updating frequency i get CAN buffer overflow errors due to too high data-rate.
Maybe we can increase the CAN bus data rate, but with this method we block the whole CAN bus just for making an beep .
Some thing like axis0.makeBeep(amp,frequency) would be nice. Maybe we have such a feature sometimes in the future. But for now I will go with an external buzzer.
It would be a nice feature for a simple user interaction for some robots.
Like the RC ESCs do (make some nice sound if the esc is ready)