Can I control PWM signals to esc directly via Mavlink?

So I’ve set up a test bench, that includes a load cell that I’m using to measure thrust from a quadcopter. I’ve been able to control PWM signals via the actuator panel within QGroundcontrol, by setting the aux1-4 to Constant Min and manually adjusting the Min value. Information can be found here. This works, but its not ideal and I was hoping I could set these values directly in software.

I’m familiar with QGroundControl, but I have never used Mavlink before. So I’m not sure if this is possible or where I would start looking. I did start looking at the pymavlink documentation and I don’t see anything about constant min/max

I would want to use Pymavlink to accomplish this.

The goal is to be able to read the thrust from the load sensor, and adjust the PWM so that I can maintain a consistent thrust value without any additional stablization from the flight controller.

I’m assuming you’re using PX4 (and not ArduPilot, otherwise ask in discuss.ardupilot.org).

You should be able to use the command MAV_CMD_DO_SET_ACTUATOR, e.g. in pymavlink.

Or in MAVSDK-Python it would be:
http://mavsdk-python-docs.s3-website.eu-central-1.amazonaws.com/plugins/action.html#mavsdk.action.Action.set_actuator

1 Like

Yes, correct, I am using PX4.

Thank you, I will dig into your recommendation!

hello, I also want to directly control the pwm signal and now i am using the pymavlink,
I am able to send command to arm and disarm the vehicle,
but when i want to use MAV_CMD_DO_SET_ACTUATOR it throws an error
AttributeError: module ‘pymavlink.dialects.v10.ardupilotmega’ has no attribute ‘MAV_CMD_DO_SET_ACTUATOR’
I check the file in the site_packages/pymavlink/dialects/common.xml ,there is not the CMD_VALUE, did i do it wrong?

Have you updated pymavlink?

Hi, I have also run into this with pymavlink: AttributeError: module ‘pymavlink.dialects.v10.ardupilotmega’ has no attribute ‘MAV_CMD_DO_SET_ACTUATOR’ have you found a solution?

Does anyone know if you can change dialects to pixihawk/px4 in pymavlink?