Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autonomous Landing Module #235

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Autonomous Landing Module #235

wants to merge 20 commits into from

Conversation

ellyokes253
Copy link

Created the module for Autonomous Landing and making progress on creating the autonomous landing worker as well.

Copy link
Member

@maxlou05 maxlou05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed

self.__logger = local_logger

def run(
self, bounding_box: detections_and_time.Detection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll be getting a MergedOdometryDetections object, which will have a list of Detection objects

@@ -0,0 +1,100 @@
"""
Auto-landing script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add calculates the parameters necessary for use with LANDING_TARGET MAVLink command


class AutoLanding:
"""
Auto-landing script.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy new file docstring here

modules/auto_landing/auto_landing.py Show resolved Hide resolved

import math

from pymavlink import mavutil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure you won't need this library

Comment on lines 37 to 42
vehicle = mavutil.mavlink_connection("tcp:localhost:14550")
try:
height_agl_mm = vehicle.messages[
"GLOBAL_POSITION_INT"
].relative_alt # copied from blue_only.py
height_agl = max(height_agl_mm / 1000, 0.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need altitude information, you cannot create another connection to the drone since FlightInterface already has one. You need to get the merged_odometry_detections.MergedOdometryDetections object from data merge worker. The altitude is agl which is the same as local altitude I think, so you can directly use that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this portion should also go into the run() function, as altitude will change as the drone lands, and is not constant

ground_hyp = (x_dist**2 + y_dist**2) ** 0.5
self.__logger.info(f"Required horizontal correction (m): {ground_hyp}", True)
target_to_vehicle_dist = (ground_hyp**2 + self.height_agl**2) ** 0.5
self.__logger.info(f"Distance from vehicle to target (m): {target_to_vehicle_dist}", True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that instead of making 4 separate lines in the log, you can combine all of these into 1 line, so the timestamps look better (these calculations should be fast anyways)

modules/auto_landing/auto_landing.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants