Hi,
since only a few FCs support wheel encoders directly and all but the Pixhawk 1 (clones) are rather expensive, I decided to quickly write (copy together…) an arduino script.
The script uses the simpleFOC library to read two quadrature encoders, calculate the distance for each wheel and then sends the result as a mavlink message over UART.
I wrote the script for a STM32F103 bluepill, but it should run on other hardware, too.
There are some questions I could not answer myself: @rmackay9
How should I setup the WENC parameters?
Right now I have set WENCX_type to quadrature (1) and all pins to -1. This causes the Pixhawks “wheel_distance” message to disappear. (There were two messages before in MPs Mavlink Inspector)
Are the encoder position parameters used for the “wheel_distance” message received through UART?
There is no “Mavlink” encoder type and setting WENCX_type to “none” causes all WENC parameters to disappear.
https://drive.google.com/file/d/1K2RrkyWL3LJtQpFZOUa30npBuHPjd6PP/view?usp=sharing