Skip to content

Commit

Permalink
merge conflict in video input
Browse files Browse the repository at this point in the history
  • Loading branch information
TongguangZhang committed Mar 24, 2024
1 parent b8a9b9a commit 63d49f9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
2 changes: 1 addition & 1 deletion modules/common
Submodule common updated 46 files
+0 −44 .github/workflows/run-tests.yml
+33 −0 .gitignore
+3 −6 camera/test_camera.py
+51 −0 comms/TelemMessages/GroundStation.lcm
+24 −0 comms/TelemMessages/common.lcm
+25 −0 comms/TelemMessages/jetson.lcm
+60 −0 comms/TelemMessages/messages.json
+31 −0 comms/Tools/build_messages.sh
+10 −0 comms/Tools/install_lcm.sh
+12 −0 comms/Tools/list_usb.sh
+15 −0 comms/Tools/message_include.sh
+187 −0 comms/Tools/py_gen_helpers.py
+86 −0 comms/modules/TelemMessages/GroundStationData.py
+74 −0 comms/modules/TelemMessages/GroundStationDisarm.py
+80 −0 comms/modules/TelemMessages/GroundStationPIDSetResponse.py
+81 −0 comms/modules/TelemMessages/GroundStationPIDValues.py
+83 −0 comms/modules/TelemMessages/GroundStationWaypoints.py
+70 −0 comms/modules/TelemMessages/Header.py
+74 −0 comms/modules/TelemMessages/JetsonLandingInitiationCommand.py
+74 −0 comms/modules/TelemMessages/JetsonMovementRequest.py
+77 −0 comms/modules/TelemMessages/JetsonOdometryData.py
+78 −0 comms/modules/TelemMessages/JetsonRelativeMovementCommand.py
+71 −0 comms/modules/TelemMessages/PIDController.py
+66 −0 comms/modules/TelemMessages/PIDValues.py
+77 −0 comms/modules/TelemMessages/SensorData.py
+67 −0 comms/modules/TelemMessages/Waypoint.py
+19 −0 comms/modules/TelemMessages/__init__.py
+0 −0 comms/modules/__init__.py
+89 −0 comms/modules/generic_comms_device.py
+61 −0 comms/modules/helper.py
+21 −0 comms/receive.py
+28 −0 comms/test_tx.py
+19 −0 comms/transmit.py
+0 −0 kml/__init__.py
+3 −3 kml/expected_document.kml
+0 −50 kml/modules/ground_locations_to_kml.py
+0 −54 kml/modules/location_ground.py
+45 −0 kml/modules/waypoints_to_kml.py
+0 −55 kml/test_ground_locations_to_kml.py
+45 −0 kml/test_waypoints_to_kml.py
+0 −0 mavlink/__init__.py
+0 −96 mavlink/modules/flight_controller.py
+1 −10 mavlink/test_flight_controller.py
+0 −140 mavlink/test_mission_ended.py
+0 −0 qr/__init__.py
+8 −11 qr/test_qr.py
20 changes: 19 additions & 1 deletion modules/video_input/video_input.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""
Combines image and timestamp together.
"""
import inspect
import queue

from utilities.workers import queue_proxy_wrapper
from ..common.camera.modules import camera_device
from ..multiprocess_logging import multiprocess_logging
from .. import image_and_time


Expand All @@ -11,14 +15,28 @@ class VideoInput:
Combines image and timestamp together.
"""

def __init__(self, camera_name: "int | str", save_name: str = "") -> None:
def __init__(
self,
logging_queue: queue_proxy_wrapper.QueueProxyWrapper,
camera_name: "int | str",
save_name: str = ""
) -> None:
self.device = camera_device.CameraDevice(camera_name, 1, save_name)
self.logging_queue = logging_queue

def run(self) -> "tuple[bool, image_and_time.ImageAndTime | None]":
"""
Returns a possible ImageAndTime with current timestamp.
"""
result, image = self.device.get_image()

try:
frame = inspect.currentframe()
multiprocess_logging.log_message(f'image size {image.shape}', multiprocess_logging.DEBUG, frame, self.logging_queue)
# self.logging_queue.queue.put((multiprocess_logging.message_and_metadata(f'image size {image.shape}', frame), logging.DEBUG), block=False)
except queue.Full:
pass

if not result:
return False, None

Expand Down
16 changes: 13 additions & 3 deletions modules/video_input/video_input_worker.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""
Gets images from the camera.
"""

import inspect
import queue
import time

from utilities.workers import queue_proxy_wrapper
from utilities.workers import worker_controller
from ..multiprocess_logging import multiprocess_logging
from . import video_input


Expand All @@ -14,6 +16,7 @@ def video_input_worker(
period: float,
save_name: str,
output_queue: queue_proxy_wrapper.QueueProxyWrapper,
logging_queue: queue_proxy_wrapper.QueueProxyWrapper,
controller: worker_controller.WorkerController,
) -> None:
"""
Expand All @@ -25,8 +28,15 @@ def video_input_worker(
output_queue is the data queue.
controller is how the main process communicates to this worker process.
"""
input_device = video_input.VideoInput(camera_name, save_name)

input_device = video_input.VideoInput(logging_queue, camera_name, save_name)

try:
frame = inspect.currentframe()
multiprocess_logging.log_message('video_input started', multiprocess_logging.DEBUG, frame, logging_queue)
# logging_queue.queue.put((multiprocess_logging.message_and_metadata('video_input started', frame), logging.DEBUG), block=False)
except queue.Full:
pass

while not controller.is_exit_requested():
controller.check_pause()

Expand Down

0 comments on commit 63d49f9

Please sign in to comment.