rosflight_firmware
rosflight_firmware copied to clipboard
Can't fly the drone
I've modified the firmware adding the possibility to arm and control the drone directly from the companion computer, thus not needing any rc at all (even if it is an hazard); i'm trying to fly with a simple algo for altitude holding done by a pid controller that gets altitude from an ir sensor and sends a message with a 0 setpoint for the angles and the trottle as control variable. My issue is that as soon as i send the take off command the drone start flipping at max throttle; i've seen other already opened issues on this, and i saw that i had to set properly the axis of the flight controller, but i have a doubt: flat drone should have a -9.8 acc on the z, +9.8 on the x when pitching up 90 deg and +9.8 on the y when rolling left 90 deg, but how should i orient the drone when checking the accelerations? i did that holding the drone from the back props, so pointing away from me and the drone flipped in the roll direction continuously when i did a test flight. I didn't try inverting the direction of the y axis and flying again because at this point crashes are too violent and i'm worried about breaking the raspberry pi. I thought it might also be an issue related to the pid parameters of the provided controller, i've red on the docs that the standard values for the pid parameters should work reasonably well but that it also depends on the torque/mass ratio, and my drone is quite lite and powerful: it has 2207 2550kv motors with a 4s 80C battery and a 40A esc board. I was thinking it might have a too high gain and when it tries to correct small deflections it goes full gas.
I checked the imu data with rqt plot and it works well, it can detects also small high freq vibrations (for example when punching the table the drone is on), i don't know if that combined with a too high gain might be an issue, Another thing i thought about is esc calibration, but i'm using a diatone mamba 4 in 1 esc board with DSHOT, so it should work with digital signals and no neeed for calibration, but i'm not sure about this point.
To check if the issue was related to the boards not working properly/ the imu being too sensitive a tried running everything without props and holding the drone in my hand: the algorithm works as expected and there is no issues with motors, i can hear small corrections as the drone wobbles around but nothing goes crazy.
I thought it might also be the MOTOR_PWM_UPDATE parameter since i don't know which values i should set it to, but i think that if it wasn't properly set i should have experienced issues also without props. The MIXER parameter is set to 2 (it's a quadx frame), motors are spinning in the right directions.
At this point i don't know what to do, hope you can help