Skip to content

phase 2 completed#30

Open
tomalmog wants to merge 7 commits intoUWARG:mainfrom
tomalmog:main
Open

phase 2 completed#30
tomalmog wants to merge 7 commits intoUWARG:mainfrom
tomalmog:main

Conversation

@tomalmog
Copy link

@tomalmog tomalmog commented Nov 4, 2025

No description provided.

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

things should still be logged in your worker too

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
Copy link
Contributor

Choose a reason for hiding this comment

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

flipped logic

5.0, # default turning speed (deg/s)
local_logger,
)
if not ok or instance is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

you can just check the boolean instead of checking both

Comment on lines 72 to 73
if data is None:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

just because there's nothing in the queue doesn't mean it should break

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

again only need to check boolean here

Comment on lines 68 to 76
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"
Copy link
Contributor

Choose a reason for hiding this comment

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

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above

# =============================================================================================
# Instantiate class object (telemetry.Telemetry)
ok, instance = telemetry.Telemetry.create(connection, timeout_s, local_logger)
if not ok or instance is None:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as before

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

same as before

Comment on lines 79 to 80
if item is None:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

again, an empty queue shouldn't make it break

Comment on lines 75 to 76
if item is None:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

Comment on lines 73 to 74
if item is None:
break
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

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
Copy link
Contributor

Choose a reason for hiding this comment

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

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:
Copy link
Contributor

Choose a reason for hiding this comment

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

again only need to check boolean

@ellyokes253
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be in your main log

Copy link
Contributor

Choose a reason for hiding this comment

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

this still needs to be fixed

args, # Put your own arguments here
):
disconnect_threshold: int,
local_logger: logger.Logger,
Copy link
Contributor

Choose a reason for hiding this comment

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

i would put this in your init instead of having it as a param for your run

bootcamp_main.py Outdated
Comment on lines 203 to 208
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
Copy link
Contributor

Choose a reason for hiding this comment

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

this can put in the same try except block

@ellyokes253
Copy link
Contributor

reviewed!

if current_state == "Disconnected":
break
# Drain any command outputs without blocking
while True:
Copy link
Contributor

Choose a reason for hiding this comment

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

you don't need the extra while True, it can still be in the same overall while loop

@ellyokes253
Copy link
Contributor

reviewed!

while not controller.is_exit_requested():
controller.check_pause()
try:
_ok, state = instance.run(local_logger)
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to make this a tuple if you don't need the boolean

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