Wheel encoder UART module

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

@count74,

great stuff. At the moment the WHEEL_DISTANCE mavlink messages are sent by the vehicle code (see Rover::send_wheel_encoder_distance) and the AP_WheelEncoder library is not capable of consuming this information. We should add a “MAVLink” driver to the AP_WheelEncoder library.

Did you get this working?

There was nothing about it in any changelogs. I did not check for a mavlink wheelencoder in 4.3dev yet.

1 Like