How to connect FOC driver to Pixhawk?

Hello everyone,

I’m currently working on building a Pixhawk-based autonomous rover. The initial setup with the Rover firmware on a Pixhawk 6C went smoothly, but I’ve run into a challenge: my motor drivers use the FOC (Field-Oriented Control) protocol, and it seems that Pixhawk doesn’t have direct/native support for it.

My idea was to integrate a Raspberry Pi as a companion computer, with the plan to subscribe to the topics exchanged between QGroundControl and Pixhawk, and then channel those commands to the FOC-based motor drivers.

Has anyone here tried something similar—either connecting FOC-controlled motors with Pixhawk, or working with the MAVLink/QGC topics for custom motor control?

Any guidance, experiences, or suggestions would be greatly appreciated!
Thanks in advance for your help.

I think you have some confusion about the control architecture. FOC is a control method not a protocol. The ESC firmware performs the FOC. The protocol between FC and ESC is PWM/DShot/etc. The Flight controller updates the PWM/DShot control signal from the estimation/control pipeline in FC firmware. Generally a companion computer like the Pi is sending position/velocity/attitude setpoints. My advice is to spend a couple of days learning about the architectural stack from ESCs to GCSs and understand how the various pieces interact. I would suggest using an LLM as a tutor.

Hey, thanks for the advice. The actual issue i am facing is having a FD CAN interface for my BLDC driver (Moteus n1) which natively operates on FOC. By any chance do you know how to connect FD CAN ESC to a Pixhawk 6c ?

The ESC will need to support the DroneCAN protocol (which it looks like that one does not). But it also looks like the firmware is open source so I would ask the question in that community.

Check out these doc pages on DroneCAN

Quick update on the issue!

Thanks for the advice again. we managed to command the wheels by using a companion computer between Pixhawk and wheel motors. Though it is an open loop system, it is doing the job for now.

For all the people who are trying to connect a motor with communication protocols that pixhawk doesn’t support, PWM is the way to go.
Good luck!stereo camera