Class MissionPlanBuilder

java.lang.Object
io.fleetcoreplatform.Builders.MissionPlanBuilder

public class MissionPlanBuilder extends Object
Constructs valid QGroundControl-compatible mission plans (.plan files). Employs a fluent builder pattern to incrementally stack flight commands, waypoints, and parameter adjustments.
  • Method Details

    • builder

      public static MissionPlanBuilder builder()
      Initializes a new builder with default operating speeds. Starts with a hover speed of 5 m/s and a cruise speed of 15 m/s.
      Returns:
      A fresh MissionPlanBuilder instance.
    • hoverSpeed

      public MissionPlanBuilder hoverSpeed(int hoverSpeed)
      Configures the transit speed used while navigating between waypoints.
      Parameters:
      hoverSpeed - Target speed in meters per second.
      Returns:
      The current builder instance for chaining.
    • cruiseSpeed

      public MissionPlanBuilder cruiseSpeed(int cruiseSpeed)
      Configures the primary flight speed during mission execution.
      Parameters:
      cruiseSpeed - Target speed in meters per second.
      Returns:
      The current builder instance for chaining.
    • item

      public MissionPlanBuilder item(int altitude, int altitudeMode, int command, int frame, Double x, Double y, Double z)
      Appends a new sequential command item to the mission plan. Wraps the raw MAVLink command specifications into the JSON structure expected by PX4/ArduPilot planners.
      Parameters:
      altitude - Target altitude for the command, depending on the chosen altitude mode.
      altitudeMode - Determines the altitude frame of reference (e.g., MSL, AGL).
      command - The standard MAVLink command ID (e.g., 16 for WAYPOINT, 22 for TAKEOFF).
      frame - The coordinate frame applied to this item (e.g., 3 for GLOBAL_RELATIVE_ALT).
      x - The primary coordinate (longitude), or null if the command does not require spatial data.
      y - The secondary coordinate (latitude), or null if the command does not require spatial data.
      z - An additional parameter field, typically used for altitude overrides or auxiliary parameters.
      Returns:
      The current builder instance for chaining.
    • homePosition

      public MissionPlanBuilder homePosition(double x, double y, double z)
      Defines the origin point for the mission. This dictates where the drone launches from and where it will return upon a standard RTL (Return to Launch) command.
      Parameters:
      x - Longitude coordinate.
      y - Latitude coordinate.
      z - Altitude above mean sea level.
      Returns:
      The current builder instance for chaining.
    • build

      public MissionFile build()
      Finalizes the mission configuration and packages all components into a compliant layout. Populates empty geofence and rally point objects to ensure schema compliance for standard ground stations.
      Returns:
      A fully populated MissionFile ready for JSON serialization.