Motor RPM Control Project All Help Greatly Appreciated

Hi All,

I’m doing a research project at my school where I want the airflow being propelled from the props downward to be going at a specific frequency. More specificaly I want to change the speed of the motor back and forth to create this…
For example,
lets set the motors were set to spin a 100 rotations per second and a speed of x I want to try and make the motor for the first rotation spin at x-1 and the next x+1 then x-1 then x+1 and so on… so the average speed is X but is changing speed at a rate of 50 hz

any suggestions or things to try?

all help greatly appreciated :relaxed:

Using a full pixhawk is overkill IMO. Why not try something easier like this?

hi @pziyang, thanks for your help, got it to work but I want to implement it into normal flight any suggestions? how do I make a file that’ll control the quad or where are the motor control functions? Thanks for all your help

you can either try modifying fw_att module (fixed wing autopilot) or mc_att module (multicopter autopilot).

Also, you can modify sensors module (src/modules/sensors) and write to the output directly.

hi @pziyang, thanks for all your help and sorry for all the questions, I’m new to the px4 source code and am still trying to get my barrings on how to navigate it, do you have and recommendations on becoming more familiar? Also are there specific functions that control the motors?
I was looking over the files and can’t find a direct motor control, are they controlled by the pitch roll and yaw functions?
Thanks for all your help

I find this research log quite helpful (found it via google, not written by me)

Else, I’m not working on multicopter so I’m not familiar with the mixing, but i would suppose some combination of throttle, roll, pitch, yaw is used.

These are (at least in fixed wing aircraft) ATTC_Pitch/Roll/Yaw/Throttle. You can write directly to this message

Else, you can modify sensors.cpp like the following (where they inject a sweep sine into a particular channel)