I am currently working with ODrive on Windows 10, with the SENSORLESS mode and with current control.
I would like to skip the calibration procedure so that the motors don’t move each time I switch the power ON. How can I do that ?
Moreover, I might have a problem with my ST Link. The make flash works well, and if I switch the power ON the calibration works even when the ST Link is not connected (since the flash had allready been done). But if I try to send a command via USB, I have this error when the ST Link is not connected:
usb.core.USBError: [Errno None] b’libusb0-dll:err [clear_halt] could not clear halt, ep 0x01, win error: A device attached to the system is not functioning.\r\n’
If I send a command after the make flash while the ST Link is still connected everything works fine.
Do you mean the motion “move a little one way, then back again”. That is the encoder calibration that shouldn’t run in sensorless. The resistance and inductance measurement beep shouldn’t move the motor much.
Do you have the 5V or 3.3V line connected on the ST link? Please do not connect that if you are powering the main power input: try the main power input only, then flash like that.
No I only had some forward movements. Those movements came from the call to this function “spin_up_sensorless()” in the axis.cpp file.
Here is the diff file showing up the modification I made compared to the ODrive fw v.0.3.5-rc branch in order to skip the motors movements during the calibration:
I have the 3.3V line connected on the ST Link, and I disconnected it while using the main power input.
But again, if after the flash I disconnect the ST Link, the same error as before appears.
If it is only for the flash, why do I have an error when I disconnect it ?
Does the ST link have to be connected all the time ?
So spin_up_sensorless is not a calibration, it is a starting routine to get the motor up to speed before enabling senorless because sensorless only works when spinning at a minimum speed. This means that you cannot use sensorless at standstill, the motor must be spinning before you can use it.
I don’t think 3.3V should ever have to be connected, I never connect it. It would seem that it’s possibly the case that your computer’s GND is being tied to the ODrive GND through the STLink, and the ODrive’s USB cable’s GND signal is broken?
There’s no STLink related code involved in the regular ODrive communication, so this issue seems rather strange.
What’s the reproduction rate of the error if you repeat the same actions three times or so?
Does the ODrive show up in the Windows Device Manager at the time of the error?
Does the error persist after rebooting everything (ODrive and PC)?
As for the C++ API, there’s unfortunately none available yet. In the near-to-mid-term future there will be another protocol overhaul and a C++ API along with it but until then there are two options:
Use the simpler legacy protocol. This is sufficient if you only want to control the motor position or velocity over USB. You can avoid the intricacies of USB by treating the ODrive as a COM port (after setting the usbserial driver with the Zadig utility). See here for protocol details: https://github.com/madcowswe/ODrive/blob/master/Firmware/legacy-protocol.md
The error always happen when repeating the same actions and persists after reboot. And the ODrive shows up in the Windows Device Manager at the time of the error.
So I installed a clean version of all the ODrive firmware on linux ubuntu this time, with the original code of the master branch everything worked fine even with the ST Link disconnected from the computer.
Then I made the changes for the current control mode and the sensorless mode: