Drone control with code

I want to control my drone with a simple code. After I lift my drone, the code works fine in sitl, but it doesn’t actually react at all. What’s the problem here? I tried both stabilize and alt_hold modes, but there is no result. I am adding the code and parameters below.

code.zip (7.8 KB)

You need to use guided flight mode.

Yes, this worked, but how can I make it perform roll pitch and yaw movements at certain speeds? My drone hit the wall while in guided mode and I do not have GPS.

Use GUIDED_NOGPS flight mode and learn MAVLink protocol.

Use it to set the position/speed/acceleration of each movement.

Be ready to read a lot and learn new things. This is not a easy task, but is a satisfying one.