I want to be able to record the throttle values that were sent to my drone after a flight, then resend the same values to my drone while the drone is anchored to the ground. That way the propellers will spin in the same fashion as they did during the test flight. I’m trying to do some testing with current draw of the motors.
How can I do this? I have looked at HITL testing with QGroundcontrol and jmavsim, but it only simulates in the the flight simulator, not through the drone.
Step 1 is doing the flight and collecting the log, which I assume you know.
Step 2 could be writing a little mavlink script (python, c, etc) to read the values from the log and set the throttle in manual mode.
Or you could just view the log and manual set the throttle to the same value via RC.
So I’ve parsed my log file and have the PWM values, However, I’m having trouble sending those values to the drone.
For the Mavlink script, Do I use MavProxy to send those values to the drone?
I’ve been looking at the Mavlink documentation, and from what I understand, Mavlink messages are formatted in a .xml file. Then Mavgenerate.py takes those .xml files and generates a python utility to send those commands through a serial connection.
Do I create a .XML file with the Mavlink command to set a throttle value, then generate the python utility with MavGenerate.py and use that utility to send a pwm value?
My ideal goal would be able to write a function such as sendpwm(val, motornum), so I can put in my throttle values.
Mavlink messages are defined in xml, but the part you use is generated for each language. I would look at either pymavlink or this C example (https://github.com/mavlink/c_uart_interface_example) depending on what you’re comfortable with.