Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunav committed Dec 6, 2023
1 parent a5205a8 commit ac66bed
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 91 deletions.
28 changes: 1 addition & 27 deletions modules/merged_odometry_detections.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
"""
Drone odometry and object detections
Drone odometry and object detections.
"""

from . import detections_and_time
<<<<<<< HEAD
<<<<<<< HEAD
from . import drone_odometry_local
=======
from . import odometry_and_time
>>>>>>> bd110f8 (Update merged_odometry_detections.py)
=======
from . import drone_odometry_local
>>>>>>> 5190db5 (rebase changes)


# Basically a struct
Expand All @@ -35,33 +27,15 @@ def create(cls,
return True, MergedOdometryDetections(cls.__create_key, odometry_local, detections)

def __init__(self,
<<<<<<< HEAD
<<<<<<< HEAD
odometry_local: drone_odometry_local.DroneOdometryLocal,
=======
class_private_create_key,
drone_position: odometry_and_time.DronePosition,
drone_orientation: odometry_and_time.DroneOrientation,
>>>>>>> bd110f8 (Update merged_odometry_detections.py)
=======
odometry_local: drone_odometry_local.DroneOdometryLocal,
>>>>>>> 5190db5 (rebase changes)
detections: "list[detections_and_time.Detection]"):
"""
Private constructor, use create() method.
"""
<<<<<<< HEAD
self.odometry_local = odometry_local
=======
assert class_private_create_key is MergedOdometryDetections.__create_key, "Use create() method"

<<<<<<< HEAD
self.drone_position = drone_position
self.drone_orientation = drone_orientation
>>>>>>> bd110f8 (Update merged_odometry_detections.py)
=======
self.odometry_local = odometry_local
>>>>>>> 5190db5 (rebase changes)
self.detections = detections

# pylint: enable=too-few-public-methods
28 changes: 1 addition & 27 deletions modules/odometry_and_time.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Drone odometry and timestamp
Drone odometry in local space and timestamp.
"""
import time

Expand All @@ -15,7 +15,6 @@ class OdometryAndTime:
__create_key = object()

@classmethod
<<<<<<< HEAD
def create(cls, odometry_data: drone_odometry_local.DroneOdometryLocal) \
-> "tuple[bool, OdometryAndTime | None]":
"""
Expand All @@ -40,30 +39,5 @@ def __init__(self,

self.odometry_data = odometry_data
self.timestamp = timestamp
=======
def create(cls,
position: drone_odometry.DronePosition,
orientation: drone_odometry.DroneOrientation) -> "tuple[bool, MergedOdometryDetections | None]":
"""
Constructor sets timestamp to current time.
position: Latitude, longitude in decimal degrees and altitude in metres.
orientation: Yaw, pitch, roll following NED system (x forward, y right, z down).
"""

return True, OdometryAndTime(cls.__create_key, position, orientation)

def __init__(self,
class_private_create_key,
position: drone_odometry.DronePosition,
orientation: drone_odometry.DroneOrientation):
"""
Private constructor, use create() method.
"""
assert class_private_create_key is OdometryAndTime.__create_key, "Use create() method"

self.position = position
self.orientation = orientation
self.timestamp = time.time()
>>>>>>> 78c49d9 (Update odometry_and_time.py)

# pylint: enable=too-few-public-methods
8 changes: 0 additions & 8 deletions tests/test_data_merge_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,9 @@ def simulate_flight_input_worker(timestamp: float,
assert result
assert orientation is not None

<<<<<<< HEAD
result, odometry = drone_odometry_local.DroneOdometryLocal.create(position, orientation)
assert result
assert odometry is not None
=======
result, odometry = odometry_and_time.OdometryAndTime.create(position, orientation)
assert result
assert odometry is not None

odometry.timestamp = timestamp
>>>>>>> ffa9bbe (updating local)

result, odometry_time = odometry_and_time.OdometryAndTime.create(odometry)
assert result
Expand Down
18 changes: 3 additions & 15 deletions tests/test_geolocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,18 +754,14 @@ def test_basic(self,
assert result
assert drone_orientation is not None

<<<<<<< HEAD
result, drone_odometry = drone_odometry_local.DroneOdometryLocal.create(
=======
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
>>>>>>> ffa9bbe (updating local)
drone_position,
drone_orientation,
)
assert result
assert drone_odometry is not None

merged_detections = merged_odometry_detections.MergedOdometryDetections(
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
drone_odometry,
[
detection1,
Expand Down Expand Up @@ -858,18 +854,14 @@ def test_advanced(self,
assert result
assert drone_orientation is not None

<<<<<<< HEAD
result, drone_odometry = drone_odometry_local.DroneOdometryLocal.create(
=======
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
>>>>>>> ffa9bbe (updating local)
drone_position,
drone_orientation,
)
assert result
assert drone_odometry is not None

merged_detections = merged_odometry_detections.MergedOdometryDetections(
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
drone_odometry,
[
detection_bottom_right_point,
Expand Down Expand Up @@ -969,18 +961,14 @@ def test_bad_direction(self,
assert result
assert drone_orientation is not None

<<<<<<< HEAD
result, drone_odometry = drone_odometry_local.DroneOdometryLocal.create(
=======
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
>>>>>>> ffa9bbe (updating local)
drone_position,
drone_orientation,
)
assert result
assert drone_odometry is not None

merged_detections = merged_odometry_detections.MergedOdometryDetections(
result, merged_detections = merged_odometry_detections.MergedOdometryDetections.create(
drone_odometry,
[detection1],
)
Expand Down
18 changes: 4 additions & 14 deletions tests/test_geolocation_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,13 @@ def simulate_previous_worker(in_queue: queue_proxy_wrapper.QueueProxyWrapper):
assert result_simulate
assert detection is not None

<<<<<<< HEAD
<<<<<<< HEAD
value = merged_odometry_detections.MergedOdometryDetections(
result_simulate, merged = merged_odometry_detections.MergedOdometryDetections.create(
drone_odometry,
=======
value = merged_odometry_detections.MergedOdometryDetections.create(
=======
result_simulate, value = merged_odometry_detections.MergedOdometryDetections.create(
>>>>>>> ffa9bbe (updating local)
drone_position,
drone_orientation,
>>>>>>> 86c216f (Update test_geolocation_worker.py)
[detection],
)
assert result_simulate
assert value is not None
in_queue.queue.put(value)
assert merged is not None
in_queue.queue.put(merged)


if __name__ == "__main__":
Expand Down Expand Up @@ -132,4 +122,4 @@ def simulate_previous_worker(in_queue: queue_proxy_wrapper.QueueProxyWrapper):
detection_in_queue.fill_and_drain_queue()
worker.join()

print("Done!")
print("Done!")

0 comments on commit ac66bed

Please sign in to comment.