Velocity control go straight with Pitch Angle

def send_movement_command_XYA(velocity_x, velocity_y, altitude):
global vehicle
print("Sending XYZ movement command with v_x(forward/backward): %f v_y(right/left): %f " % (velocity_x,velocity_y))

msg = vehicle.message_factory.set_position_target_local_ned_encode(
    0,      
    0, 0,    
    mavutil.mavlink.MAV_FRAME_BODY_NED,  #relative to drone heading pos relative to EKF origin
    0b0000111111100011, #ignore velocity z and other pos arguments
    0, 0, altitude,
    velocity_x, velocity_y, 0, 
    0, 0, 0, 
    0, 0)    

vehicle.send_mavlink(msg)

I have a problem with this code when we fly with this command, I need advice about the time sleep for the perfect fit to be responsible!
EXP:
def send_movement_command_XYA(velocity_x, velocity_y, altitude):
global vehicle
print("Sending XYZ movement command with v_x(forward/backward): %f v_y(right/left): %f " % (velocity_x,velocity_y))

msg = vehicle.message_factory.set_position_target_local_ned_encode(
    0,      
    0, 0,    
    mavutil.mavlink.MAV_FRAME_BODY_NED,  
    0, 0, altitude,
    velocity_x, velocity_y, 0, 
    0, 0, 0, 
    0, 0) 

for x in range(0,1):
    vehicle.send_mavlink(msg)
    time.sleep(0.5)

I try to use the time sleep with 0.5, the quadcopter not respond and have vibration hover. It not go straight with pitch angle that I need.
Thanks for help!