Closed valegagge closed 4 months ago
After some knowledge transfer done with @ale-git, we understood that some changes should be done to the heuristic use in the method of the 2FOC where we perform the stator-rotor calibration looking for the index of the quadrature encoder mounted at the motor side of the joint.
The whole portion of code we are interested in is at this lines: https://github.com/robotology/icub-firmware/blob/master/emBODY/eBcode/arch-dspic/board/2foc/appl/2FOC-V3/src/2FOC.c#L353-L520
Here a brief explanation of what should we modified and what probably was the cause of the failing of the calibration procedure.
stator-rotor offset
, so we are just looking for the index of the encoder and setting the zero at that position, we are just passing through the steps of the state machine defined by values 0-1-2
of the variable sAlignInProgress
. So in this case we can limit our analysis to the lines here.stairs-like
curve, which defined here: https://github.com/robotology/icub-firmware/blob/master/emBODY/eBcode/arch-dspic/board/2foc/appl/2FOC-V3/src/2FOC.c#L383 and used in the if clauses with this value: https://github.com/robotology/icub-firmware/blob/master/emBODY/eBcode/arch-dspic/board/2foc/appl/2FOC-V3/src/2FOC.c#L391alignRotor
method occurs in the DMA interrupt service routine, we are basically moving the fast shaft with half of the speed.not calibrated
state we saw from the raw data that:
In conclusion, I did some tests by reducing the value of the timer for our setup where the number of motor poles is more than the double with respect to the motor in the robot and I was able to always finding the index. Thus, we need to revise together the heuristic used and parametrized the timing so that we are good in all hw configurations
cc: @valegagge @ale-git
Hi @MSECode , thanks for the explanation and tests.
Which value of the timer did you use in the test on the ergocub2 joints?
Moreover, I suggest to go on in two steps:
what di you think?
On our joints I just changed the value of the timer to 50. In this manner I should be able to complete the full state machine calibration in 27 seconds. Considering that if I need to complete the 1,5 revolution to one side and to the other with joints with 3600 electrical deg per revolution and considering that the 2foc loop is running at 50 us. We have that, with 50 cycles per loop, we can make the 10800 electrical deg in 27 seconds. So I'll try with this value, which should be more than enough for the robot too and then we can parametrized it to make it scalable with respect to the number of motor poles different joints have. So the step you have defining are good.
Hi @MSECode , please add here the reference to the updated code.
Is your code already tested?
I'm gonna re-check it since I've done some tests but that was some weeks ago
PR opened here: https://github.com/robotology/icub-firmware/pull/503
PR merged. Closing
After some tested carried on in https://github.com/icub-tech-iit/ergocub2-design-upperbody/issues/43, we noticed that sometimes joint couldn' t complete the calibration because it doesn't find the index before the timeout of 30 seconds exipre.
We noticed that the motor does 3 or 4 complete tourns but the index interrupt isn't t triggered. So we need to create a setup with the oscilloscope to verify the index signal.
Moreover, in the procedure, some time constants need to be updated (or parametrized) since the 2foc now runs at 20KHz and not 40 KHz.
For more details please see this comment.
Dod The new procedure runs correctly both on the robot and on ergocub2 joints