# How to control thrust percentage based on pitch values

Hi,
I am flying my drone in ‘guided’ mode and we can control the drone based on it’s attitude i.e roll, pitch, yaw and additionally thrust percentage. I am trying to control the landing sequence for a FW/VTOL through the guided mode.

I’m varying my roll,pitch,yaw values based on the landing location w.r.t drone’s location

while testing in SITL I noticed that thrust percentage was controlling both airspeed and climb-rate (we can’t control these speeds directly) and it’s also depending on the pitch angle (dive angle) of the FW/VTOL calculated as per the movement

can anyone help me out how I can give the thrust percentage based on my pitch values such that I can replicate a smooth landing sequence.

this is something I’ve tried so far any additional suggestions will be appreciated

I am also assuming a linear relationship between Thrust airspeed and climb rate since I’m in simulation

``````             Kp_th = 0.02

# defining a trajectory speed
trajectory_speed = 25

vrt_speed = sin(pitch_angle)*trajectory_speed # climb rate

# throttle percentage for both

T_airspeed = trajectory_speed/  Kp_th
T_climb = trajectory_speed/(Kp_th* sin(pitch_angle))

thrust_value = max(T_airspeed, T_climb)
# saturating thrust value within the range 0-1 as per limit
thrust_value = max(0.0, min(1.0, thrust_value))

# attitude is commanded through
await (set_attitude_target(roll = (roll_corr), pitch = (pitch_angle), yaw = (yaw_angle), thrust =  thrust_value))

``````