MissionComputer#

class payloadcomputerdroneprojekt.MissionComputer(config: dict, port: str, camera: type[~payloadcomputerdroneprojekt.camera.abstract_class.AbstractCamera], communications: type[~payloadcomputerdroneprojekt.communications.comm_class.Communications] = <class 'payloadcomputerdroneprojekt.communications.comm_class.Communications'>, image_analysis: type[~payloadcomputerdroneprojekt.image_analysis.ia_class.ImageAnalysis] = <class 'payloadcomputerdroneprojekt.image_analysis.ia_class.ImageAnalysis'>)[source]#

Bases: object

MissionComputer class for managing drone missions, communication, and image analysis.

This class handles mission initialization, execution, progress tracking, and communication with the drone and its subsystems.

Parameters:
  • config (dict) – Configuration dictionary for the mission computer and subsystems.

  • port (str) – Communication port for the drone.

  • camera (type[AbstractCamera]) – Camera class to be used for image analysis.

  • communications (type[Communications], optional) – Communications class for drone communication.

  • image_analysis (type[ImageAnalysis], optional) – ImageAnalysis class for image processing.

async delay(options: dict) None[source]#

Delay execution for a specified amount of time.

Parameters:

options (dict) – Dictionary with the delay time in seconds.

async execute(action: dict) None[source]#

Execute a single mission action.

Parameters:

action (dict) – Action dictionary containing the action type and commands.

async execute_list(options: List[dict]) None[source]#

Execute a list of actions sequentially.

Parameters:

options (List[dict]) – List of action dictionaries.

async forever(options: dict) None[source]#

Run an infinite loop (used for testing or waiting).

Parameters:

options (dict) – Options dictionary (unused).

initiate(missionfile: str = '') None[source]#

Initialize or reset the mission plan from a file.

Parameters:

missionfile (str, optional) – Path to the mission file.

async land(objective: dict) None[source]#

Land the drone at a specified location, optionally using color/shape detection.

Parameters:

objective (dict) – Dictionary with landing coordinates and optional color/shape.

async mov(options: dict) None[source]#

Move the drone to a specified latitude, longitude, and height.

Parameters:

options (dict) – Dictionary with ‘lat’, ‘lon’, and optional ‘height’ and ‘yaw’.

async mov_local(options: dict) None[source]#

Move the drone to a specified local position (x, y, z) in meters.

Parameters:

options (dict) – Dictionary with ‘x’, ‘y’, and optional ‘z’ and ‘yaw’. x: forward (North), y: right (East), z: down (positive)

async mov_multiple(options: List[dict]) None[source]#

Move to multiple locations sequentially.

Parameters:

options (List[dict]) – List of movement command dictionaries.

async mov_to_objects_cap_pic(options: dict) None[source]#

Move to detected objects and capture images at each location.

Parameters:

options (dict) – Dictionary with movement and delay options.

async new_mission(plan: str) None[source]#

Callback for receiving a new mission plan.

Parameters:

plan (str) – Path to the new mission plan file.

async save_progress() None[source]#

Periodically save the current mission progress to a file.

async scan_area(options: dict) None[source]#

Scan a specified area using the drone’s camera.

Parameters:

options (dict) – Dictionary with ‘lat’, ‘lon’, ‘height’, and optional ‘yaw’.

set_work_dir(config: dict) None[source]#
async smart_land(objective: dict) None[source]#
start() None[source]#

Start the mission computer’s main event loop.

async start_camera(options: dict) None[source]#

Start the camera subsystem.

Parameters:

options (dict) – Options for starting the camera (e.g., images per second).

async status(msg: str) None[source]#

Send a status message to the communication subsystem.

Parameters:

msg (str) – Status message to send.

async stop_camera(options: dict) None[source]#

Stop the camera subsystem and process filtered objects.

Parameters:

options (dict) – Options for stopping the camera.

async takeoff(options: dict) None[source]#

Command the drone to take off to a specified height.

Parameters:

options (dict) – Options containing the target height.