code: def send_attitude_target(roll_angle = 0.0, pitch_angle = 0.0,
                           yaw_angle = None, yaw_rate = 0.0, use_yaw_rate = False,
                           thrust = 0.5):
      
      if yaw_angle is None:
          # this value may be unused by the vehicle, depending on use_yaw_rate
          yaw_angle = vehicle.attitude.yaw
      # Thrust >  0.5: Ascend
      # Thrust == 0.5: Hold the altitude
      # Thrust <  0.5: Descend
      msg = vehicle.message_factory.set_attitude_target_encode(
          0, # time_boot_ms
          1, # Target system
          1, # Target component
          0b00000000 if use_yaw_rate else 0b00000100,
          to_quaternion(roll_angle, pitch_angle, yaw_angle), # Quaternion
          0, # Body roll rate in radian
          0, # Body pitch rate in radian
          math.radians(yaw_rate), # Body yaw rate in radian/second
          thrust  # Thrust
      )
      vehicle.send_mavlink(msg)
docs: use_yaw_rate: the yaw can be controlled using yaw_angle OR yaw_rate.
                    When one is used, the other is ignored by Ardupilot.
      thrust: 0 <= thrust <= 1, as a fraction of maximum vertical thrust.
              Note that as of Copter 3.5, thrust = 0.5 triggers a special case in
              the code for maintaining current altitude.