I’m not sure if you’re aware but teensy 4.x have hardware quadrature counters built into the chip. And a Library to use them. I’ve looked into implementing this on a teensy for linear movement applications(both motor and screw), however the simplefoc seems to handle the encoder using angles instead of encoder counts.
Would it be hard implement a function to commad the motor via encoder counts instead of angles? Counts/sec for velocity and counts for position? This is a bit more intuitive way to handle step/dir input and other linear motion.
You can convert radians or degrees to steps. The field moves relative to the poles of the motor and I believe that is why the angles are in radians. It is not hard to convert to degrees or steps. The encoder counting (hardware/software) doesn’t really have anything to do with the use of radians.
I’m aware you can convert them. Just by reading through the development docs, I’m wondering if it’s hard to implement a new controlType for the logic to use steps since linear motors don’t use angles and steps equal length moved.
I guess this is really two separate issues, implementing a new encoder class using the hardware library, which should fairly easy?. And implementing a new position controlType using steps instead of angles.
it is open source so submit a pull request!
i think it is a good idea to create a hardware counter encoder class. It would be beneficial for stm32 and teensy.
Very hardware specific, but very beneficial.
If you have a code which works well for teensy I’d be happy to take a look.
The same is true for 6pwm mode, it is not supported by the teensy at the moment. Since I dont have one I cannot really test.
I’ll need to get the hardware up and running first to properly test and develop things. Yes this is pretty hardware specific and I have no way(or skill) to make it multiplatform. Mind you I’m not an experienced developer so this is going to take some time
I’ve made a fork that I’ll be developing so you can follow my (mis)adventures there. So far I’ve figured I’ll be adding a new encoder class to handle the register reading and other functions related to to that hardware library and new controlType to handle the steps -> radii conversion to make it easier on myself.
This is the project in currently working on: www.instructables.com/DIY-IRONLESS-LINEAR-SERVO-MOTOR/