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

added handling of pid error response #686

Merged
merged 13 commits into from
Aug 8, 2024
9 changes: 7 additions & 2 deletions socs/agents/hwp_pid/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ def parse_action_result(res):
return {'result': res}


def get_pid_state(pid: pd.PID):
def get_pid_state(pid: pd.PID, num_attempts: int = 3):
for _ in range(num_attempts):
ykyohei marked this conversation as resolved.
Show resolved Hide resolved
freq = pid.get_freq()
if freq != 9.999:
break
time.sleep(1)
return {
"current_freq": pid.get_freq(),
"current_freq": freq,
"target_freq": pid.get_target(),
"direction": pid.get_direction(),
}
Expand Down
2 changes: 1 addition & 1 deletion socs/agents/hwp_pid/drivers/pid_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def _decode_measure(string):
measure_type = end_string[1:3]
else:
measure_type = '00'
if measure_type == '01':
if measure_type == '01' and end_string[3:] != '?+9999.':
return float(end_string[3:])
else:
return 9.999