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

log all images to one directory #159

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

queue_max_size: 10

log_directory_path: "logs"

video_input:
camera_name: 0
worker_period: 1.0 # seconds
save_prefix: "log_image"
camera_name: 0
worker_period: 1.0 # seconds
save_prefix: "log_image"

detect_target:
worker_count: 1
device: 0
model_path: "tests/model_example/yolov8s_ultralytics_pretrained_default.pt" # TODO: update
save_prefix: "log_comp"
worker_count: 1
device: 0
model_path: "tests/model_example/yolov8s_ultralytics_pretrained_default.pt" # TODO: update
save_prefix: "log_comp"

flight_interface:
address: "tcp:127.0.0.1:14550"
timeout: 10.0 # seconds
worker_period: 0.1 # seconds
address: "tcp:127.0.0.1:14550"
timeout: 10.0 # seconds
worker_period: 0.1 # seconds
43 changes: 28 additions & 15 deletions main_2024.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import cv2
import yaml

from utilities.workers import queue_proxy_wrapper
from utilities.workers import worker_controller
from utilities.workers import worker_manager
from modules import odometry_and_time
from modules.detect_target import detect_target_worker
from modules.flight_interface import flight_interface_worker
from modules.video_input import video_input_worker
from utilities.workers import queue_proxy_wrapper
from utilities.workers import worker_controller
from utilities.workers import worker_manager



CONFIG_FILE_PATH = pathlib.Path("config.yaml")
Expand Down Expand Up @@ -49,15 +51,19 @@ def main() -> int:
try:
QUEUE_MAX_SIZE = config["queue_max_size"]

LOG_DIRECTORY_PATH = config["log_directory_path"]

VIDEO_INPUT_CAMERA_NAME = config["video_input"]["camera_name"]
VIDEO_INPUT_WORKER_PERIOD = config["video_input"]["worker_period"]
VIDEO_INPUT_SAVE_PREFIX = config["video_input"]["save_prefix"]
VIDEO_INPUT_SAVE_NAME_PREFIX = config["video_input"]["save_prefix"]
VIDEO_INPUT_SAVE_PREFIX = f"{LOG_DIRECTORY_PATH}/{VIDEO_INPUT_SAVE_NAME_PREFIX}"

DETECT_TARGET_WORKER_COUNT = config["detect_target"]["worker_count"]
DETECT_TARGET_DEVICE = "cpu" if args.cpu else config["detect_target"]["device"]
DETECT_TARGET_MODEL_PATH = config["detect_target"]["model_path"]
DETECT_TARGET_OVERRIDE_FULL_PRECISION = args.full
DETECT_TARGET_SAVE_PREFIX = config["detect_target"]["save_prefix"]
DETECT_TARGET_SAVE_NAME_PREFIX = config["detect_target"]["save_prefix"]
DETECT_TARGET_SAVE_PREFIX = f"{LOG_DIRECTORY_PATH}/{DETECT_TARGET_SAVE_NAME_PREFIX}"

FLIGHT_INTERFACE_ADDRESS = config["flight_interface"]["address"]
FLIGHT_INTERFACE_TIMEOUT = config["flight_interface"]["timeout"]
Expand All @@ -66,6 +72,8 @@ def main() -> int:
print("Config key(s) not found")
return -1

pathlib.Path(LOG_DIRECTORY_PATH).mkdir(exist_ok=True)

# Setup
controller = worker_controller.WorkerController()

Expand Down Expand Up @@ -135,16 +143,21 @@ def main() -> int:
except queue.Empty:
image = None

odometry_and_time = flight_interface_to_main_queue.queue.get()

if odometry_and_time is not None:
print("timestamp: " + str(odometry_and_time.timestamp))
print("lat: " + str(odometry_and_time.odometry_data.position.latitude))
print("lon: " + str(odometry_and_time.odometry_data.position.longitude))
print("alt: " + str(odometry_and_time.odometry_data.position.altitude))
print("yaw: " + str(odometry_and_time.odometry_data.orientation.yaw))
print("roll: " + str(odometry_and_time.odometry_data.orientation.roll))
print("pitch: " + str(odometry_and_time.odometry_data.orientation.pitch))
odometry_and_time_info: "odometry_and_time.OdometryAndTime | None" = \
flight_interface_to_main_queue.queue.get()

if odometry_and_time_info is not None:
timestamp = odometry_and_time_info.timestamp
position = odometry_and_time_info.odometry_data.position
orientation = odometry_and_time_info.odometry_data.orientation.orientation

print("timestamp: " + str(timestamp))
print("north: " + str(position.north))
print("east: " + str(position.east))
print("down: " + str(position.down))
print("yaw: " + str(orientation.yaw))
print("roll: " + str(orientation.roll))
print("pitch: " + str(orientation.pitch))
print("")

if image is None:
Expand Down
2 changes: 1 addition & 1 deletion modules/common
Submodule common updated 41 files
+44 −0 .github/workflows/run-tests.yml
+0 −33 .gitignore
+0 −0 camera/__init__.py
+6 −3 camera/test_camera.py
+0 −51 comms/TelemMessages/GroundStation.lcm
+0 −24 comms/TelemMessages/common.lcm
+0 −25 comms/TelemMessages/jetson.lcm
+0 −60 comms/TelemMessages/messages.json
+0 −31 comms/Tools/build_messages.sh
+0 −10 comms/Tools/install_lcm.sh
+0 −12 comms/Tools/list_usb.sh
+0 −15 comms/Tools/message_include.sh
+0 −187 comms/Tools/py_gen_helpers.py
+0 −86 comms/modules/TelemMessages/GroundStationData.py
+0 −74 comms/modules/TelemMessages/GroundStationDisarm.py
+0 −80 comms/modules/TelemMessages/GroundStationPIDSetResponse.py
+0 −81 comms/modules/TelemMessages/GroundStationPIDValues.py
+0 −83 comms/modules/TelemMessages/GroundStationWaypoints.py
+0 −70 comms/modules/TelemMessages/Header.py
+0 −74 comms/modules/TelemMessages/JetsonLandingInitiationCommand.py
+0 −74 comms/modules/TelemMessages/JetsonMovementRequest.py
+0 −77 comms/modules/TelemMessages/JetsonOdometryData.py
+0 −78 comms/modules/TelemMessages/JetsonRelativeMovementCommand.py
+0 −71 comms/modules/TelemMessages/PIDController.py
+0 −66 comms/modules/TelemMessages/PIDValues.py
+0 −77 comms/modules/TelemMessages/SensorData.py
+0 −67 comms/modules/TelemMessages/Waypoint.py
+0 −19 comms/modules/TelemMessages/__init__.py
+0 −89 comms/modules/generic_comms_device.py
+0 −61 comms/modules/helper.py
+0 −21 comms/receive.py
+0 −28 comms/test_tx.py
+0 −19 comms/transmit.py
+0 −0 kml/__init__.py
+10 −7 kml/modules/waypoints_to_kml.py
+19 −14 kml/test_waypoints_to_kml.py
+0 −0 mavlink/__init__.py
+71 −0 mavlink/modules/flight_controller.py
+10 −1 mavlink/test_flight_controller.py
+0 −0 qr/__init__.py
+11 −8 qr/test_qr.py
Empty file removed modules/zp_input/__init__.py
Empty file.
29 changes: 0 additions & 29 deletions modules/zp_input/zp_input.py

This file was deleted.

46 changes: 0 additions & 46 deletions modules/zp_input/zp_input_worker.py

This file was deleted.

3 changes: 0 additions & 3 deletions tests/test_zp_input.py

This file was deleted.

62 changes: 0 additions & 62 deletions tests/test_zp_input_worker.py

This file was deleted.

Loading