pm2cd package

class pm2cd.PM2CD(ip_address: str, port: int = 7777, timeout_sec: float = 3.0, channel_count: int = 2, worker_count: int = 2, logger: Any = None, log_level: str = 'INFO')[ソース]

ベースクラス: object

PM2CDsingle を worker process 内で実行する公開 I/F。

close() → bool[ソース]

worker、共有通信、Communication manager を終了する。

connect() → bool[ソース]

PM2CD へ TCP 接続する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

constant_speed_scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ定速スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

disconnect() → bool[ソース]

PM2CD との TCP 接続を切断する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop(motor: int | None = None) → bool[ソース]

指定モーターを非常停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop_all() → bool[ソース]

全モーターを非常停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

find_home(motor: int | None = None) → bool[ソース]

原点検出動作を開始する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

get_backlash(motor: int | None = None) → int | None[ソース]

バックラッシュ補正量を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hard_limit_enabled(motor: int | None = None) → List[bool] | None[ソース]

CW/CCW ハードウェアLSの enable 設定を [CW, CCW] で取得する。

get_hard_limit_normally_closed(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアLS接点設定を [CW, CCW, HP] で取得する。

True は normally closed、False は normally open を表す。

get_hard_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアリミット状態を [CW, CCW, HP] で取得する。

get_hard_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのハードウェアリミット状態を [[CW, CCW, HP], ...] で取得する。

get_hardware_version() → str | None[ソース]

装置のハードウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_high_speed(motor: int | None = None) → int | None[ソース]

高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold(motor: int | None = None) → str | None[ソース]

指定モーターの HOLD 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_off_time(motor: int | None = None) → int | None[ソース]

HOLD OFF 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_on_time(motor: int | None = None) → int | None[ソース]

HOLD ON 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_offset(motor: int | None = None) → int | None[ソース]

原点オフセットを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_position(motor: int | None = None) → int | None[ソース]

記録済み原点位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_status(motor: int | None = None) → HomeStatus | None[ソース]

原点検出設定状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_jog_pulse(motor: int | None = None) → int | None[ソース]

JOG パルス数を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit(motor: int | None = None, side: str | None = None) → int | None[ソース]

指定側のソフトウェアリミット位置を取得する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit_enabled(motor: int | None = None) → bool | None[ソース]

ソフトウェアリミットの有効/無効を取得する。

get_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ソフトウェアリミット状態を [CW, CCW] で取得する。

get_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのソフトウェアリミット状態を [[CW, CCW], ...] で取得する。

get_limit_switch_setting(motor: int | None = None) → List[bool] | None[ソース]

リミット設定を意味値のリストで取得する。

戻り値:

[software_enable, CW_enable, CCW_enable, HP_enable, CW_normally_closed, CCW_normally_closed, HP_normally_closed]。 取得に失敗した場合は None。

get_low_speed(motor: int | None = None) → int | None[ソース]

低速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_middle_speed(motor: int | None = None) → int | None[ソース]

中速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_motor_setting(motor: int | None = None) → MotorSetting | None[ソース]

モーター設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_pause_status() → str | None[ソース]

一時停止状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_position(motor: int | None = None) → int | None[ソース]

指定モーターの現在位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_preset_position(motor: int | None = None) → int | None[ソース]

プリセット位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rate(motor: int | None = None) → float | None[ソース]

加減速レートを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

加減速レート。取得に失敗した場合は None。

get_rate_number(motor: int | None = None) → int | None[ソース]

加減速レート番号を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rotate(motor: int | None = None) → bool | None[ソース]

指定モーターが回転中か確認する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed(motor: int | None = None) → int | None[ソース]

set_speed() の基準となる高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_mode(motor: int | None = None) → str | None[ソース]

現在の速度モードを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_profile(motor: int | None = None) → List[int] | None[ソース]

低速・中速・高速の設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

低速・中速・高速の順の設定値。取得に失敗した場合は None。

get_status(motor: int | None = None) → MotorStatus | None[ソース]

指定モーターの状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_stop_mode(motor: int | None = None) → StopMode | None[ソース]

停止モード設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_version() → VersionInfo | None[ソース]

装置のソフトウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home(motor: int | None = None) → bool[ソース]

記録済み原点位置へ移動する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

is_busy(motor: int | None = None) → bool | None[ソース]

指定モーターの BUSY 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

is_connected() → bool[ソース]

TCP 接続状態を取得する。

戻り値:

接続中の場合は True、それ以外は False。

jog(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ JOG 動作する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

local() → bool[ソース]

装置をローカル操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

property motor: int

引数省略時に使用するモーター番号を取得する。

move(target: int, motor: int | None = None, backlash: str | bool | None = True, relative: bool = False) → bool[ソース]

指定モーターを絶対位置または相対量で移動する。

motor を省略した場合は worker 側の motor プロパティを使用する。 relative=False の場合は target を絶対目標位置として扱い、 relative=True の場合は target を現在位置からの相対移動量として扱う。

パラメータ:
  • target -- 絶対目標位置。relative=True の場合は相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

  • relative -- True の場合は相対移動、False の場合は絶対移動。

戻り値:

処理に成功した場合は True、失敗した場合は False。

move_relative(target: int, motor: int | None = None, backlash: str | bool | None = True) → bool[ソース]

指定モーターを現在位置から相対移動する。

move(..., relative=True) と同じ動作をする互換メソッド。

パラメータ:
  • target -- 相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

number_to_rate(index: int) → float | None[ソース]

レート番号を RATE_TABLE のレート値へ変換する。

パラメータ:

index -- RATE_TABLE のインデックス。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

pause() → bool[ソース]

動作を一時停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

rate_to_number(rate: float) → int | None[ソース]

レート値を対応する RATE_TABLE の番号へ変換する。

パラメータ:

rate -- 変換するレート値。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

remote() → bool[ソース]

装置をリモート操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

resume() → bool[ソース]

一時停止を解除する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ連続スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan_home(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ原点探索スキャンを開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_backlash(motor: int | None = None, backlash: int | None = None) → bool[ソース]

バックラッシュ補正量を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hard_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

CW/CCW ハードウェアリミットを有効/無効にする。

set_hard_limit_normally_closed(motor: int | None = None, side: str | None = None, normally_closed: bool | None = None) → bool[ソース]

ハードウェアLSの接点仕様を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- hp、cw、ccw。

  • normally_closed -- normally closed にする場合は True、 normally open にする場合は False。

set_high_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

指定モーターの HOLD 状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • enabled -- 有効にする場合は True、無効にする場合は False。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_off_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD OFF 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_on_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD ON 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_offset(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点オフセットを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_status(motor: int | None = None, found: bool | None = None, found_direction: str | None = None, auto_start_direction: str | None = None) → bool[ソース]

原点検出設定状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • found -- 原点検出済み状態。

  • found_direction -- 原点検出方向。

  • auto_start_direction -- 自動原点検出開始方向。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_jog_pulse(motor: int | None = None, pulse: int | None = None) → bool[ソース]

JOG パルス数を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit(motor: int | None = None, side: str | None = None, pulse: int | None = None) → bool[ソース]

指定側のソフトウェアリミット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

ソフトウェアリミットを有効/無効にする。

set_low_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

低速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_middle_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

中速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_motor_setting(motor: int | None = None, drive_enabled: bool | None = None, hold_mode: int | None = None, output_mode: int | None = None) → bool[ソース]

モーター設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • drive_enabled -- モータードライブを有効にする場合は True。

  • hold_mode -- ホールドモード。

  • output_mode -- 出力モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_preset_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

プリセット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_rate(motor: int | None = None, rate: float | None = None) → bool[ソース]

加減速レートを設定する。

指定値に最も近いレート番号を選択して設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • rate -- 加減速レート。

戻り値:

処理に成功した場合は True、失敗した場合は False。

例外:

TypeError -- rate の型が不正な場合。

set_rate_number(motor: int | None = None, number: int | None = None) → bool[ソース]

加減速レート番号を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • number -- レート番号。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速値を基準に低速・中速・高速を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_mode(motor: int | None = None, mode: int | str | None = None) → bool[ソース]

速度モードを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • mode -- 速度モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_profile(motor: int | None = None, low_speed: int | None = None, middle_speed: int | None = None, high_speed: int | None = None) → bool[ソース]

低速・中速・高速を個別に設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • low_speed -- 低速値。

  • middle_speed -- 中速値。

  • high_speed -- 高速値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_stop_mode(motor: int | None = None, panel_fast: bool | None = None, limit_fast: bool | None = None) → bool[ソース]

停止モード設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • panel_fast -- パネル停止を高速停止にする場合は True。

  • limit_fast -- リミット停止を高速停止にする場合は True。

戻り値:

処理に成功した場合は True、失敗した場合は False。

status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する互換メソッド。

戻り値:

取得または変換に成功した値。失敗した場合は None。

stop(motor: int | None = None) → bool[ソース]

指定モーターを停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

stop_all() → bool[ソース]

全モーターを停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

version()[ソース]

version を実行する。

wait_for_complete(motor: int | None = None, timeout_sec: float = 30.0, interval_sec: float = 0.1, target_position: int | None = None, show_position: bool = True) → MotorStatus | None[ソース]

指定モーターの最終停止を待つ。

完了判定は PM2CDsingle.wait_for_complete() に委譲する。 move() と wait_for_complete() が別 worker で実行されても、ctrl 層の SharedContext に保存した move context を参照できる。

パラメータ:
  • motor -- モーター番号。None の場合は motor プロパティを使用する。

  • timeout_sec -- 待機処理のタイムアウト秒数。

  • interval_sec -- 状態確認のポーリング間隔秒数。

  • target_position -- 完了判定に使う絶対目標位置。

  • show_position -- True の場合は各ポーリングの現在位置を表示する。

戻り値:

完了条件を満たした最後の MotorStatus。失敗時は None。

zero_position(motor: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを 0 にする。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

Subpackages

Submodules

pm2cd.pm2cd_ctrl module

PM2CD の multiprocessing 対応公開 I/F。

class pm2cd.pm2cd_ctrl.PM2CD(ip_address: str, port: int = 7777, timeout_sec: float = 3.0, channel_count: int = 2, worker_count: int = 2, logger: Any = None, log_level: str = 'INFO')[ソース]

ベースクラス: object

PM2CDsingle を worker process 内で実行する公開 I/F。

close() → bool[ソース]

worker、共有通信、Communication manager を終了する。

connect() → bool[ソース]

PM2CD へ TCP 接続する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

constant_speed_scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ定速スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

disconnect() → bool[ソース]

PM2CD との TCP 接続を切断する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop(motor: int | None = None) → bool[ソース]

指定モーターを非常停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop_all() → bool[ソース]

全モーターを非常停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

find_home(motor: int | None = None) → bool[ソース]

原点検出動作を開始する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

get_backlash(motor: int | None = None) → int | None[ソース]

バックラッシュ補正量を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hard_limit_enabled(motor: int | None = None) → List[bool] | None[ソース]

CW/CCW ハードウェアLSの enable 設定を [CW, CCW] で取得する。

get_hard_limit_normally_closed(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアLS接点設定を [CW, CCW, HP] で取得する。

True は normally closed、False は normally open を表す。

get_hard_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアリミット状態を [CW, CCW, HP] で取得する。

get_hard_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのハードウェアリミット状態を [[CW, CCW, HP], ...] で取得する。

get_hardware_version() → str | None[ソース]

装置のハードウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_high_speed(motor: int | None = None) → int | None[ソース]

高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold(motor: int | None = None) → str | None[ソース]

指定モーターの HOLD 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_off_time(motor: int | None = None) → int | None[ソース]

HOLD OFF 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_on_time(motor: int | None = None) → int | None[ソース]

HOLD ON 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_offset(motor: int | None = None) → int | None[ソース]

原点オフセットを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_position(motor: int | None = None) → int | None[ソース]

記録済み原点位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_status(motor: int | None = None) → HomeStatus | None[ソース]

原点検出設定状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_jog_pulse(motor: int | None = None) → int | None[ソース]

JOG パルス数を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit(motor: int | None = None, side: str | None = None) → int | None[ソース]

指定側のソフトウェアリミット位置を取得する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit_enabled(motor: int | None = None) → bool | None[ソース]

ソフトウェアリミットの有効/無効を取得する。

get_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ソフトウェアリミット状態を [CW, CCW] で取得する。

get_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのソフトウェアリミット状態を [[CW, CCW], ...] で取得する。

get_limit_switch_setting(motor: int | None = None) → List[bool] | None[ソース]

リミット設定を意味値のリストで取得する。

戻り値:

[software_enable, CW_enable, CCW_enable, HP_enable, CW_normally_closed, CCW_normally_closed, HP_normally_closed]。 取得に失敗した場合は None。

get_low_speed(motor: int | None = None) → int | None[ソース]

低速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_middle_speed(motor: int | None = None) → int | None[ソース]

中速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_motor_setting(motor: int | None = None) → MotorSetting | None[ソース]

モーター設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_pause_status() → str | None[ソース]

一時停止状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_position(motor: int | None = None) → int | None[ソース]

指定モーターの現在位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_preset_position(motor: int | None = None) → int | None[ソース]

プリセット位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rate(motor: int | None = None) → float | None[ソース]

加減速レートを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

加減速レート。取得に失敗した場合は None。

get_rate_number(motor: int | None = None) → int | None[ソース]

加減速レート番号を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rotate(motor: int | None = None) → bool | None[ソース]

指定モーターが回転中か確認する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed(motor: int | None = None) → int | None[ソース]

set_speed() の基準となる高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_mode(motor: int | None = None) → str | None[ソース]

現在の速度モードを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_profile(motor: int | None = None) → List[int] | None[ソース]

低速・中速・高速の設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

低速・中速・高速の順の設定値。取得に失敗した場合は None。

get_status(motor: int | None = None) → MotorStatus | None[ソース]

指定モーターの状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_stop_mode(motor: int | None = None) → StopMode | None[ソース]

停止モード設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_version() → VersionInfo | None[ソース]

装置のソフトウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home(motor: int | None = None) → bool[ソース]

記録済み原点位置へ移動する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

is_busy(motor: int | None = None) → bool | None[ソース]

指定モーターの BUSY 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

is_connected() → bool[ソース]

TCP 接続状態を取得する。

戻り値:

接続中の場合は True、それ以外は False。

jog(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ JOG 動作する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

local() → bool[ソース]

装置をローカル操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

property motor: int

引数省略時に使用するモーター番号を取得する。

move(target: int, motor: int | None = None, backlash: str | bool | None = True, relative: bool = False) → bool[ソース]

指定モーターを絶対位置または相対量で移動する。

motor を省略した場合は worker 側の motor プロパティを使用する。 relative=False の場合は target を絶対目標位置として扱い、 relative=True の場合は target を現在位置からの相対移動量として扱う。

パラメータ:
  • target -- 絶対目標位置。relative=True の場合は相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

  • relative -- True の場合は相対移動、False の場合は絶対移動。

戻り値:

処理に成功した場合は True、失敗した場合は False。

move_relative(target: int, motor: int | None = None, backlash: str | bool | None = True) → bool[ソース]

指定モーターを現在位置から相対移動する。

move(..., relative=True) と同じ動作をする互換メソッド。

パラメータ:
  • target -- 相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

number_to_rate(index: int) → float | None[ソース]

レート番号を RATE_TABLE のレート値へ変換する。

パラメータ:

index -- RATE_TABLE のインデックス。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

pause() → bool[ソース]

動作を一時停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

rate_to_number(rate: float) → int | None[ソース]

レート値を対応する RATE_TABLE の番号へ変換する。

パラメータ:

rate -- 変換するレート値。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

remote() → bool[ソース]

装置をリモート操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

resume() → bool[ソース]

一時停止を解除する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ連続スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan_home(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ原点探索スキャンを開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_backlash(motor: int | None = None, backlash: int | None = None) → bool[ソース]

バックラッシュ補正量を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hard_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

CW/CCW ハードウェアリミットを有効/無効にする。

set_hard_limit_normally_closed(motor: int | None = None, side: str | None = None, normally_closed: bool | None = None) → bool[ソース]

ハードウェアLSの接点仕様を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- hp、cw、ccw。

  • normally_closed -- normally closed にする場合は True、 normally open にする場合は False。

set_high_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

指定モーターの HOLD 状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • enabled -- 有効にする場合は True、無効にする場合は False。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_off_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD OFF 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_on_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD ON 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_offset(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点オフセットを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_status(motor: int | None = None, found: bool | None = None, found_direction: str | None = None, auto_start_direction: str | None = None) → bool[ソース]

原点検出設定状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • found -- 原点検出済み状態。

  • found_direction -- 原点検出方向。

  • auto_start_direction -- 自動原点検出開始方向。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_jog_pulse(motor: int | None = None, pulse: int | None = None) → bool[ソース]

JOG パルス数を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit(motor: int | None = None, side: str | None = None, pulse: int | None = None) → bool[ソース]

指定側のソフトウェアリミット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

ソフトウェアリミットを有効/無効にする。

set_low_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

低速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_middle_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

中速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_motor_setting(motor: int | None = None, drive_enabled: bool | None = None, hold_mode: int | None = None, output_mode: int | None = None) → bool[ソース]

モーター設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • drive_enabled -- モータードライブを有効にする場合は True。

  • hold_mode -- ホールドモード。

  • output_mode -- 出力モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_preset_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

プリセット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_rate(motor: int | None = None, rate: float | None = None) → bool[ソース]

加減速レートを設定する。

指定値に最も近いレート番号を選択して設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • rate -- 加減速レート。

戻り値:

処理に成功した場合は True、失敗した場合は False。

例外:

TypeError -- rate の型が不正な場合。

set_rate_number(motor: int | None = None, number: int | None = None) → bool[ソース]

加減速レート番号を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • number -- レート番号。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速値を基準に低速・中速・高速を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_mode(motor: int | None = None, mode: int | str | None = None) → bool[ソース]

速度モードを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • mode -- 速度モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_profile(motor: int | None = None, low_speed: int | None = None, middle_speed: int | None = None, high_speed: int | None = None) → bool[ソース]

低速・中速・高速を個別に設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • low_speed -- 低速値。

  • middle_speed -- 中速値。

  • high_speed -- 高速値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_stop_mode(motor: int | None = None, panel_fast: bool | None = None, limit_fast: bool | None = None) → bool[ソース]

停止モード設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • panel_fast -- パネル停止を高速停止にする場合は True。

  • limit_fast -- リミット停止を高速停止にする場合は True。

戻り値:

処理に成功した場合は True、失敗した場合は False。

status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する互換メソッド。

戻り値:

取得または変換に成功した値。失敗した場合は None。

stop(motor: int | None = None) → bool[ソース]

指定モーターを停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

stop_all() → bool[ソース]

全モーターを停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

version()[ソース]

version を実行する。

wait_for_complete(motor: int | None = None, timeout_sec: float = 30.0, interval_sec: float = 0.1, target_position: int | None = None, show_position: bool = True) → MotorStatus | None[ソース]

指定モーターの最終停止を待つ。

完了判定は PM2CDsingle.wait_for_complete() に委譲する。 move() と wait_for_complete() が別 worker で実行されても、ctrl 層の SharedContext に保存した move context を参照できる。

パラメータ:
  • motor -- モーター番号。None の場合は motor プロパティを使用する。

  • timeout_sec -- 待機処理のタイムアウト秒数。

  • interval_sec -- 状態確認のポーリング間隔秒数。

  • target_position -- 完了判定に使う絶対目標位置。

  • show_position -- True の場合は各ポーリングの現在位置を表示する。

戻り値:

完了条件を満たした最後の MotorStatus。失敗時は None。

zero_position(motor: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを 0 にする。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

pm2cd.pm2cd_device module

class pm2cd.pm2cd_device.PM2CDDevice(communication: Communication, channel_count: int = 2, logger=None, log_level: str = 'INFO')[ソース]

ベースクラス: object

PM2CD / PM2C-06A 固有のコマンド生成・応答処理を担当する。

BACKLASH_MAX = 9999
BACKLASH_MIN = -9999
CHANNEL_COUNT = 2
HOLD_TIME_MAX = 3000
HOLD_TIME_MIN = 50
HOLD_TIME_STEP = 10
HOME_OFFSET_MAX = 9999
HOME_OFFSET_MIN = 0
JOG_PULSE_MAX = 9999
JOG_PULSE_MIN = 0
POSITION_MAX = 8388607
POSITION_MIN = -8388608
RATE_MAX = 25
RATE_MIN = 0
SPEED_MAX = 100000
SPEED_MIN = 5
backlash(motor: int) → int | None[ソース]

バックラッシュ補正量を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

check_rotate(motor: int) → bool | None[ソース]

指定モーターが回転中か確認する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

constant_speed_scan(motor: int, direction: str) → bool[ソース]

指定方向へ定速スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

emergency_stop(motor: int) → bool[ソース]

指定モーターを非常停止する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop_all() → bool[ソース]

全モーターを非常停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

find_home(motor: int) → bool[ソース]

原点検出動作を開始する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

処理に成功した場合は True、失敗した場合は False。

hardware_version() → str | None[ソース]

装置のハードウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

high_speed(motor: int) → int | None[ソース]

高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

hold(motor: int) → str | None[ソース]

指定モーターの HOLD 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

hold_off_time(motor: int) → int | None[ソース]

HOLD OFF 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

hold_on_time(motor: int) → int | None[ソース]

HOLD ON 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home(motor: int) → bool[ソース]

記録済み原点位置へ移動する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

処理に成功した場合は True、失敗した場合は False。

home_offset(motor: int) → int | None[ソース]

原点オフセットを取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home_position(motor: int) → int | None[ソース]

記録済み原点位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home_status(motor: int) → HomeStatus | None[ソース]

原点検出設定状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

jog(motor: int, direction: str) → bool[ソース]

指定方向へ JOG 動作する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

jog_pulse(motor: int) → int | None[ソース]

JOG パルス数を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

limit(motor: int, side: str) → int | None[ソース]

指定側のソフトウェアリミット位置を取得する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • side -- リミット側。cw または ccw。

戻り値:

取得または変換に成功した値。失敗した場合は None。

limit_status(motor: int) → LimitStatus | None[ソース]

指定モーターのハード/ソフトリミット現在状態を取得する。

limit_status_all() → List[LimitStatus] | None[ソース]

HDSTLS? 全モーターのハード/ソフトリミット現在状態を取得する。

limit_switch_setting(motor: int) → LimitSwitchSetting | None[ソース]

SETLS? リミットスイッチ設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

limit_switch_setting_raw(motor: int) → str | None[ソース]

リミットスイッチ設定を生の設定文字列で取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得した生の設定文字列。失敗した場合は None。

local() → bool[ソース]

装置をローカル操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

low_speed(motor: int) → int | None[ソース]

低速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

middle_speed(motor: int) → int | None[ソース]

中速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

motor_setting(motor: int) → MotorSetting | None[ソース]

モーター設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

move(motor: int, pulse: int, backlash: str | bool | None = True) → bool[ソース]

指定モーターを絶対位置へ移動する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

move_relative(motor: int, pulse: int, backlash: str | bool | None = True) → bool[ソース]

指定モーターを現在位置から相対移動する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

static number_to_rate(index: int) → float[ソース]

レート番号を RATE_TABLE のレート値へ変換する。

パラメータ:

index -- RATE_TABLE のインデックス。

戻り値:

float 型の結果。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

pause() → bool[ソース]

動作を一時停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

pause_status() → str | None[ソース]

一時停止状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

position(motor: int) → int | None[ソース]

指定モーターの現在位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

preset_position(motor: int) → int | None[ソース]

プリセット位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

rate_number(motor: int) → int | None[ソース]

加減速レート番号を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

static rate_to_number(rate: float) → int[ソース]

レート値を対応する RATE_TABLE の番号へ変換する。

パラメータ:

rate -- 変換するレート値。

戻り値:

int 型の結果。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

remote() → bool[ソース]

装置をリモート操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

resume() → bool[ソース]

一時停止を解除する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan(motor: int, direction: str) → bool[ソース]

指定方向へ連続スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan_home(motor: int, direction: str) → bool[ソース]

指定方向へ原点探索スキャンを開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_backlash(motor: int, backlash: int) → bool[ソース]

バックラッシュ補正量を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_digital_limit_enabled(motor: int, enabled: bool) → bool[ソース]

指定モーターのソフトウェアリミットを有効/無効にする。

set_hard_limit_enabled(motor: int, enabled: bool) → bool[ソース]

指定モーターのCW/CCWハードウェアリミットを有効/無効にする。

set_hard_limit_normally_closed(motor: int, side: str, normally_closed: bool) → bool[ソース]

ハードウェアLSの接点仕様を normally closed/open で設定する。

set_high_speed(motor: int, speed: int) → bool[ソース]

高速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold(motor: int, enabled: bool) → bool[ソース]

指定モーターの HOLD 状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • enabled -- 有効にする場合は True、無効にする場合は False。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_off_time(motor: int, msec: int) → bool[ソース]

HOLD OFF 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_on_time(motor: int, msec: int) → bool[ソース]

HOLD ON 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_offset(motor: int, pulse: int) → bool[ソース]

原点オフセットを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_position(motor: int, pulse: int) → bool[ソース]

原点位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_status(motor: int, found: bool, found_direction: str, auto_start_direction: str) → bool[ソース]

原点検出設定状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • found -- 原点検出済み状態。

  • found_direction -- 原点検出方向。

  • auto_start_direction -- 自動原点検出開始方向。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_jog_pulse(motor: int, pulse: int) → bool[ソース]

JOG パルス数を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit(motor: int, side: str, pulse: int) → bool[ソース]

指定側のソフトウェアリミット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • side -- リミット側。cw または ccw。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit_switch_setting_raw(motor: int, setting: str) → bool[ソース]

リミットスイッチ設定を生の設定文字列で書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • setting -- 装置へ設定する生の設定文字列。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_low_speed(motor: int, speed: int) → bool[ソース]

低速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_middle_speed(motor: int, speed: int) → bool[ソース]

中速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_motor_setting(motor: int, drive_enabled: bool, hold_mode: int, output_mode: int) → bool[ソース]

モーター設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • drive_enabled -- モータードライブを有効にする場合は True。

  • hold_mode -- ホールドモード。

  • output_mode -- 出力モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_position(motor: int, pulse: int) → bool[ソース]

指定モーターの現在位置カウンタを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_preset_position(motor: int, pulse: int) → bool[ソース]

プリセット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_rate_number(motor: int, number: int) → bool[ソース]

加減速レート番号を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • number -- レート番号。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed(motor: int, speed: int) → bool[ソース]

高速値を基準に低速・中速・高速を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_mode(motor: int, mode: int | str) → bool[ソース]

速度モードを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • mode -- 速度モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_profile(motor: int, low_speed: int, middle_speed: int, high_speed: int) → bool[ソース]

低速・中速・高速を個別に設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • low_speed -- 低速値。

  • middle_speed -- 中速値。

  • high_speed -- 高速値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_stop_mode(motor: int, panel_fast: bool, limit_fast: bool) → bool[ソース]

停止モード設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。

  • panel_fast -- パネル停止を高速停止にする場合は True。

  • limit_fast -- リミット停止を高速停止にする場合は True。

戻り値:

処理に成功した場合は True、失敗した場合は False。

speed(motor: int) → int | None[ソース]

set_speed() の基準となる高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

speed_mode(motor: int) → str | None[ソース]

現在の速度モードを取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

speed_profile(motor: int) → List[int] | None[ソース]

低速・中速・高速の設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

低速・中速・高速の順の設定値。取得に失敗した場合は None。

status(motor: int) → MotorStatus | None[ソース]

指定モーターの状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

stop(motor: int) → bool[ソース]

指定モーターを停止する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

処理に成功した場合は True、失敗した場合は False。

stop_all() → bool[ソース]

全モーターを停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

stop_mode(motor: int) → StopMode | None[ソース]

停止モード設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。

戻り値:

取得または変換に成功した値。失敗した場合は None。

version() → VersionInfo | None[ソース]

装置のソフトウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

pm2cd.pm2cd_device.main() → None[ソース]

PM2CDDevice の基本的な使用例を実行する。

PM2CDDevice は通信層を外部から受け取るため、Communication を生成して 接続した後に Device I/F を使用する。この例では装置を動かさず、 バージョンと状態取得だけを確認する。

戻り値:

None。

pm2cd.pm2cd_single module

class pm2cd.pm2cd_single.PM2CDsingle(ip_address: str, port: int = 7777, timeout_sec: float = 3.0, channel_count: int = 2, logger=None, log_level: str = 'INFO', communication: Communication | None = None)[ソース]

ベースクラス: object

PM2CD を単一プロセスから制御するための公開 I/F。

close() → bool[ソース]

通信を終了する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

connect() → bool[ソース]

PM2CD へ TCP 接続する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

constant_speed_scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ定速スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する互換メソッド。

戻り値:

取得または変換に成功した値。失敗した場合は None。

disconnect() → bool[ソース]

PM2CD との TCP 接続を切断する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop(motor: int | None = None) → bool[ソース]

指定モーターを非常停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

emergency_stop_all() → bool[ソース]

全モーターを非常停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

find_home(motor: int | None = None) → bool[ソース]

原点検出動作を開始する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

get_backlash(motor: int | None = None) → int | None[ソース]

バックラッシュ補正量を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_controller_status() → ControllerStatus | None[ソース]

コントローラー全体の状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hard_limit_enabled(motor: int | None = None) → List[bool] | None[ソース]

CW/CCW ハードウェアLSの enable 設定を [CW, CCW] で取得する。

HP LS は PM2C/PM4C-06A では常時 enable のため返さない。

get_hard_limit_normally_closed(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアLS接点設定を [CW, CCW, HP] で取得する。

True は normally closed、False は normally open を表す。

get_hard_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ハードウェアリミット状態を [CW, CCW, HP] で取得する。

get_hard_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのハードウェアリミット状態を [[CW, CCW, HP], ...] で取得する。

get_hardware_version() → str | None[ソース]

装置のハードウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_high_speed(motor: int | None = None) → int | None[ソース]

高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold(motor: int | None = None) → str | None[ソース]

指定モーターの HOLD 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_off_time(motor: int | None = None) → int | None[ソース]

HOLD OFF 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_hold_on_time(motor: int | None = None) → int | None[ソース]

HOLD ON 時間を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_offset(motor: int | None = None) → int | None[ソース]

原点オフセットを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_position(motor: int | None = None) → int | None[ソース]

記録済み原点位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_home_status(motor: int | None = None) → HomeStatus | None[ソース]

原点検出設定状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_jog_pulse(motor: int | None = None) → int | None[ソース]

JOG パルス数を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit(motor: int | None = None, side: str | None = None) → int | None[ソース]

指定側のソフトウェアリミット位置を取得する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_limit_enabled(motor: int | None = None) → bool | None[ソース]

ソフトウェアリミットの有効/無効を取得する。

get_limit_status(motor: int | None = None) → List[bool] | None[ソース]

ソフトウェアリミット状態を [CW, CCW] で取得する。

get_limit_status_all() → List[List[bool]] | None[ソース]

全モーターのソフトウェアリミット状態を [[CW, CCW], ...] で取得する。

get_limit_switch_setting(motor: int | None = None) → List[bool] | None[ソース]

リミット設定を意味値のリストで取得する。

戻り値:

[digital_limit_enable, CW_enable, CCW_enable, CW_normally_closed, CCW_normally_closed, HP_normally_closed]。 HP LS は常時 enable のため enable 値には含めない。 取得に失敗した場合は None。

get_low_speed(motor: int | None = None) → int | None[ソース]

低速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_middle_speed(motor: int | None = None) → int | None[ソース]

中速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_motor_setting(motor: int | None = None) → MotorSetting | None[ソース]

モーター設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_pause_status() → str | None[ソース]

一時停止状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_position(motor: int | None = None) → int | None[ソース]

指定モーターの現在位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_preset_position(motor: int | None = None) → int | None[ソース]

プリセット位置を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rate(motor: int | None = None) → float | None[ソース]

加減速レートを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

加減速レート。取得に失敗した場合は None。

get_rate_number(motor: int | None = None) → int | None[ソース]

加減速レート番号を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_rotate(motor: int | None = None) → bool | None[ソース]

指定モーターが回転中か確認する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed(motor: int | None = None) → int | None[ソース]

set_speed() の基準となる高速設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_mode(motor: int | None = None) → str | None[ソース]

現在の速度モードを取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_speed_profile(motor: int | None = None) → List[int] | None[ソース]

低速・中速・高速の設定値を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

低速・中速・高速の順の設定値。取得に失敗した場合は None。

get_status(motor: int | None = None) → MotorStatus | None[ソース]

指定モーターの状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_stop_mode(motor: int | None = None) → StopMode | None[ソース]

停止モード設定を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

get_version() → VersionInfo | None[ソース]

装置のソフトウェアバージョン情報を取得する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

home(motor: int | None = None) → bool[ソース]

記録済み原点位置へ移動する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

is_busy(motor: int | None = None) → bool | None[ソース]

指定モーターの BUSY 状態を取得する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

取得または変換に成功した値。失敗した場合は None。

is_connected() → bool[ソース]

TCP 接続状態を取得する。

戻り値:

接続中の場合は True、それ以外は False。

jog(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ JOG 動作する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

local() → bool[ソース]

装置をローカル操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

property motor: int

引数省略時に使用するモーター番号を取得する。

move(target: int, motor: int | None = None, backlash: str | bool | None = True, relative: bool = False) → bool[ソース]

指定モーターを絶対位置または相対量で移動する。

motor を省略した場合は motor プロパティを使用する。 relative=False の場合は target を絶対目標位置として扱い、 relative=True の場合は target を現在位置からの相対移動量として扱う。 wait_for_complete() がバックラッシュ補正を含む位置決め完了を判定できるよう、 コマンド送信成功時に最終的な絶対目標位置とバックラッシュ条件を保存する。

パラメータ:
  • target -- 絶対目標位置。relative=True の場合は相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

  • relative -- True の場合は相対移動、False の場合は絶対移動。

戻り値:

処理に成功した場合は True、失敗した場合は False。

move_relative(target: int, motor: int | None = None, backlash: str | bool | None = True) → bool[ソース]

指定モーターを現在位置から相対移動する。

move(..., relative=True) と同じ動作をする互換メソッド。

パラメータ:
  • target -- 相対移動量。

  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

number_to_rate(index: int) → float | None[ソース]

レート番号を RATE_TABLE のレート値へ変換する。

パラメータ:

index -- RATE_TABLE のインデックス。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

pause() → bool[ソース]

動作を一時停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

rate_to_number(rate: float) → int | None[ソース]

レート値を対応する RATE_TABLE の番号へ変換する。

パラメータ:

rate -- 変換するレート値。

戻り値:

取得または変換に成功した値。失敗した場合は None。

例外:
  • TypeError -- 引数の型が不正な場合。

  • ValueError -- 変換可能な範囲外の場合。

remote() → bool[ソース]

装置をリモート操作モードへ切り替える。

戻り値:

処理に成功した場合は True、失敗した場合は False。

resume() → bool[ソース]

一時停止を解除する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ連続スキャン動作を開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

scan_home(motor: int | None = None, direction: str | None = None) → bool[ソース]

指定方向へ原点探索スキャンを開始する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • direction -- 回転方向。cw または ccw。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_backlash(motor: int | None = None, backlash: int | None = None) → bool[ソース]

バックラッシュ補正量を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • backlash -- バックラッシュ補正指定。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hard_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

CW/CCW ハードウェアリミットを有効/無効にする。

set_hard_limit_normally_closed(motor: int | None = None, side: str | None = None, normally_closed: bool | None = None) → bool[ソース]

ハードウェアLSの接点仕様を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- hp、cw、ccw。

  • normally_closed -- normally closed にする場合は True、 normally open にする場合は False。

set_high_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

指定モーターの HOLD 状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • enabled -- 有効にする場合は True、無効にする場合は False。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_off_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD OFF 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_hold_on_time(motor: int | None = None, msec: int | None = None) → bool[ソース]

HOLD ON 時間を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • msec -- 時間。単位は ms。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_offset(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点オフセットを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

原点位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_home_status(motor: int | None = None, found: bool | None = None, found_direction: str | None = None, auto_start_direction: str | None = None) → bool[ソース]

原点検出設定状態を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • found -- 原点検出済み状態。

  • found_direction -- 原点検出方向。

  • auto_start_direction -- 自動原点検出開始方向。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_jog_pulse(motor: int | None = None, pulse: int | None = None) → bool[ソース]

JOG パルス数を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit(motor: int | None = None, side: str | None = None, pulse: int | None = None) → bool[ソース]

指定側のソフトウェアリミット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • side -- リミット側。cw または ccw。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_limit_enabled(motor: int | None = None, enabled: bool | None = None) → bool[ソース]

ソフトウェアリミットを有効/無効にする。

set_low_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

低速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_middle_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

中速設定値を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_motor_setting(motor: int | None = None, drive_enabled: bool | None = None, hold_mode: int | None = None, output_mode: int | None = None) → bool[ソース]

モーター設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • drive_enabled -- モータードライブを有効にする場合は True。

  • hold_mode -- ホールドモード。

  • output_mode -- 出力モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_preset_position(motor: int | None = None, pulse: int | None = None) → bool[ソース]

プリセット位置を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • pulse -- パルス値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_rate(motor: int | None = None, rate: float | None = None) → bool[ソース]

加減速レートを設定する。

指定値に最も近いレート番号を選択して設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • rate -- 加減速レート。

戻り値:

処理に成功した場合は True、失敗した場合は False。

例外:

TypeError -- rate の型が不正な場合。

set_rate_number(motor: int | None = None, number: int | None = None) → bool[ソース]

加減速レート番号を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • number -- レート番号。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed(motor: int | None = None, speed: int | None = None) → bool[ソース]

高速値を基準に低速・中速・高速を設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • speed -- 速度。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_mode(motor: int | None = None, mode: int | str | None = None) → bool[ソース]

速度モードを設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • mode -- 速度モード。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_speed_profile(motor: int | None = None, low_speed: int | None = None, middle_speed: int | None = None, high_speed: int | None = None) → bool[ソース]

低速・中速・高速を個別に設定する。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • low_speed -- 低速値。

  • middle_speed -- 中速値。

  • high_speed -- 高速値。

戻り値:

処理に成功した場合は True、失敗した場合は False。

set_stop_mode(motor: int | None = None, panel_fast: bool | None = None, limit_fast: bool | None = None) → bool[ソース]

停止モード設定を書き込む。

パラメータ:
  • motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

  • panel_fast -- パネル停止を高速停止にする場合は True。

  • limit_fast -- リミット停止を高速停止にする場合は True。

戻り値:

処理に成功した場合は True、失敗した場合は False。

status_all() → List[MotorStatus] | None[ソース]

全モーターの状態を取得する互換メソッド。

戻り値:

取得または変換に成功した値。失敗した場合は None。

stop(motor: int | None = None) → bool[ソース]

指定モーターを停止する。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

stop_all() → bool[ソース]

全モーターを停止する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

version()[ソース]
wait_for_complete(motor: int | None = None, timeout_sec: float = 30.0, interval_sec: float = 0.1, target_position: int | None = None, show_position: bool = True) → MotorStatus | None[ソース]

指定モーターの最終停止を待つ。

位置決め移動では move() が保存した最終目標位置を使用する。 backlash=False の場合は、目標位置で inactive になれば完了とする。

B/S バックラッシュ補正では、最初の 目標位置 + inactive が 補正途中か最終停止かを一回の観測だけでは区別できない。このため、 最初の到達は保留し、次の観測で active または目標位置外を観測した 場合は補正軌跡が継続中と判断する。その後、再び目標位置で inactive になれば完了とする。補正軌跡が短くポーリング間で観測できない場合は、 目標位置 + inactive を2回連続して確認した時点で完了とする。

装置内部のバックラッシュ補正点は、補正値の符号、移動方向、B/S の 条件で変化するため、Python 側では計算・予測しない。

位置決めコンテキストがない場合は、stop() 後などの単純な停止待ち として inactive を2回連続して確認する。

パラメータ:
  • motor -- モーター番号。None の場合は motor プロパティを使用する。

  • timeout_sec -- 待機処理のタイムアウト秒数。

  • interval_sec -- 状態確認のポーリング間隔秒数。

  • target_position -- 完了判定に使う絶対目標位置。明示指定した場合は move() が保存した値より優先する。

  • show_position -- True の場合は各ポーリングの現在位置を表示する。

戻り値:

完了条件を満たした最後の MotorStatus。状態取得失敗または タイムアウト時は None。

zero_position(motor: int | None = None) → bool[ソース]

指定モーターの現在位置カウンタを 0 にする。

パラメータ:

motor -- モーター番号。0 または 1。None の場合は motor プロパティを使用する。

戻り値:

処理に成功した場合は True、失敗した場合は False。

pm2cd.pm2cd_single.main() → None[ソース]

PM2CD 公開 I/F の基本的な使用例を実行する。

実機の IP アドレスに変更してから、パッケージのモジュールとして実行する。 この例では装置を動かすコマンドは送信せず、接続と状態取得だけを確認する。

戻り値:

None。

pm2cd.pm2cd_single.main1() → None[ソース]
pm2cd.pm2cd_single.main2() → None[ソース]