MAVlink message containing Motor PWM for serial motor controller

Can anyone tell me if there is a MAVlink message which contains the motor PWM values which the ArduRover is trying to send to the wheel motors. I am trying to use motor controllers which have a serial protocol only and do not support PWM.

I currently have an esp32 (arduino) successfully talking to a Pixhawk 2.4.8 running Rover 4.2 which is driving a couple of serial BLDC controllers in “tank mode”.

My hope was to request a mavlink message from Ardurover where I could view the desired PWM settings for the left and right motors and then control those motors instead with my esp32 but I am having trouble figuring this out. I have found the message MAV_SYS_STATUS_SENSOR_MOTOR_OUTPUTS on the mavlink.io site but not a lot of supporting information with it.

I know I can read the pwm on a 5v arduino and control the motors via serial ports that way but I want to do other MAVlink based things with an AI camera in the future so am trying to keep my parts count down if this is possible. Thanks in advance for any help here.

1 Like

Hi,
although i cannot help you for the rest of the project, you can find the output PWM in the Mavlink message SERVO_OUTPUT_RAW
https://mavlink.io/en/messages/common.html#SERVO_OUTPUT_RAW

1 Like

Oh and I think you can control your motors using RC_CHANNELS_OVERRIDE
https://mavlink.io/en/messages/common.html#RC_CHANNELS_OVERRIDE

Thanks a lot. I think that might be just what I needed.

Update: Yes that was exactly what I needed. Thanks a lot:

3 Likes

very cool, let me know when you get something working I would be happy to test it.

I will do so. You can get my latest code which is a hack of Paul Jeffress test platform here: GitHub - jberezin/Pulsar-MAVLink-Tester: trying to port this to work with TTGO T1 esp32 dev board

I just updated it a few minutes ago. My next step will be to move the system from TELEM1 to TELEM2 so I can put my regular telemetry back on my system, and then move from the test progam to a Mavlink to Serial translator. I think I also need to increase my Mavlink message frequency because it looks like a one second interval will be to slow for motor control.

what firmware are you running on your hoverboard?

I am running this: GitHub - EFeru/hoverboard-firmware-hack-FOC: With Field Oriented Control (FOC)

Serial Variant

1 Like

Cool, I’m already running the PWM variant. Are you going to try and get telemetry from the controllers?

No I was going to use the esp32 as a bridge to speak mavlink to Ardurover, and use the existing serial protocol to control the hoverboard controllers. I was toying with the idea of using Alex Marakov’s variant of the EFeru build to get wheel odometry but it isn’t in my critical path because I am using RTK gps and can live without it for now.

Also, I hadn’t thought about adding mavlink telemetry to the hoverboard build and I’m not sure how much available code space I have on those STM32F103 chips.

My original plan for them is going to be to use yuris i2c unsupported sensor adapter to read its telemetry into ardupilot and read SBUS in for RC,

DSHOT emulation would be nice, then we could feed esc telemetry directly into ardupilot natively.