fusion_hat._utils モジュール
- fusion_hat._utils.retry(times: int = 5)[ソース]
エラーが発生した場合に、指定した回数だけ再試行するためのデコレータ
- パラメータ:
times (int, optional) -- 再試行回数。デフォルトは 5 です。
- 戻り値:
ラッパー関数
- 戻り値の型:
function
- fusion_hat._utils.command_exists(cmd: str) bool[ソース]
コマンドが存在するかを確認します
- パラメータ:
cmd (str) -- 確認するコマンド
- 戻り値:
存在する場合は True
- 戻り値の型:
bool
- fusion_hat._utils.run_command(cmd: str, timeout: float | None = None) tuple[ソース]
コマンドを実行し、ステータスと出力を返します
- パラメータ:
cmd (str) -- 実行するコマンド
timeout (float | None) -- timeout in seconds, None for no timeout
- 戻り値:
status, output. On timeout, returns (124, "timed out after Ns")
- 戻り値の型:
tuple
- fusion_hat._utils.is_installed(cmd: str) bool[ソース]
コマンドがインストールされているかを確認します
- パラメータ:
cmd (str) -- 確認するコマンド
- 戻り値:
インストールされている場合は True
- 戻り値の型:
bool
- fusion_hat._utils.mapping(x: float, in_min: float, in_max: float, out_min: float, out_max: float) float[ソース]
値をある範囲から別の範囲へマッピングします
- パラメータ:
x (float) -- マッピングする値
in_min (float) -- 入力の最小値
in_max (float) -- 入力の最大値
out_min (float) -- 出力の最小値
out_max (float) -- 出力の最大値
- 戻り値:
マッピング後の値
- 戻り値の型:
float