automeal package¶
- class automeal.SamplingLoopIterator(duration_time_ms: float, sampling_interval_ms: float)[source]¶
Bases:
object
- automeal.close_can_stream(stream: Iterator[CANRecord]) None[source]¶
CANストリームの受信を終了します。
- Parameters:
stream (Iterator[CANRecord]) -- open_can_streamで取得したストリーミングイテレータ
- automeal.close_serial_stream(stream: Iterator[SerialRecord]) None[source]¶
シリアルストリームを閉じます。
- Parameters:
stream (Iterator[SerialRecord]) -- open_serial_streamで取得したストリーミングイテレータ
- automeal.close_tcp_client_stream(stream: Iterator[TCPClientRecord]) None[source]¶
TCP クライアントストリームの受信を終了します。
- Parameters:
stream (Iterator[TCPClientRecord]) -- open_tcp_client_stream で取得したストリーミングイテレータ
- automeal.close_udp_stream(stream: Iterator[UDPRecord]) None[source]¶
UDP ストリームの受信を終了します。
- Parameters:
stream (Iterator[UDPRecord]) -- open_udp_stream で取得したストリーミングイテレータ
- automeal.connect_tcp_client(client_name: str) None[source]¶
指定した TCP クライアント接続を確立します。
- Parameters:
client_name (str) -- クライアント名 (TCP Client 通信設定で設定した名前)
- Example:
automeal.connect_tcp_client("Client1")
- automeal.create_can_stream() CANStream[source]¶
CANストリームオブジェクトを作成します。 with 文で使用することで、ブロック終了時に自動でストリームを閉じることができます。
- Returns:
CANストリームオブジェクト
- Return type:
- Example:
- with automeal.create_can_stream() as can_stream:for data in can_stream:print(data)break # 1データ受信したら終了
- automeal.create_serial_stream() SerialStream[source]¶
シリアルストリームオブジェクトを作成します。 with 文で使用することで、ブロック終了時に自動でストリームを閉じることができます。
- Returns:
シリアルストリームオブジェクト
- Return type:
- Example:
- with automeal.create_serial_stream() as serial_stream:for data in serial_stream:print(data)break # 1データ受信したら終了
- automeal.create_tcp_client_stream() TCPClientStream[source]¶
TCP クライアントストリームオブジェクトを作成します。 with 文で使用することで、ブロック終了時に自動でストリームを閉じることができます。
- Returns:
TCP クライアントストリームオブジェクト
- Return type:
- Example:
- with automeal.create_tcp_client_stream() as tcp_client_stream:for data in tcp_client_stream:print(data)break # 1 データ受信したら終了
- automeal.create_udp_stream() UDPStream[source]¶
UDP ストリームオブジェクトを作成します。 with 文で使用することで、ブロック終了時に自動でストリームを閉じることができます。
- Returns:
UDP ストリームオブジェクト
- Return type:
- Example:
- with automeal.create_udp_stream() as udp_stream:for data in udp_stream:print(data)break # 1データ受信したら終了
- automeal.disconnect_tcp_client(client_name: str) None[source]¶
指定した TCP クライアント接続を切断します。
- Parameters:
client_name (str) -- クライアント名 (TCP Client 通信設定で設定した名前)
- Example:
automeal.disconnect_tcp_client("Client1")
- automeal.get_latest_can(user_defined_name: str, channel: int, can_id: int, direction: str) bytes[source]¶
指定した識別名のデバイスの指定のチャンネルでCANの受信または送信した最新のデータ1つを取得します。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル番号
direction (str) -- 送受信方向 送信("S")、 受信("R") で指定
- Returns:
指定した送受信方向の最新データ
- Return type:
bytes
- Example:
last_recv = automeal.get_latest_can("Vector-VN1630A-1", 1, 0x100, "R") # チャンネル1 で最後に受信したデータ取得
- automeal.get_latest_serial(port_id: str, direction: str) bytes[source]¶
シリアルの受信または送信した最新のデータ1つを取得します。
- Parameters:
port_id (str) -- ポートID
direction (str) -- 送受信方向 送信("S")、 受信("R") で指定
- Returns:
指定した送受信方向の最新データ
- Return type:
bytes
- Example:
last_recv = automeal.get_latest_serial("Port1", "R") # Port1 で最後に受信したデータ取得
- automeal.get_latest_tcp_client(client_name: str, direction: str) bytes[source]¶
指定した TCP クライアントで送信または受信した最新のデータ 1 つを取得します。
- Parameters:
client_name (str) -- クライアント名
direction (str) -- 送受信方向 送信("S")、 受信("R") で指定
- Returns:
指定した送受信方向の最新データ
- Return type:
bytes
- Example:
last_recv = automeal.get_latest_tcp_client("Client1", "R") # Client1 で最後に受信したデータ取得
- automeal.get_latest_udp(endpoint_name: str, direction: str) bytes[source]¶
指定した UDP エンドポイントで送信または受信した最新のデータ 1 つを取得します。
- Parameters:
endpoint_name (str) -- エンドポイント名 (UDP 通信設定で設定した名前)
direction (str) -- 送受信方向 送信("S")、 受信("R") で指定
- Returns:
指定した送受信方向の最新データ
- Return type:
bytes
- Example:
last_recv = automeal.get_latest_udp("Endpoint1", "R") # Endpoint1 で最後に受信したデータ取得
- automeal.get_mg400_state(mg400_name: str) MG400State[source]¶
指定したMG400ロボットのステータスを取得します。
- Parameters:
mg400_name (str) -- MG400ロボットの名前
- Returns:
MG400ロボットのステータス情報
- Return type:
- Example:
status = automeal.get_mg400_state("MG400_1")
- automeal.get_test_parameters(key: str) str | None[source]¶
テスト実行に使用されているテストパラメータの値を取得します。
- Parameters:
key (str) -- 取得するテストパラメータのキー
- Returns:
指定したキーに対応するテストパラメータの値。キーが存在しない場合は None を返します。
- Return type:
str | None
- Example:
report_dir = automeal.get_test_parameters("report_save_directory")
- Note:
取得可能なキーの一覧は以下の通りです。 - report_save_directory: レポート保存ディレクトリのパス
- automeal.get_vd_log_list() list[dict][source]¶
Connected VD® の判定ログを取得します。
- Returns:
- 以下のキーを持つ辞書(dict)のリスト- label_name: ラベル名 (str)- detect_time: 検知時間 (str)- detect_data: 検知データ(str)- detect_pattern: 検知パターン (str)- detect_info: 検知内容 (str)- error_level: エラーレベル (int)
- Return type:
list[dict]
- automeal.is_connected_tcp_client(client_name: str) bool[source]¶
指定した TCP クライアント接続が確立されているか確認します。
- Parameters:
client_name (str) -- クライアント名 (TCP Client 通信設定で設定した名前)
- Returns:
接続されている場合 True、切断されている場合 False
- Return type:
bool
- Example:
state = automeal.is_connected_tcp_client("Client1")
- automeal.linear_sampling(start: float, last: float, time: float, duration: float) int[source]¶
ScriptGenerator の自動生成コードで使用するヘルパー関数です。 start から last へ向かって線形的に変化する値を返します。
- Parameters:
start (float) -- 開始値
last (float) -- 終了値
time (float) -- 現在の時間
duration (float) -- 終了値に遷移するまでの時間
- Returns:
線形的に変化する値
- Return type:
int
- automeal.open_can_stream() Iterator[CANRecord][source]¶
CANストリームの受信を開始します。
- Returns:
CANデータのストリーミングイテレータ
- Return type:
Iterator[CANRecord]
- Example:
- can_stream = automeal.open_can_stream()for data in can_stream:print(data)break # 1データ受信したら終了automeal.close_can_stream(can_stream)
- automeal.open_serial_stream() Iterator[SerialRecord][source]¶
シリアルストリームを開きます。
- Returns:
シリアルデータのストリーミングイテレータ
- Return type:
Iterator[SerialRecord]
- Example:
- serial_stream = automeal.open_serial_stream()for data in serial_stream:print(data)break # 1データ受信したら終了automeal.close_serial_stream(serial_stream)
- automeal.open_tcp_client_stream() Iterator[TCPClientRecord][source]¶
TCP クライアントストリームの受信を開始します。
- Returns:
TCP クライアントデータのストリーミングイテレータ
- Return type:
Iterator[TCPClientRecord]
- Example:
- tcp_client_stream = automeal.open_tcp_client_stream()for data in tcp_client_stream:print(data)break # 1 データ受信したら終了automeal.close_tcp_client_stream(tcp_client_stream)
- automeal.open_udp_stream() Iterator[UDPRecord][source]¶
UDP ストリームの受信を開始します。
- Returns:
UDP データのストリーミングイテレータ
- Return type:
Iterator[UDPRecord]
- Example:
- udp_stream = automeal.open_udp_stream()for data in udp_stream:print(data)break # 1 データ受信したら終了automeal.close_udp_stream(udp_stream)
- automeal.read_analog_cpiai1208li(board_id: str, channel_number: int) int[source]¶
CPI-AI-1208LI の最新の計測電圧値 [mV] を取得します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
- Returns:
指定したチャンネルの電圧値 [mV]
- Return type:
int
- Example:
voltage = automeal.read_analog_cpiai1208li("Board1", 1) # Board1 の ch1 の電圧値取得
- automeal.read_analog_rpigp40(board_id: str, channel_number: int) int[source]¶
RPi-GP40 の最新の計測電圧値 [mV] を取得します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
- Returns:
指定したチャンネルの電圧値 [mV]
- Return type:
int
- Example:
voltage = automeal.read_analog_rpigp40("Board1", 1) # Board1 の ch1 の電圧値取得
- automeal.read_logic_cpidio0808l(board_id: str, channel_number: int) bool[source]¶
CPI-DIO-0808L の最新の計測値 (Hi/Lo) を取得します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
- Returns:
指定したチャンネルの状態 Hi(True)/Lo(False)
- Return type:
bool
- Example:
state = automeal.read_logic_cpidio0808l("Board1", 1) # Board1 の ch1 の状態取得
- automeal.read_logic_rpigp10(board_id: str, channel_number: int) bool[source]¶
RPi-GP10 の最新の計測値 (Hi/Lo) を取得します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
- Returns:
指定したチャンネルの状態 Hi(True)/Lo(False)
- Return type:
bool
- Example:
state = automeal.read_logic_rpigp10("Board1", 1) # Board1 の ch1 の状態取得
- automeal.read_pwm_ampio(board_id: str, channel_number: int) tuple[int, float][source]¶
AM-PIO の最新の計測 PWM 信号の周波数 [Hz] とデューティー比 [%] を取得します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-16)
- Returns:
指定したチャンネルの周波数 [Hz] とデューティー比 [%]
- Return type:
(int, float)
- Example:
freq, duty = automeal.read_pwm_ampio("Board1", 1) # Board1 の ch1 の状態取得
- automeal.sampling_loop(duration_time_ms: float, sampling_interval_ms: float = 100) SamplingLoopIterator[source]¶
ScriptGenerator の自動生成コードで使用するヘルパー関数です。 指定した時間間隔で for 文を実行するためのイテレータを返します。
- Example:
例えば for [t, d] in automeal.sampling_loop(5000, 100): とすると、 5000 ms の間、100 ms ごとに for 文が実行されます。 この時 t は、ループ開始からの経過時間 [s] です。 d は duration_time_ms と同じ、呼び出しを続ける時間ですが、単位は [s] となります。 t と d は float 型の値です。
なお最初の for 文の実行時は必ず t=0 であり、最後は t==d となります。
- Parameters:
duration_time_ms (float) -- 呼び出しを続ける時間 [ms]
sampling_interval_ms (float) -- 呼び出し間隔 [ms] (省略時は 100 ms)
- Returns:
指定した時間間隔で for 文を実行するためのイテレータ
- Return type:
- automeal.send_can(user_defined_name: str, channel: int, can_id: int, can_data: bytes) None[source]¶
指定した識別名のデバイスの指定のチャンネルからCANメッセージを送信します。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル番号
can_id (int) -- CANメッセージのID部
can_data (bytes) -- 送信メッセージのデータ部
- Example:
automeal.send_can("Vector-VN1630A-1", 1, 0x100, bytes([0x01, 0x02, 0x03]))
- automeal.send_can_message(user_defined_name: str, channel: int, can_message: str) None[source]¶
指定した識別名のデバイスの指定のチャンネルからメッセージ名と一致するメッセージを送信します。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル番号
can_message (str) -- 送信するデータのメッセージ名(CAN送信パネルのMessage列)
- Example:
automeal.send_can_message("Vector-VN1630A-1", 1, "Init") # 定義済みの Init コマンドを送信
- automeal.send_serial(port_id: str, serial_data: str | bytes) None[source]¶
指定したシリアルポートにデータを送信します。 文字列を指定した場合は UTF-8 エンコードされて送信されます。
- Parameters:
port_id (str) -- ポートID
serial_data (str or bytes) -- 送信データ 文字列またはバイト配列で指定
- Example:
automeal.send_serial("Port1", "Send Init") # "Send Init" を UTF-8 エンコードして送信
- Example:
automeal.send_serial("Port1", bytes([0x01, 0x02, 0x03]))
- automeal.send_serial_command(port_id: str, serial_command: str) None[source]¶
指定したシリアルポートに登録済みのコマンド名と一致するデータを送信します。
- Parameters:
port_id (str) -- ポートID
serial_command (str) -- 送信するデータのコマンド名(シリアル送信パネルのID列を指定してください)
- Example:
automeal.send_serial_command("Port1", "Init") # 定義済みの Init コマンドを送信
- automeal.send_tcp_client(client_name: str, tcp_data: bytes) None[source]¶
指定した TCP クライアント接続からデータを送信します。
- Parameters:
client_name (str) -- クライアント名 (TCP Client 通信設定で設定した名前)
tcp_data (bytes) -- 送信データ
- Example:
automeal.send_tcp_client("Client1", b"data")
- automeal.send_udp(endpoint_name: str, remote_ip: str, remote_port: int, udp_data: bytes) None[source]¶
指定した UDP エンドポイントからデータを送信します。 UDP 通信設定で設定したエンコーディングで送信されます。
- Parameters:
endpoint_name (str) -- エンドポイント名 (UDP 通信設定で設定した名前)
remote_ip (str) -- リモート IP アドレス
remote_port (int) -- リモートポート番号
udp_data (bytes) -- 送信データ
- Example:
automeal.send_udp("Endpoint1", "192.168.10.11", 8080, bytes([0x01, 0x02, 0x03]))
- automeal.sleep(wait: float)[source]¶
ScriptGenerator の自動生成コードで使用するヘルパー関数です。 エラーチェック後に wait 時間待機します。
- Parameters:
wait (float) -- 待機時間(s)
- automeal.smart_clamp(value, range1, range2)[source]¶
ScriptGenerator の自動生成コードで使用するヘルパー関数です。 対象値をrange内に収まるように修正した値を返します。
- Parameters:
value -- 対象値
range1 -- 下限
range2 -- 上限
- automeal.start_can_message_periodic(user_defined_name: str, can_message: str) None[source]¶
指定した識別名のデバイスからメッセージ名と一致するメッセージの定期送信を開始します。
- Parameters:
user_defined_name (str) -- 識別名
can_message (str) -- 送信するデータのメッセージ名(CAN送信パネルのMessage列)
- Example:
automeal.start_can_message_periodic("Vector-VN1630A-1", "Init") # 定義済みの Init メッセージの定期送信を開始
- automeal.start_can_periodic(user_defined_name: str, channel: int, can_id: int, can_data: bytes, period: int) None[source]¶
指定した識別名のデバイスの指定のチャンネルからCANメッセージを定期送信します。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル番号
can_id (int) -- CANメッセージのID部
can_data (bytes) -- 送信メッセージのデータ部
period (int) -- 定期送信の間隔(ms)
- Example:
automeal.start_can_periodic("Vector-VN1630A-1", 1, 0x100, bytes([0x01, 0x02, 0x03]), 10)
- automeal.start_mg400_project(mg400_name: str, project_name: str) MG400ProjectThread[source]¶
指定したMG400ロボットでプロジェクトをスレッドで開始します。
- Parameters:
mg400_name (str) -- MG400ロボットの名前
project_name (str) -- 開始するプロジェクト名
- Returns:
実行完了を待機するためのスレッドオブジェクト
- Return type:
- Example:
- thread = automeal.start_mg400_project("MG400_1", "PickAndPlaceProject")thread.join(20000) # 最大20秒待機
- automeal.start_test(folder_name: str) None[source]¶
レポートを保存するフォルダを作成し、テストを開始します。 作成されるフォルダの名前は "TestResult_<folder_name>" の形式となります。 引数 folder_name に指定する文字列はディレクトリパスではありません。 先頭にスラッシュ "/" や末尾に拡張子 ".*" を含む文字列を指定しないでください。 フォルダはプロジェクトルート (プロジェクトファイルのあるフォルダ) の、 Reports/TestRun_yyyymmdd_hhmmss_<8 桁のランダム文字列>/TestCase_<id>_yyyymmdd_hhmmss 以下に作成されます。 この関数はテストが開始されている状態で呼び出さないでください。
- Parameters:
folder_name (str) -- 任意のフォルダ名
- Example:
automeal.start_test("MyTest") # "TestResult_MyTest" フォルダを作成してテスト開始
- automeal.start_vd_judge(config_file_path: str, input_media_path: str = None, output_path: str = None) VDThread[source]¶
Connected VD® の判定を開始します。
- Parameters:
config_file_path (str) -- 設定ファイルのパス(相対パスの場合はプロジェクトルート基準)
input_media_path (str | None) -- 入力メディアのパス(省略時は設定ファイルに従う)
output_path (str | None) -- 出力のパス(省略時は設定ファイルに従う)
- Returns:
判定完了を待機するためのスレッドオブジェクト
- Return type:
- Example:
- automeal.start_vd_judge(config_file_path="configs/trace_config.ini",input_media_path="C:/videos/test.mp4",output_path="C:/results")
- automeal.step_sampling(start: float, last: float, step: float, time: float, duration: float) int[source]¶
ScriptGenerator の自動生成コードで使用するヘルパー関数です。 start から last へ向かって step ごとに変化する値を返します。
- Parameters:
start (float) -- 開始値
last (float) -- 終了値
step (float) -- 増分値
time (float) -- 現在の時間
duration (float) -- 終了値に遷移するまでの時間
- Returns:
step ごとに変化する値
- Return type:
int
- automeal.stop_can_message_periodic(user_defined_name: str, can_message: str) None[source]¶
指定した識別名のデバイスからメッセージ名と一致するメッセージの定期送信を停止します。
- Parameters:
user_defined_name (str) -- 識別名
can_message (str) -- 送信するデータのメッセージ名(CAN送信パネルのMessage列)
- Example:
automeal.stop_can_message_periodic("Vector-VN1630A-1", "Init") # 定義済みの Init メッセージの定期送信を停止
- automeal.stop_can_periodic(user_defined_name: str, channel: int, can_id: int | None = None) None[source]¶
指定した識別名のデバイスの指定のチャンネルからの指定のCANメッセージの定期送信を停止します。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル番号
can_id (int | None) -- CANメッセージのID。指定なし/Noneの場合は指定チャンネルの定期送信をすべて停止します。
- Example:
automeal.stop_can_periodic("Vector-VN1630A-1", 1, 0x100)
- automeal.stop_mg400_project(mg400_name: str) None[source]¶
指定したMG400ロボットで実行中のプロジェクトを停止します。
- Parameters:
mg400_name (str) -- MG400ロボットの名前
- Example:
automeal.stop_mg400_project("MG400_1")
- automeal.stop_test() None[source]¶
テストを終了し、各種レポートやログファイルを start_test() 呼び出しにより 作成されたフォルダに保存します。 この関数を呼び出す前に、start_test() を呼び出している必要があります。
- Example:
automeal.stop_test()
- automeal.wait_for_next_can_message(user_defined_name: str, channel: int, can_id: int, timeout_ms: int | None = None) bytes[source]¶
指定したチャンネルの指定したIDで次にメッセージを受信するまで待機し、受信したデータを取得します。 すでに待機状態のチャンネルを指定した場合は例外になります。 待機中にテストを終了した等チャンネルが切断された場合は例外になります。 指定したタイムアウト時間内にデータを受信しなかった場合は例外になります。
- Parameters:
user_defined_name (str) -- 識別名
channel (int) -- チャンネル
can_id (int) -- メッセージのID部分
timeout_ms (int | None) -- タイムアウトまでの時間(ms)指定。1以上の整数で指定して下さい。指定なし/Noneの場合無限待ちを行います
- Returns:
指定したチャンネルで受信したメッセージのデータ部分
- Return type:
bytes
- Raises:
ValueError -- timeout_msに0または負の値が指定された場合
- Example:
last_recv = automeal.wait_for_next_can_message("Vector-VN1630A-1", 1, 0x300, 1000) # ID0x300 を次に受信するまで待機。1秒受信なしの場合例外エラー。
- automeal.wait_for_next_serial_data(port_id: str, timeout_ms: int | None = None) bytes[source]¶
指定したポートで次にデータを受信するまで待機し、受信したデータを取得します。 すでに待機状態のポートを指定した場合は例外になります。 待機中にテストを終了した等ポートが切断された場合は例外になります。 指定したタイムアウト時間内にデータを受信しなかった場合は例外になります。
- Parameters:
port_id (str) -- ポートID
timeout_ms (int | None) -- タイムアウトまでの時間(ms)指定。1以上の整数で指定して下さい。指定なし/Noneの場合無限待ちを行います
- Returns:
指定したポートの受信データ
- Return type:
bytes
- Raises:
ValueError -- timeout_msに0または負の値が指定された場合
- Example:
last_recv = automeal.wait_for_next_serial_data("Port1", 5000) # Port1 で次に受信するまで待機。5秒受信なしの場合例外エラー。
- automeal.wait_for_next_tcp_client_data(client_name: str, timeout_ms: int | None = None) bytes[source]¶
指定した TCP クライアントで次にデータを受信するまで待機し、受信したデータを取得します。 すでに待機状態のクライアントを指定した場合は例外になります。 待機中にテストを終了した等接続が切断された場合は例外になります。 指定したタイムアウト時間内にデータを受信しなかった場合は例外になります。
- Parameters:
client_name (str) -- クライアント名
timeout_ms (int | None) -- タイムアウトまでの時間 (ms) 指定。1 以上の整数で指定して下さい。指定なし/None の場合無限待ちを行います
- Returns:
指定したクライアントの受信データ
- Return type:
bytes
- Raises:
ValueError -- timeout_ms に 0 または負の値が指定された場合
- Example:
last_recv = automeal.wait_for_next_tcp_client_data("Client1", 5000) # Client1 で次に受信するまで待機。5 秒受信なしの場合例外エラー。
- automeal.wait_for_next_udp_data(endpoint_name: str, timeout_ms: int | None = None) bytes[source]¶
指定した UDP エンドポイントで次にデータを受信するまで待機し、受信したデータを取得します。 すでに待機状態のエンドポイントを指定した場合は例外になります。 待機中にテストを終了した等接続が切断された場合は例外になります。 指定したタイムアウト時間内にデータを受信しなかった場合は例外になります。
- Parameters:
endpoint_name (str) -- エンドポイント名 (UDP 通信設定で設定した名前)
timeout_ms (int | None) -- タイムアウトまでの時間 (ms) 指定。1 以上の整数で指定して下さい。指定なし/None の場合無限待ちを行います
- Returns:
指定したエンドポイントの受信データ
- Return type:
bytes
- Raises:
ValueError -- timeout_ms に 0 または負の値が指定された場合
- Example:
last_recv = automeal.wait_for_next_udp_data("Endpoint1", 5000) # Endpoint1 で次に受信するまで待機。5秒受信なしの場合例外エラー。
- automeal.write_analog_amao(board_id: str, channel_number: int, voltage_mv: int) None[source]¶
AM-AO の出力電圧値を更新します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
voltage_mv (int) -- 電圧値 [mV] (0-基準電圧)。 上限は TestUnit 設定で設定している基準電圧によって変化します。
- Example:
automeal.write_analog_amao("Board1", 1, 5000) # Board1 の ch1 を 5000 mV に
- automeal.write_logic_cpidio0808l(board_id: str, channel_number: int, state: bool) None[source]¶
CPI-DIO-0808L の出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
state (bool) -- チャンネルの状態 Hi(True)/Lo(False)
- Example:
automeal.write_logic_cpidio0808l("Board1", 1, True) # Board1 の ch1 を Hi に
- automeal.write_logic_cpidio0808l_bits(board_id: str, state: int) None[source]¶
CPI-DIO-0808L の出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
state (int) -- 8ch 分の出力状態値 (0x00-0xFF)(Hi=1/Lo=0)
- Example:
automeal.write_logic_cpidio0808l_bits("Board1", 0xFF) # Board1 8ch 全てを Hi に
- automeal.write_logic_cpidio0808l_multi(board_id: str, states: list) None[source]¶
CPI-DIO-0808L の出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
states (list[bool | None]) -- 8ch 分の出力状態値 Hi(True)/Lo(False)/更新なし(None)
- Example:
automeal.write_logic_cpidio0808l_multi("Board1", [True, True, None, None, False, False]) # Board1 の ch1,ch2 を Hi, ch5,ch6 を Lo, それ以外は現状維持
8ch未満の場合、未指定分は None として扱われます。 8chを超える指定の場合、超えた分は無効になります。
- automeal.write_logic_cpirry16(board_id: str, channel_number: int, state: bool) None[source]¶
CPI-RRY-16 の出力状態値 (ON/OFF) を更新します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-16)
state (bool) -- チャンネルの状態 ON(True)/OFF(False)
- Example:
automeal.write_logic_cpirry16("Board1", 1, True) # Board1 の ch1 を ON に
- automeal.write_logic_cpirry16_bits(board_id: str, state: int) None[source]¶
CPI-RRY-16 の出力状態値 (ON/OFF) を更新します。
- Parameters:
board_id (str) -- ボード ID
state (int) -- 16ch 分の出力状態値 (0x0000-0xFFFF)(ON=1/OFF=0)
- Example:
automeal.write_logic_cpirry16_bits("Board1", 0xFFFF) # Board1 16ch 全てを ON に
- automeal.write_logic_cpirry16_multi(board_id: str, states: list) None[source]¶
CPI-RRY-16 の出力状態値 (ON/OFF) を更新します。
- Parameters:
board_id (str) -- ボード ID
states (list[bool | None]) -- 16ch 分の出力状態値 ON(True)/OFF(False)/更新なし(None)
- Example:
automeal.write_logic_cpirry16_multi("Board1", [True, True, None, None, False, False]) # Board1 の ch1,ch2 を ON, ch5,ch6 を OFF, それ以外は現状維持
16ch未満の場合、未指定分は None として扱われます。 16chを超える指定の場合、超えた分は無効になります。
- automeal.write_logic_rpigp10(board_id: str, channel_number: int, state: bool) None[source]¶
RPi-GP10 の指定した1chの出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-8)
state (bool) -- チャンネルの状態 Hi(True)/Lo(False)
- Example:
automeal.write_logic_rpigp10("Board1", 1, True) # Board1 の ch1 を Hi に
- automeal.write_logic_rpigp10_bits(board_id: str, state: int) None[source]¶
RPi-GP10 全chの出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
state (int) -- 8ch 分の出力状態値 (0x00-0xFF)(Hi=1/Lo=0)
- Example:
automeal.write_logic_rpigp10_bits("Board1", 0xFF) # Board1 8ch 全てを Hi に
- automeal.write_logic_rpigp10_multi(board_id: str, states: list) None[source]¶
RPi-GP10 の出力状態値 (Hi/Lo) を更新します。
- Parameters:
board_id (str) -- ボード ID
states (list[bool | None]) -- 8ch 分の出力状態値 Hi(True)/Lo(False)/更新なし(None)
- Example:
automeal.write_logic_rpigp10_multi("Board1", [True, True, None, None, False, False]) # Board1 の ch1,ch2 を Hi, ch5,ch6 を Lo, それ以外は現状維持
8ch未満の場合、未指定分は None として扱われます。 8chを超える指定の場合、超えた分は無効になります。
- automeal.write_pwm_ampio(board_id: str, channel_number: int, frequency_hz: int, duty_percent: float) None[source]¶
AM-PIO の出力 PWM 信号の周波数とデューティー比を更新します。 duty_percent はプロジェクトの設定によって分解能以下は切り捨てられます。
- Parameters:
board_id (str) -- ボード ID
channel_number (int) -- チャンネル番号 (1-4)
frequency_hz (int) -- 周波数 [Hz] (0-1,000,000)。 上限は TestUnit 設定で設定している最大周波数によって変化します。
duty_percent (float) -- デューティー比 [%] (0.0-99.9)。 TestUnit 設定で設定している最大周波数 (Duty 分解能) によって値が切り捨てられます。
- Example:
automeal.write_pwm_ampio("Board1", 1, 10000, 50) # Board1 の ch1 を 10,000 Hz, 50 % に
Submodules¶
automeal.test_runner module¶
- class automeal.test_runner.MG400ProjectThread(target)[source]¶
Bases:
Thread- join(timeout_ms: int | None = None) None[source]¶
Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is called terminates -- either normally or through an unhandled exception or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened -- if the thread is still alive, the join() call timed out.
When the timeout argument is not present or None, the operation will block until the thread terminates.
A thread can be join()ed many times.
join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.
- run() None[source]¶
Method representing the thread's activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- class automeal.test_runner.MG400State(*values)[source]¶
Bases:
Enum- DISABLE = 2¶
- ENABLE = 1¶
- ERROR = 4¶
- MOVING = 3¶
- NONE = 0¶
- OTHER = 5¶
- class automeal.test_runner.VDThread(target)[source]¶
Bases:
Thread- join(timeout_ms: int | None = None) None[source]¶
Wait until the thread terminates.
This blocks the calling thread until the thread whose join() method is called terminates -- either normally or through an unhandled exception or until the optional timeout occurs.
When the timeout argument is present and not None, it should be a floating point number specifying a timeout for the operation in seconds (or fractions thereof). As join() always returns None, you must call is_alive() after join() to decide whether a timeout happened -- if the thread is still alive, the join() call timed out.
When the timeout argument is not present or None, the operation will block until the thread terminates.
A thread can be join()ed many times.
join() raises a RuntimeError if an attempt is made to join the current thread as that would cause a deadlock. It is also an error to join() a thread before it has been started and attempts to do so raises the same exception.
- run() None[source]¶
Method representing the thread's activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object's constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- class automeal.test_runner.SerialRecord(time: timedelta, direction: str, port: str, data: bytes)[source]¶
Bases:
objectシリアル通信のレコードを表すデータクラス。
- time¶
タイムスタンプ(ミリ秒)
- Type:
datetime.timedelta
- direction¶
送受信方向 ("Receive")
- Type:
str
- port¶
シリアルポート名
- Type:
str
- data¶
送受信データ(バイト列)
- Type:
bytes
- classmethod from_stream_data(stream_data: SerialRecord) SerialRecord[source]¶
gRPC ストリームデータから SerialRecord を生成します。
- class automeal.test_runner.CANRecord(time: timedelta, direction: str, identification_name: str, channel: int, frame_type: str, can_id: int, dlc: int, data: bytes)[source]¶
Bases:
objectCAN通信のレコードを表すデータクラス。
- time¶
タイムスタンプ(ミリ秒)
- Type:
datetime.timedelta
- direction¶
通信の方向 ("Receive")
- Type:
str
- identification_name¶
ハードウェアの識別名
- Type:
str
- channel¶
使用されたCANチャネル番号。
- Type:
int
- frame_type¶
フレームタイプ("Data Frame" or "Error Frame")
- Type:
str
- can_id¶
CANメッセージのID
- Type:
int
- dlc¶
データ長コード
- Type:
int
- data¶
CANメッセージのデータペイロード
- Type:
bytes
- class automeal.test_runner.UDPRecord(time: timedelta, direction: str, endpoint_name: str, local_ip: str, local_port: int, remote_ip: str, remote_port: int, data: bytes)[source]¶
Bases:
objectUDP 通信のレコードを表すデータクラス。
- time¶
タイムスタンプ(ミリ秒)
- Type:
datetime.timedelta
- direction¶
送受信方向 ("Receive")
- Type:
str
- endpoint_name¶
エンドポイント名
- Type:
str
- local_ip¶
ローカル IP アドレス
- Type:
str
- local_port¶
ローカルポート番号
- Type:
int
- remote_ip¶
リモート IP アドレス
- Type:
str
- remote_port¶
リモートポート番号
- Type:
int
- data¶
送受信データ(バイト列)
- Type:
bytes
- class automeal.test_runner.TCPClientRecord(time: timedelta, direction: str, client_name: str, local_ip: str, local_port: int, server_ip: str, server_port: int, data: bytes)[source]¶
Bases:
objectTCP クライアント通信のレコードを表すデータクラス。
- time¶
タイムスタンプ(ミリ秒)
- Type:
datetime.timedelta
- direction¶
送受信方向 ("Receive")
- Type:
str
- client_name¶
クライアント名
- Type:
str
- local_ip¶
ローカル IP アドレス
- Type:
str
- local_port¶
ローカルポート番号
- Type:
int
- server_ip¶
サーバ IP アドレス
- Type:
str
- server_port¶
サーバポート番号
- Type:
int
- data¶
送受信データ(バイト列)
- Type:
bytes
- classmethod from_stream_data(stream_data: TCPClientRecord) TCPClientRecord[source]¶
gRPC ストリームデータから TCPClientRecord を生成します。
- class automeal.test_runner.SerialStream(test_runner: TestRunner)[source]¶
Bases:
PacketCommunicationStream
- class automeal.test_runner.CANStream(test_runner: TestRunner)[source]¶
Bases:
PacketCommunicationStream
- class automeal.test_runner.UDPStream(test_runner: TestRunner)[source]¶
Bases:
PacketCommunicationStream
- class automeal.test_runner.TCPClientStream(test_runner: TestRunner)[source]¶
Bases:
PacketCommunicationStream