code: def set_mode_px4(self, mode, custom_mode, custom_sub_mode):
          '''enter arbitrary mode'''
          if isinstance(mode, str):
              mode_map = self.mode_mapping()
              if mode_map is None or mode not in mode_map:
                  print("Unknown mode '%s'" % mode)
                  return
              # PX4 uses two fields to define modes
              mode, custom_mode, custom_sub_mode = px4_map[mode]
          self.mav.command_long_send(self.target_system, self.target_component,
                                     mavlink.MAV_CMD_DO_SET_MODE, 0, mode, custom_mode, custom_sub_mode, 0, 0, 0, 0f set_mode_px4(self, mode, custom_mode, custom_sub_mode):
          '''enter arbitrary mode'''
          if isinstance(mode, str):
              mode_map = self.mode_mapping()
              if mode_map is None or mode not in mode_map:
                  print("Unknown mode '%s'" % mode)
                  return
              # PX4 uses two fields to define modes
              mode, custom_mode, custom_sub_mode = px4_map[mode]
          self.mav.command_long_send(self.target_system, self.target_component,
                                     mavlink.MAV_CMD_DO_SET_MODE, 0, mode, custom_mode, custom_sub_mode, 0, 0, 0, 0)
docs: enter arbitrary mode