Conversation
logs/command/main.log
Outdated
| 15:56:35: [INFO] [/Users/tomalmog/Clubs/WARG/p2/modules/common/modules/logger/logger_main_setup.py | setup_main_logger | 62] main logger initialized | ||
| 15:56:36: [INFO] [/Users/tomalmog/Clubs/WARG/p2/tests/integration/test_command.py | main | 144] Connected! | ||
| 15:56:36: [INFO] [/Users/tomalmog/Clubs/WARG/p2/tests/integration/test_command.py | read_queue | 81] CHANGE ALTITUDE: 1.0 | ||
| 15:56:36: [INFO] [/Users/tomalmog/Clubs/WARG/p2/tests/integration/test_command.py | read_queue | 81] CHANGE ALTITUDE: -1.0 |
There was a problem hiding this comment.
there should be changing yaw values updated here too
| @@ -0,0 +1 @@ | |||
| 15:56:21: [INFO] [/Users/tomalmog/Clubs/WARG/p2/modules/telemetry/telemetry_worker.py | telemetry_worker | 45] Logger initialized | |||
There was a problem hiding this comment.
things should still be logged in your worker too
modules/command/command.py
Outdated
| delta_rad += 2 * math.pi | ||
| delta_deg = math.degrees(delta_rad) | ||
| if abs(delta_deg) > angle_tolerance_deg: | ||
| direction = 1 if delta_deg >= 0 else -1 |
modules/command/command_worker.py
Outdated
| 5.0, # default turning speed (deg/s) | ||
| local_logger, | ||
| ) | ||
| if not ok or instance is None: |
There was a problem hiding this comment.
you can just check the boolean instead of checking both
modules/command/command_worker.py
Outdated
| if data is None: | ||
| break |
There was a problem hiding this comment.
just because there's nothing in the queue doesn't mean it should break
modules/command/command_worker.py
Outdated
| except Exception as e: # pylint: disable=broad-except | ||
| local_logger.error(f"Command run failed: {e}", True) | ||
| success, output = False, None | ||
| if success and output is not None: |
There was a problem hiding this comment.
again only need to check boolean here
| local_logger.error(f"Heartbeat receive failed: {e}", True) | ||
| state, missed = "Disconnected", 1 | ||
| if missed: | ||
| missed_in_row += 1 | ||
| if missed_in_row >= disconnect_threshold: | ||
| state = "Disconnected" | ||
| else: | ||
| missed_in_row = 0 | ||
| state = "Connected" |
There was a problem hiding this comment.
this logic should go in your run
| # ============================================================================================= | ||
| # Instantiate class object (heartbeat_sender.HeartbeatSender) | ||
| ok, instance = heartbeat_sender.HeartbeatSender.create(connection, heartbeat_period_s) | ||
| if not ok or instance is None: |
| # ============================================================================================= | ||
| # Instantiate class object (telemetry.Telemetry) | ||
| ok, instance = telemetry.Telemetry.create(connection, timeout_s, local_logger) | ||
| if not ok or instance is None: |
| except Exception as e: # pylint: disable=broad-except | ||
| local_logger.error(f"Telemetry gather failed: {e}", True) | ||
| success, data = False, None | ||
| if success and data is not None: |
tests/integration/test_command.py
Outdated
| if item is None: | ||
| break |
There was a problem hiding this comment.
again, an empty queue shouldn't make it break
| if item is None: | ||
| break |
tests/integration/test_telemetry.py
Outdated
| if item is None: | ||
| break |
bootcamp_main.py
Outdated
| HEIGHT_TOLERANCE_M, | ||
| ), | ||
| input_queues=[telem_to_command_queue], | ||
| output_queues=[], # In a real system, add a main queue if needed |
There was a problem hiding this comment.
there still needs to be an output queue here
bootcamp_main.py
Outdated
| ok, mgr = worker_manager.WorkerManager.create( | ||
| worker_properties=props, local_logger=main_logger | ||
| ) | ||
| if not ok or mgr is None: |
There was a problem hiding this comment.
again only need to check boolean
|
reviewed! |
| 23:52:12: [INFO] [/Users/tomalmog/Clubs/WARG/p2/modules/command/command.py | run | 100] Average velocity: (0.667, 0.000, 0.067) | ||
| 23:52:12: [INFO] CHANGE YAW: -63.43494882292201 | ||
| 23:52:12: [INFO] [/Users/tomalmog/Clubs/WARG/p2/modules/command/command.py | run | 100] Average velocity: (0.000, 0.000, 0.065) | ||
| 23:52:12: [INFO] CHANGE YAW: -90.0 |
There was a problem hiding this comment.
this should be in your main log
There was a problem hiding this comment.
this still needs to be fixed
| args, # Put your own arguments here | ||
| ): | ||
| disconnect_threshold: int, | ||
| local_logger: logger.Logger, |
There was a problem hiding this comment.
i would put this in your init instead of having it as a param for your run
bootcamp_main.py
Outdated
| try: | ||
| cmd_out = command_to_main_queue.queue.get(timeout=0.1) | ||
| if cmd_out is not None: | ||
| main_logger.info(f"Command: {cmd_out}") | ||
| except: # pylint: disable=bare-except | ||
| pass |
There was a problem hiding this comment.
this can put in the same try except block
|
reviewed! |
| if current_state == "Disconnected": | ||
| break | ||
| # Drain any command outputs without blocking | ||
| while True: |
There was a problem hiding this comment.
you don't need the extra while True, it can still be in the same overall while loop
|
reviewed! |
| while not controller.is_exit_requested(): | ||
| controller.check_pause() | ||
| try: | ||
| _ok, state = instance.run(local_logger) |
There was a problem hiding this comment.
no need to make this a tuple if you don't need the boolean
No description provided.