cobotta2 package
Subpackages
- cobotta2.bcapclient package
- Submodules
- cobotta2.bcapclient.bcapclient module
BCAPClientBCAPClient._BCAP_EOTBCAPClient._BCAP_SOHBCAPClient._DICT_TYPE2VTBCAPClient._DICT_VT2TYPEBCAPClient._SEC_ONEDAYBCAPClient._TIME_DIFFERENCEBCAPClient._bcap_recv()BCAPClient._bcap_send()BCAPClient._deserialize()BCAPClient._deserialize_arg()BCAPClient._deserialize_args()BCAPClient._recv_with_select()BCAPClient._send_and_recv()BCAPClient._serialize()BCAPClient._serialize_arg()BCAPClient._serialize_args()BCAPClient.command_cancel()BCAPClient.command_execute()BCAPClient.command_getattribute()BCAPClient.command_gethelp()BCAPClient.command_getid()BCAPClient.command_getname()BCAPClient.command_getparameters()BCAPClient.command_getresult()BCAPClient.command_getstate()BCAPClient.command_gettag()BCAPClient.command_gettimeout()BCAPClient.command_putid()BCAPClient.command_putparameters()BCAPClient.command_puttag()BCAPClient.command_puttimeout()BCAPClient.command_release()BCAPClient.controller_connect()BCAPClient.controller_disconnect()BCAPClient.controller_execute()BCAPClient.controller_getattribute()BCAPClient.controller_getcommand()BCAPClient.controller_getcommandnames()BCAPClient.controller_getextension()BCAPClient.controller_getextensionnames()BCAPClient.controller_getfile()BCAPClient.controller_getfilenames()BCAPClient.controller_gethelp()BCAPClient.controller_getid()BCAPClient.controller_getmessage()BCAPClient.controller_getname()BCAPClient.controller_getrobot()BCAPClient.controller_getrobotnames()BCAPClient.controller_gettag()BCAPClient.controller_gettask()BCAPClient.controller_gettasknames()BCAPClient.controller_getvariable()BCAPClient.controller_getvariablenames()BCAPClient.controller_putid()BCAPClient.controller_puttag()BCAPClient.datetime2vntdate()BCAPClient.extension_execute()BCAPClient.extension_getattribute()BCAPClient.extension_gethelp()BCAPClient.extension_getid()BCAPClient.extension_getname()BCAPClient.extension_gettag()BCAPClient.extension_getvariable()BCAPClient.extension_getvariablenames()BCAPClient.extension_putid()BCAPClient.extension_puttag()BCAPClient.extension_release()BCAPClient.file_copy()BCAPClient.file_delete()BCAPClient.file_execute()BCAPClient.file_getattribute()BCAPClient.file_getdatecreated()BCAPClient.file_getdatelastaccessed()BCAPClient.file_getdatelastmodified()BCAPClient.file_getfile()BCAPClient.file_getfilenames()BCAPClient.file_gethelp()BCAPClient.file_getid()BCAPClient.file_getname()BCAPClient.file_getpath()BCAPClient.file_getsize()BCAPClient.file_gettag()BCAPClient.file_gettype()BCAPClient.file_getvalue()BCAPClient.file_getvariable()BCAPClient.file_getvariablenames()BCAPClient.file_move()BCAPClient.file_putid()BCAPClient.file_puttag()BCAPClient.file_putvalue()BCAPClient.file_release()BCAPClient.file_run()BCAPClient.gettimeout()BCAPClient.message_clear()BCAPClient.message_getdatetime()BCAPClient.message_getdescription()BCAPClient.message_getdestination()BCAPClient.message_getnumber()BCAPClient.message_getserialnumber()BCAPClient.message_getsource()BCAPClient.message_getvalue()BCAPClient.message_release()BCAPClient.message_reply()BCAPClient.robot_accelerate()BCAPClient.robot_change()BCAPClient.robot_chuck()BCAPClient.robot_drive()BCAPClient.robot_execute()BCAPClient.robot_getattribute()BCAPClient.robot_gethelp()BCAPClient.robot_getid()BCAPClient.robot_getname()BCAPClient.robot_gettag()BCAPClient.robot_getvariable()BCAPClient.robot_getvariablenames()BCAPClient.robot_gohome()BCAPClient.robot_halt()BCAPClient.robot_hold()BCAPClient.robot_move()BCAPClient.robot_putid()BCAPClient.robot_puttag()BCAPClient.robot_release()BCAPClient.robot_rotate()BCAPClient.robot_speed()BCAPClient.robot_unchuck()BCAPClient.robot_unhold()BCAPClient.service_start()BCAPClient.service_stop()BCAPClient.settimeout()BCAPClient.task_delete()BCAPClient.task_execute()BCAPClient.task_getattribute()BCAPClient.task_getfilename()BCAPClient.task_gethelp()BCAPClient.task_getid()BCAPClient.task_getname()BCAPClient.task_gettag()BCAPClient.task_getvariable()BCAPClient.task_getvariablenames()BCAPClient.task_putid()BCAPClient.task_puttag()BCAPClient.task_release()BCAPClient.task_start()BCAPClient.task_stop()BCAPClient.variable_getattribute()BCAPClient.variable_getdatetime()BCAPClient.variable_gethelp()BCAPClient.variable_getid()BCAPClient.variable_getmicrosecond()BCAPClient.variable_getname()BCAPClient.variable_gettag()BCAPClient.variable_getvalue()BCAPClient.variable_putid()BCAPClient.variable_puttag()BCAPClient.variable_putvalue()BCAPClient.variable_release()BCAPClient.vntdate2datetime()
- cobotta2.bcapclient.orinexception module
HResultHResult.E_ABORTHResult.E_ACCESSDENIEDHResult.E_CANCELHResult.E_CAOP_NOT_WRITABLEHResult.E_CAOP_SYSTEMNAME_INVALIDHResult.E_CAOP_SYSTEMTYPE_INVALIDHResult.E_CAO_CMD_EXECUTEHResult.E_CAO_COLLECTION_REGISTEREDHResult.E_CAO_COMPUTER_NAMEHResult.E_CAO_NOT_WRITABLEHResult.E_CAO_OBJECT_NOTFOUNDHResult.E_CAO_PRELOADHResult.E_CAO_PROV_INVALIDHResult.E_CAO_PROV_NO_LICENSEHResult.E_CAO_REMOTE_ENGINEHResult.E_CAO_REMOTE_PROVIDERHResult.E_CAO_SEM_CREATEHResult.E_CAO_THREAD_CREATEHResult.E_CAO_VARIANT_TYPE_NOSUPPORTHResult.E_CRDIMPLHResult.E_FAILHResult.E_HANDLEHResult.E_INVALIDARGHResult.E_INVALIDPACKETHResult.E_INVALID_CMD_NAMEHResult.E_MAX_OBJECTHResult.E_NOTIMPLHResult.E_NOT_CONNECTEDHResult.E_NOT_USEHResult.E_NO_LICENSEHResult.E_OUTOFMEMORYHResult.E_POINTERHResult.E_TIMEOUTHResult.E_UNEXPECTEDHResult.E_WINDOWS_MASKHResult.E_WINSOCK_MASKHResult.S_EXECUTINGHResult.S_FALSEHResult.S_OKHResult.failed()HResult.succeeded()
ORiNException
- cobotta2.bcapclient.variant module
VarTypeVarType.VT_ARRAYVarType.VT_BLOBVarType.VT_BLOB_OBJECTVarType.VT_BOOLVarType.VT_BSTRVarType.VT_BSTR_BLOBVarType.VT_BYREFVarType.VT_CARRAYVarType.VT_CFVarType.VT_CLSIDVarType.VT_CYVarType.VT_DATEVarType.VT_DECIMALVarType.VT_DISPATCHVarType.VT_EMPTYVarType.VT_ERRORVarType.VT_FILETIMEVarType.VT_HRESULTVarType.VT_I1VarType.VT_I2VarType.VT_I4VarType.VT_I8VarType.VT_ILLEGALVarType.VT_ILLEGALMASKEDVarType.VT_INTVarType.VT_INT_PTRVarType.VT_LPSTRVarType.VT_LPWSTRVarType.VT_NULLVarType.VT_PTRVarType.VT_R4VarType.VT_R8VarType.VT_RECORDVarType.VT_RESERVEDVarType.VT_SAFEARRAYVarType.VT_STORAGEVarType.VT_STORED_OBJECTVarType.VT_STREAMVarType.VT_STREAMED_OBJECTVarType.VT_TYPEMASKVarType.VT_UI1VarType.VT_UI2VarType.VT_UI4VarType.VT_UI8VarType.VT_UINTVarType.VT_UINT_PTRVarType.VT_UNKNOWNVarType.VT_USERDEFINEDVarType.VT_VARIANTVarType.VT_VECTORVarType.VT_VERSIONED_STREAMVarType.VT_VOID
- cobotta2.pad package
- Submodules
- cobotta2.pad.input_grpc_client module
- cobotta2.pad.input_grpc_server module
- cobotta2.pad.input_joypad_local module
- cobotta2.pad.joypad_core module
JoyPadCoreJoyPadCore.autocal()JoyPadCore.close()JoyPadCore.delete()JoyPadCore.drive()JoyPadCore.get_current_angle()JoyPadCore.get_current_error_info()JoyPadCore.get_current_position()JoyPadCore.get_error_count()JoyPadCore.get_error_description()JoyPadCore.get_error_info()JoyPadCore.get_value()JoyPadCore.give_arm()JoyPadCore.halt()JoyPadCore.hand()JoyPadCore.hand_move_A()JoyPadCore.hand_move_H()JoyPadCore.motor_off()JoyPadCore.motor_on()JoyPadCore.move()JoyPadCore.move_P()JoyPadCore.move_p_index()JoyPadCore.move_pose()JoyPadCore.open()JoyPadCore.put_value()JoyPadCore.reset_error()JoyPadCore.take_arm()
- cobotta2.pad.joypad_mover module
- cobotta2.pad.joypad_runtime module
- cobotta2.server_fastapi package
- Subpackages
- cobotta2.server_fastapi.clients package
- cobotta2.server_fastapi.models package
- Submodules
- cobotta2.server_fastapi.models.cmd module
- cobotta2.server_fastapi.models.common module
- cobotta2.server_fastapi.models.content module
- cobotta2.server_fastapi.models.error module
- cobotta2.server_fastapi.models.hand module
- cobotta2.server_fastapi.models.motion module
- cobotta2.server_fastapi.models.move module
- cobotta2.server_fastapi.models.param module
- cobotta2.server_fastapi.models.var module
- cobotta2.server_fastapi.models.work module
- cobotta2.server_fastapi.routers package
- Submodules
- cobotta2.server_fastapi.make module
- cobotta2.server_fastapi.spec_ctrl module
- cobotta2.server_fastapi.spec_state module
- Subpackages
- cobotta2.server_grpc package
- Submodules
- cobotta2.server_grpc.bcap_grpc_async_client module
- cobotta2.server_grpc.joypad_grpc_client module
- cobotta2.server_grpc.joypad_grpc_server module
- cobotta2.server_grpc.make_bcap_pyi module
- cobotta2.server_grpc.make_joypad_pyi module
- cobotta2.server_grpc.make_orin2_pyi module
- cobotta2.server_grpc.orin2_grpc_client module
- cobotta2.server_grpc.orin2_grpc_server module
- cobotta2.util package
Submodules
cobotta2.cobotta_bcap module
ゲームパッドからの操作を前提としてるために 「即応性」が求められるために、ORiNを使わない b-cap で使う(広い意味ではORiNのプロトコルの一つなので枠組みはORiNといえる) b-cap を使うための支援クラス(ベースはデンソー?と上椙さんのコード)
上椙コードを無理に直して、しかもなるべくメソッド名とか機能はの押しているので 割とカオス
ORiN: Python → COM → ORiN → Provider → RC8(遅い)
b-CAP: Python → TCP → RC8(速い)
based on UESUGI, デンソーウェーブ
Kengo NAKADA, kengo.nakada@mat.shimane-u.ac.jp
- class CobottaBcap(host=None, port=None, logger=None, log_level=None, config=None)[source]
Bases:
object- Parameters:
host (str | None)
port (int | None)
logger (Any | None)
log_level (str | None)
config (Config | None)
- Machine = 'localhost'
- Name = 'rc'
- Option = '@IfNotMember'
- Provider = 'CaoProv.DENSO.VRC'
- static _make_file_content(evp_script_name)[source]
この evp_script_name は、画像モデル(モデルを作った時に最後にコボッタに転送した名前) である
- Parameters:
evp_script_name (str)
- Return type:
str
Returns:
- _make_move_offset_target(target, offset, coord_type=None, path_blend=None, pose=None)[source]
move(…, offset=…) 用 target を作る。
旧 _build_move_target の offset 部分のみを分離したもの。
offset 計算は RC8 Dev 命令を使用する。
Dev は常に P座標 6軸のみを扱う。 fig は Dev の外側で処理する。
- _make_move_target(target, coord_type=None, path_blend=None, pose=None)[source]
通常 move 用 target を作る。
旧 _build_move_target の責務のうち offset 処理を除いた部分のみを担当する。
・str target はそのまま使う ・list target は vntPose に変換する ・pose(fig) の追加・上書きをここで行う
offset は扱わない
- _make_pacscript_offset_target(target, path_blend=None)[source]
target が str のとき PacScript風 + オフセット構文を処理する。
PacScript風のオフセット書式が move 命令に一緒に来た時に、target を作る
例:
“P10+(10,0,0,0,0,0)” “@P P10+(10,0,0,0,0,0)”
文字列構文では内部 P 番号に保持された fig 情報を使う経路を維持するため、
pose(fig) 解釈を追加しない。
- Parameters:
target (str)
path_blend (str | None)
- _move_core(comp, target, coord_type, path_blend, offset, pose, bstrOpt, speed, accel, decel, is_async)[source]
move 実行の分岐のみ担当。
target の解釈は make_* 系へ委譲する。
bstrOpt / speed / accel / decel / is_async はここで b-CAP の robot_move に渡す option 文字列へ確定する。
- Parameters:
comp (int)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
bstrOpt (str | int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
- Return type:
bool
- static _normalize_offset(offset)[source]
(0,0,10) のときに (0,0,10,0,0,0) として、rx,ry,yzを暗黙にしないで加える
(0,0,0,10) のときに (0,0,0,10,0,0) となる
- Parameters:
offset (list | tuple)
- Return type:
list
- _resolve_bstrOpt(bstrOpt, speed=None, is_async=True, accel=None, decel=None)[source]
- Parameters:
bstrOpt (str | int | None)
speed (int | None)
is_async (bool | None)
accel (float | None)
decel (float | None)
- Return type:
str | bool | None
- _resolve_hand_bstrOpt(bstrOpt=None, is_async=False)[source]
- Parameters:
bstrOpt (str | int | None)
is_async (bool | None)
- Return type:
str | bool | None
- _resolve_move_comp(motion_mode=None)[source]
- Parameters:
motion_mode (int | str | MotionMode | None)
- Return type:
int
- _to_p_string(offset)[source]
6軸表示 str ならそのまま、list ならば offset 値の書式(P書式)にする
- Parameters:
offset (str | list | tuple)
- Return type:
str | bool
- property accel: float | None
- property asp_mode
- property busy_status
- property coord_type: str
- property current_angle: list | tuple | bool
- property current_position: list | tuple | bool
- property decel: float | None
- dev(base, offset)[source]
基準位置にたいするオフセットで、座標を作る。
RC8 Dev 命令のラッパ。
Dev は常に P座標 6軸のみを扱う。 pose(fig) は扱わない。
- Parameters:
base (str | list | tuple)
offset (str | list | tuple)
- Return type:
list | tuple | bool
- property direct_mode
- download_all_files_from_cobotta(output_dir=None, skip_filenames=None)[source]
- Parameters:
skip_filenames (List[str] | Set[str] | Tuple[str, ...] | str | None)
- Return type:
bool
- download_file_from_cobotta(cobotta_filename, output_dir=None)[source]
- Parameters:
cobotta_filename (str)
- Return type:
bool
- drive(target, *, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
relative (bool)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- drive_A(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- drive_AEX(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- drive_EX(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property error_code
- property error_description
- property extaccel: float | None
- property extdecel: float | None
- property extspeed: int | None
- get_cobotta_all_files_content(skip_filenames=None)[source]
- Parameters:
skip_filenames (List[str] | Set[str] | Tuple[str, ...] | str | None)
- Return type:
List[Dict[str, str]] | None
- get_cobotta_file_content(cobotta_filename)[source]
- Parameters:
cobotta_filename (str)
- Return type:
Dict[str, str] | None
- get_current_error_info()[source]
最新のエラー 1 件の情報を取得する。
[ エラーコード (VT_I4), エラーメッセージ (VT_BSTR), サブコード (VT_I4), ファイルID+行番号 (VT_I4), プログラム名 (VT_BSTR), 行番号 (VT_I4), ファイルID (VT_I4) ]
GetCurErrorInfo の「インデックス省略版」に対応し、 現在のエラー情報だけを返す。
- get_error()[source]
現在 RC8 に蓄積しているエラー情報をすべて取得して返す。
戻り値は、各要素が [code, message, subcode, file_line, progname, line, file_id] という形のリストのリスト。
- Return type:
List[List[Any]]
- get_error_count()[source]
エラーカウントと言いつつこのカウント情報は
[ エラーコード (VT_I4), エラーメッセージ (VT_BSTR), サブコード (VT_I4), ファイルID+行番号 (VT_I4), プログラム名 (VT_BSTR), 行番号 (VT_I4), ファイルID (VT_I4) ] カウント番号を与えれば、上記情報を返す。つまりトータルカウント数2ならば 0,1 という数字だけで指定すれば二つのエラー情報としてこのリストを取り出せる つまり、エラーカウントとはエラー履歴情報も兼ねる ただし、このカウント情報をよびだすためには、後述の ErrorInfo が必要となる
- get_error_description(error_code)[source]
「error_code 番号」から RC8 のエラー説明文字列を取得する。
- Parameters:
error_code (int)
- Return type:
str | bool
- get_value(value_type, index)[source]
グローバル変数の値を返します。
- value_typestr
変数の型を文字列で指定 (S,I,T,…)
- indexint
取得する変数のインデックス番号を指定
- get_var(kind_or_combined, id_num=None)[source]
- Parameters:
kind_or_combined (str)
id_num (int | None)
- Return type:
Any
- halt()[source]
RC8 に対して即時停止 (HALT) をかける 先行入力された NEXT モーションをすべて無効化する
JoyPad などでは、高頻度で使われるので余計な制御入れない
- Return type:
bool
- hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
force (int | None)
direction (bool | int)
relative (bool)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_A(pos=None, *, position=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_H(*, force, direction=True, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
force (int)
direction (bool | int)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_R(pos=None, *, position=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- ifnotm = '@IfNotMember'
- property jspeed: int | None
- property lock
- property manual_move_mode
- property motion_mode
- motor_off()[source]
b-CAP 経由で RC8 のモータを OFF にする。
Robot_Execute(“Motor”, [0, 0]) を呼び出す。
- Return type:
bool
- motor_on()[source]
b-CAP 経由で RC8 のモータを ON にする。
Robot_Execute(“Motor”, [1, 0]) を呼び出す。
- Return type:
bool
- move(target, *, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
ロボット移動。
target の解釈は make_* 系へ委譲する。
ctrl から共通 I/F で呼ばれる前提。 orin2 / bcap で同一仕様。
- Parameters:
motion_mode (int | str | MotionMode | None)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool)
bstrOpt (str | int | None)
- Return type:
bool
- move_C(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
- Parameters:
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool)
bstrOpt (str | int | None)
- Return type:
bool
- move_L(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
- Parameters:
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool)
bstrOpt (str | int | None)
- Return type:
bool
- move_P(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
- Parameters:
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool)
bstrOpt (str | int | None)
- Return type:
bool
- move_S(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
- Parameters:
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool)
bstrOpt (str | int | None)
- Return type:
bool
- move_func(mode, dist_len, flg)[source]
for gamepad XYZ / Tool / 各軸モードの相対移動1
- Parameters:
mode
dist_len
flg
Returns:
- property path_blend: str
- property rc8_type
- property rc8_type_name
- reset_error()[source]
RC8 のエラーを安全にリセットするための統合処理 b-CAP には ResetError の専用APIは無いため、 ManualResetPreparation → ClearError を組み合わせて実装する。
現在のエラー状態を取得
エラー解除の前提状態に遷移させるための内部プロシージャA
エラーリセット
モーション準備
- Return type:
bool
- robo_dmove_J(dpose)[source]
関節空間(J モード)での差分移動。
dev は使用しない。 現在関節角を取得し、差分を加算して目標角を作成し、 robot_move([target_J, “J”], “NEXT”) を直接発行する。
- Parameters:
dpose (Sequence[float])
- Return type:
bool
- robo_dmove_P(dPose)[source]
for GamePad XYZ/RxRyRz の相対移動(増分指定) Pモード専用
現在と新しい位置の差分(ret_dev)を作ってそれを新しいポーズとして動かす
現在位置(CurPos)と与えられた dPose との差分から Dev を計算し、その結果を次のモーション(NEXT)として投入する。
- Parameters:
dPose (Sequence[float]) – 相対移動量。[dx, dy, dz, drx, dry, drz]
- Return type:
bool
Notes
NEXT 指定のため、RC8 側のモーションキュー状態に依存する。
- robo_move_J(dPose)[source]
J への絶対位置座標 move
関節空間(J モード)で指定された関節角度配列に基づき、 ロボットを次のモーションとして移動させる。
本メソッドは b-CAP 経由で RC8 に対して Joint(J)指定の Move 命令を発行する低レベル操作 RC8 側のキュー(NEXT モーション)にそのまま関節指令を積む。
- Parameters:
dPose (Sequence[float]) – 関節角度の配列。 RC8 が要求する関節数・順序(例: J1〜J6)に対応している必要がある。
- Raises:
ORiNException – b-CAP / RC8 側でエラーが発生した場合に送出される。 内部でエラーコードを取得し、RC8 のエラー説明をログ出力する。
- Return type:
bool
Notes
NEXT 指定のため、既存のモーションキュー状態に依存する。
- robo_move_P(Pose)[source]
P への絶対位置座標 move
RC8 コントローラに対して b-CAP 経由で移動命令(Move)を発行する
- Parameters:
Pose (Sequence[Any]) –
移動先を表す配列。 以下の形式を取ることを想定する。
- Cartesian 指定の場合:
[ [x, y, z, rx, ry, rz], “P” ]
- Return type:
bool
Notes
NEXT 指定のため、既存のモーションキュー状態に依存する。
- Raises:
ORiNException – b-CAP / RC8 側で Move 命令が拒否された場合に送出される。 エラーコードおよび RC8 側のエラー内容は呼び出し元でログ取得可能。
- Return type:
bool
- rotate(plane, angle, center, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
plane (str)
angle (float)
center (list)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- rotate_H(angle, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property servo_on
- set_P(id_num, value)[source]
- Parameters:
id_num (int)
value (List[float] | Tuple[float, ...])
- Return type:
bool
- set_motion_mode(mode)[source]
- Parameters:
mode (int | str | MotionMode)
- Return type:
bool
- set_tool_define(tool_no, tool_define)[source]
- Parameters:
tool_no (int)
tool_define (tuple | list | str)
- Return type:
bool
- set_var(kind_or_combined, id_or_value, value=None)[source]
- Parameters:
kind_or_combined (str)
id_or_value (Any)
value (Any)
- Return type:
bool
- set_work(work_no, work_define, work_attribute=0)[source]
- Parameters:
work_no (int)
work_define (tuple | list | str)
work_attribute (int)
- Return type:
bool
- property speed: int | None
- take_camera(evp_script_name, pac_script_name=None)[source]
- Parameters:
evp_script_name (str)
pac_script_name (str | None)
- Return type:
bool
- property task
- property task_state
- timeout = 2000
- upload_content_to_cobotta(file_content, cobotta_filename)[source]
- Parameters:
file_content (str)
cobotta_filename (str)
- Return type:
bool
cobotta2.cobotta_bcap_dummy module
DummyBcap
CobottaBcap と同じ I/F を「落ちない」ために揃える最小ダミー
実機には触らない
引数の存在・戻り値型の整合だけを担保する
- class CobottaBcapDummy(host=None, port=None, logger=None, log_level=None)[source]
Bases:
object- Parameters:
host (Optional[str])
port (Optional[int])
logger (Optional[XLogger])
log_level (Optional[str])
- Machine: str = 'localhost'
- Name: str = 'rc'
- Option: str = '@IfNotMember'
- Provider: str = 'CaoProv.DENSO.VRC'
- static _change_str_pose(value_type, data)[source]
- Parameters:
value_type (Any)
data (Any)
- Return type:
str
- connect(host=None, port=None)[source]
- Parameters:
host (str | None)
port (int | None)
- Return type:
bool
- ifnotm: str = '@IfNotMember'
- move_func(mode, dist_len, flg)[source]
- Parameters:
mode (Any)
dist_len (Any)
flg (Any)
- Return type:
None
- put_value(value_type, index, newval)[source]
- Parameters:
value_type (str)
index (int)
newval (Any)
- Return type:
None
- timeout: int = 2000
cobotta2.cobotta_ctrl module
Kengo NAKADA: https://github.com/shimane-dev, https://github.com/kengo-nakada kengo.nakada@mat.shimane-u.ac.jp, kengo.nakada@gmail.com
- class CobottaCtrl(cobotta_ip='192.168.0.1', arm_name='Arm', instance_name='Ctrl', logger=None, log_level=None, backend='bcap', bcap_port=5007, config=None)[source]
Bases:
objectORiN2 の COM を用いて、python から制御する そのための簡単なラッパークラス
- Parameters:
cobotta_ip (str)
arm_name (str)
instance_name (str)
logger (Any | None)
log_level (str | None)
backend (str)
bcap_port (int)
config (Config | Any | None)
- _VAR_NAME_RE = re.compile('(P|F|I|IO)(\\d+)$')
- static _make_file_content(evp_script_name)[source]
- Parameters:
evp_script_name (str)
- Return type:
str
- property accel: float | None
- property busy_status
- property coord_type
- property current_angle: list | tuple | bool
- property current_position: list | tuple | bool
- property decel: float | None
- dev(base, offset)[source]
- Parameters:
base (str | list | tuple)
offset (str | list | tuple)
- Return type:
list | tuple | bool
- property direct_mode
どうしてもORiN2っぽいモードに縛られる
- download_all_files_from_cobotta(output_dir=None, skip_filenames=None)[source]
- Parameters:
output_dir (str | Path | None)
skip_filenames (List[str] | Set[str] | Tuple[str, ...] | str | None)
- Return type:
bool
- download_file_from_cobotta(cobotta_filename, output_dir=None)[source]
- Parameters:
cobotta_filename (str)
output_dir (str | Path | None)
- Return type:
bool
- drive(target, *, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
target (str | list | tuple | None)
relative (bool)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property error_code
- property error_description
last の error description
- property extaccel: float | None
- property extdecel: float | None
- property extspeed: int | None
- get_cobotta_all_files_content(skip_filenames=None)[source]
- Parameters:
skip_filenames (List[str] | Set[str] | Tuple[str, ...] | str | None)
- get_var(kind_or_combined, id_num=None)[source]
- Parameters:
kind_or_combined (str)
id_num (int | None)
- Return type:
Any
- hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
force (int | None)
direction (bool | int)
relative (bool)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- is_empty_position(id_num, coord_type=None, tol=None)[source]
- Parameters:
id_num (int | str)
coord_type (str | None)
tol (float | None)
- Return type:
bool
- jog(axis, direction, speed, step=None)[source]
指定軸をジョグする。
- Parameters:
axis (str) –
"J1"~"J6"。direction (int) – 正方向は
1、負方向は-1。speed (float) – ジョグ速度。負値は絶対値で扱う。
step (float | None) – ジョグ移動量。
Noneは連続ジョグ。
- Returns:
ジョグを開始できた場合
True。- Return type:
bool
- property jspeed: int | None
- property lock
- property motion_mode
- move(target, *, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
- Parameters:
target (str | list | tuple)
motion_mode (int | str | MotionMode | None)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property path_blend
- rotate(plane, angle, center, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
plane (str)
angle (float)
center (list)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property servo_on
- set_P(id_num, value)[source]
- Parameters:
id_num (int)
value (List[float] | Tuple[float, ...])
- Return type:
bool
- set_motion_mode(mode)[source]
- Parameters:
mode (int | str | MotionMode)
- Return type:
bool
- set_tool(tool_no, tool_define)[source]
- Parameters:
tool_no (int)
tool_define (tuple | list | str)
- Return type:
bool
- set_tool_define(tool_no, tool_define)[source]
- Parameters:
tool_no (int)
tool_define (tuple | list | str)
- Return type:
bool
- set_var(kind_or_combined, id_or_value, value=None)[source]
- Parameters:
kind_or_combined (str)
id_or_value (Any)
value (Any)
- Return type:
bool
- set_work(work_no, work_define, work_attribute=0)[source]
- Parameters:
work_no (int)
work_define (tuple | list | str)
work_attribute (int)
- Return type:
bool
- property speed: int | None
- take_camera(evp_script_name, pac_script_name=None)[source]
- Parameters:
evp_script_name (str)
pac_script_name (str | None)
- Return type:
bool
- property task
- property task_state
- teach(kind_or_combined='P', id_num=None, *, save=True)[source]
現在のロボット状態を指定変数へ教示する。
set_P() は与えられた値を変数へ代入する通常の setter である。 teach() は実機の現在状態を読み取り、指定した P10 や J1 に 記録する教示操作である。
現時点では P/J のローカル保存を行う。COBOTTA/RC8 の内部 P 変数へ 同時に書くかどうかは後段の設計課題とし、ここでは RobotVarManager への JSON 保存を共通動作とする。
- Parameters:
kind_or_combined (str) – “P”, “J”, “P10”, “J1” 形式の変数指定。
id_num (int | None) – 変数番号。結合済み名の場合は省略可。
save (bool) – True の場合、教示後に JSON へ即保存する。
- Returns:
成功時 True、失敗時 False。
- Return type:
bool
- upload_content_to_cobotta(file_content, cobotta_filename)[source]
- Parameters:
file_content (str)
cobotta_filename (str)
- Return type:
bool
cobotta2.cobotta_ctrl_joypad module
cobotta2.cobotta_orin2 module
スピードの設定が100になってないと 動いていないように見えるので注意
Kengo NAKADA: https://github.com/shimane-dev, https://github.com/kengo-nakada kengo.nakada@mat.shimane-u.ac.jp, kengo.nakada@gmail.com
- class CobottaOrin2(cobotta_ip='192.168.0.1', arm_name='Arm', instance_name='Ctrl', *, logger=None, log_level=None, init_com=True, config=None)[source]
Bases:
objectORiN2 の COM を用いて、python から制御する そのための簡単なラッパークラス
- Parameters:
cobotta_ip (str)
arm_name (str)
instance_name (str)
logger (Any | None)
log_level (str | None)
init_com (bool | None)
config (Config | Any | None)
- Provider = 'CaoProv.DENSO.RC8'
- _drive_core(target, *, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
Drive は存在せずに DriveEX, DriveAEX を使う (Ex 拡張) 6軸指定は、J で指定
target: list of (target, pos) or string “(1,100),(3,200)”
v1 = [(1,10), -1, “@P”] v2 = [(2,10), -1] vntPose = [v1, v2] Execute(“DriveAEX”, [vntPose, “Speed=10, Next]) Execute(“DriveAEX”, [“@0 (1,10), (2,10), “Speed=10, Next])
- PacScript:
- DriveA(1,60)
DriveA(2,20),(3,135),(4,-10),(5, 25)
- Parameters:
target (str | list | tuple)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
list | str | bool
- _get_var_data(message, default=None)[source]
@current_positon などの @型内部変数を取得する
- Parameters:
message
default
- Return type:
Any
Returns:
- _initialize_com()[source]
主にgRPCの自動スレッド化対策 gRPCが制御のインスタンスとインスから呼び出されるメソッドを別スレッドで動かすセンスのために windows の COM モデルだと __init__ で COM 初期化すると崩壊する。 COMは同一スレッドである必要がある そのためにCOM init は外部化するつ必要がある。
ローカルで使うときは、この _initialize_com を動かす。 それ以外は COM ロードを外部のものを使う
Returns:
- Return type:
None
- static _make_file_content(evp_script_name)[source]
- Parameters:
evp_script_name (str)
- Return type:
str
- _make_move_offset_target(target, offset, coord_type=None, path_blend=None, pose=None)[source]
move(…, offset=…) 用 target を作る。
dev は常に P座標 6軸のみを扱う。
pose(fig) は dev の外側で扱う。
規則:
- move(“P10”, offset=…)
-> dev(“P10”, offset)
- move([6軸], offset=…)
-> 6軸 dev
- move([6軸], pose=3, offset=…)
-> dev 後に 7要素目=3 を追加
- move([7軸], offset=…)
-> 7要素目 fig を保持
- move([7軸], pose=5, offset=…)
-> 7要素目を 5 に置換
- Parameters:
target (str | list | tuple)
offset (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
pose (int | None)
- Return type:
list | bool
- _make_move_target(target, coord_type=None, path_blend=None, pose=None)[source]
target: str, list, tuple
move 用の target を ORiN2 Move API に渡す形式へ正規化する
ここでは offset 演算は扱わない。 offset 付き move は _move_core() 側で dev を通してから、 その結果を move target に組み立てる。
pose(fig) を解釈するのは list / tuple target のみである。 str target は既存の文字列構文として扱い、
- Parameters:
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None) – オプションのパスブレンド値。明示指定があればこれを最優先で使う。
pose (int | None)
- Return type:
str | list | bool
Returns:
- _make_pacscript_offset_target(target, path_blend=None)[source]
target が str のとき PacScript風 + オフセット構文を処理する。
PacScript風のオフセット書式が move 命令に一緒に来た時に、VntPose を作る
例:
“P10+(10,0,0,0,0,0)” “@P P10+(10,0,0,0,0,0)”
文字列構文では内部 P 番号に保持された fig 情報を使う経路を維持するため、
pose(fig) 解釈を追加しない。
- Parameters:
target (str)
path_blend (str | None)
- Return type:
list | bool
- _move(lComp, vntPose, bstrOpt=None)[source]
LOW level API. ポーズ: P型, J型(6軸指定), T型。 @から始まるのはパス開始変位: “@0”, “@P”, “@E”, “@<数値>”, “@A<数値>” のいずれか。
@P Pose(登録済みポーズ名) @E External pose(外部ポーズ) @L ローカルポーズ @T Tool座標系 @W Work座標系
これが “@P P2” とあると、P2 がポーズなのか何なのかわからないので必要。
“<変数型><番号>” または “[<変数型>](<要素1>,<要素2>,…)” の形式。
- lComp1,2: PTP/Line
[<@パス開始変位>]<ポーズ> [<付加軸オプション>] 例: “P1”, “@P T100”, “@E J520”
- lComp3: Circle 円弧補完
<ポーズ1>, [<@パス開始変位>] <ポーズ2> [<付加軸オプション>] ※ ポーズ1,2は必ず同じ変数型でなくてはなりません。 例: “P1, @E P2”, “T100, @P T101”
- lComp4: Spline
[<@パス開始変位>]<自由曲線軌道番号> [<付加軸オプション>] 例: “1”, “@P 20”, “@E 5”
- Parameters:
lComp (int) – 保管方法。
vntPose – ポーズ列。
bstrOpt (str | int) – 動作オプション。
- Returns:
戻り値はありません。
- Return type:
None
- _move_core(lComp, target, coord_type, path_blend, offset, pose, bstrOpt)[source]
move 実行の分岐のみ担当。
target の解釈は make_* 系へ委譲する。
- Parameters:
lComp (int)
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
offset (str | tuple | list | None)
pose (int | None)
bstrOpt (str | int | None)
- Return type:
bool
- static _normalize_offset(offset)[source]
(0,0,10) のときに (0,0,10,0,0,0) として、rx,ry,yzを暗黙にしないで加える
(0,0,0,10) のときに (0,0,0,10,0,0) となる
- Parameters:
offset (list | tuple)
- Return type:
list
- _release_loaded_file(cobotta_filename)[source]
- Parameters:
cobotta_filename (str)
- Return type:
None
- _resolve_bstrOpt(bstrOpt, speed=None, is_async=True, accel=None, decel=None)[source]
- Parameters:
bstrOpt (str | int | None)
speed (int | None)
is_async (bool | None)
accel (float | None)
decel (float | None)
- Return type:
str | bool | None
- _resolve_hand_bstrOpt(bstrOpt=None, is_async=False)[source]
- Parameters:
bstrOpt (str | int | None)
is_async (bool | None)
- Return type:
str | bool | None
- _resolve_motion_mode(mode)[source]
- Parameters:
mode (int | str | MotionMode | None)
- Return type:
- static _strip_path_prefix(base)[source]
@ステートメントを消す: @P P1 → P1, @0 P14 → P14 などに変換
- Parameters:
base (str)
- Return type:
str
- _to_p_string(offset)[source]
6軸表示 str ならそのまま、list ならば offset 値の書式(P書式)にする
- Parameters:
offset (str | list | tuple)
- Return type:
str | bool
- property accel
- property asp_mode
- property busy_status
アーム動作中のならば True
- property coord_type
- property current_angle: list | tuple | bool
J型で取得, @Current_Position と同等
- property current_position: list | tuple | bool
P型で取得, @Current_Position と同等
- property decel
- dev(base, offset)[source]
基準位置にたいするオフセットで、座標を作る P型が対象 そして、P型の座標だが、+1要素を返すので、move系とかに食わせるときは注意
# NG # ret = self._caoRob.Execute(“Dev”, [“@P P1222”, “P(-50,0,20)”]) # ret = self._caoRob.Execute(“Dev”, (“P1”, (1, 1, 1)))
# OK (省略時はお尻が全部ゼロ) # ret = self._caoRob.Execute(“Dev”, (“P1”, “P(0, 0, 0)”)) # ret = self._caoRob.Execute(“Dev”, (“P10”, “P(100, 200, 300, 180, 0, 180)”)) # ret = self._caoRob.Execute(“Dev”, (“P10”, “P(100, 200, 300, 180, 0, 180)”)) # ret = self._caoRob.Execute( # “Dev”, (“P(100, 200, 300, 180, 0, 180)”, “P(100, 200, 300, 180, 0, 180)”) # )
cobotta.dev(“P1”, [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, -2.0]) cobotta.dev(“P1”, “P(0,0,0)”)
- Parameters:
base (str | list | tulpe)
offset (str | list | tuple)
- Return type:
list | tuple | bool
Returns:
- property direct_mode
- download_all_files_from_cobotta(output_dir=None, skip_filenames=None)[source]
COBOTTA内全ファイルをローカル保存
- Parameters:
output_dir (str | Path | None) – 保存先ディレクトリ
skip_filenames (set or list) – 除外したいファイル名
- Returns:
全ファイル保存成功でTrue、失敗が1つでもあればFalse
- Return type:
bool
- download_file_from_cobotta(cobotta_filename, output_dir=None)[source]
COBOTTA内部の指定ファイルをローカルに保存
- Parameters:
cobotta_filename (str) – COBOTTA内部ファイル名( without .pcs)
output_dir (str | Path | None) – 保存先ディレクトリ
- Returns:
成功すればTrue、失敗すればFalse
- Return type:
bool
- drive(target, *, relative=False, path_blend=None, speed=None, is_async=False, bstrOpt=None)[source]
単一APIで DriveEX(相対) / DriveAEX(絶対)を切り替えて実行する統合メソッド。
- Parameters:
target (str | list | tuple | None) –
文字列(PacScript書式)または (軸, 値) のペア、もしくはそのリスト / タプル。 例:
”(1,10),(2,20)” [(1,10), (2,20)] (1, 10)
relative (bool) – True のとき相対移動(DriveEX)、False のとき絶対移動(DriveAEX)。
path_blend (str | None) – 先頭に付与する経路ブレンド指定(例: “@0”, “Next” など)。 None の場合は self.path_blend を踏襲。
speed (int | None) – 速度指定(_resolve_bstrOpt に委譲して bstrOpt を構成)。
is_async (bool | None) – 非同期指定(_resolve_bstrOpt に委譲)。
bstrOpt (str | int | None) – 追加オプション指定。speed / is_async とマージされる。
- Returns:
実行成功時 True、失敗時 False。
- Return type:
bool
- drive_A(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
- Parameters:
target (str | list)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- drive_AEX(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
絶対移動 POSEDATA 6軸
- Parameters:
target (str | list | tuple | None)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- drive_EX(target, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
相対移動 POSEDATA 6軸
- Parameters:
target (str | list | tuple)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property error_code
- property error_description
最後のエラーの内容表示
- property extaccel
- property extdecel
- property extspeed
- get_cobotta_all_files_content(skip_filenames=None)[source]
COBOTTA内全ファイル内容を [{‘filename’:…, ‘content’:…}, …] で返す(保存しない) クラス内に保存するだけ
- Parameters:
skip_filenames (set or list) – 除外したいファイル名
- Returns:
[{‘filename’:…, ‘content’:…}, …]
- Return type:
list
- get_cobotta_file_content(cobotta_filename)[source]
- Parameters:
cobotta_filename (str)
- Return type:
Optional[Dict[str, str]]
- get_cobotta_file_names()[source]
cobotta 内部のファイル一覧(cao.fileName)
Returns:
- Return type:
List[str] | Tuple[str, …] | None
- get_current_work_no()[source]
CurWork
現在の work(座標軸) 番号を取得 Change で work 版ををそもそも定義してないと例外が出る
Returns:
- Return type:
int | bool
- get_error()[source]
現在 RC8 に蓄積しているエラー情報をすべて取得して返す。
- 戻り値:
- [
[error_code, message, subcode, file_line, progname, line, file_id], …
]
- get_error_description(error_code)[source]
b-cap制御からの逆輸入 error_code から RC8 の説明文字列を取得する。
- Parameters:
error_code (int)
- Return type:
str | bool
- get_error_info(index)[source]
b-cap制御からの逆輸入 index 番目のエラー詳細を返す。
- Parameters:
index (int) – index 番目
- Returns:
index 番目のエラー詳細
- Return type:
str
- get_motion_preparation()[source]
動作準備完了状態を取得します. 動作準備完了状態でない場合,AutoCal 以外でロボット動作できません. 動作準備完了状態は,セーフティのエラー発生,非常停止 ON,防護停止 ON, セーフティパラメータの送信で,未完了状態になりま
Returns:
- get_tool_define(tool_no)[source]
現在のツール座標軸 取得
- Parameters:
tool_no (int)
- Return type:
list | tuple | bool
Returns:
- get_var(kind_or_combined, id_num=None)[source]
kind_or_combined: ‘P’, ‘I’, ‘F’, ‘IO’ または ‘P40’, ‘IO0’ のような形式 id_num: 数値ID(省略可能)
get_var(‘P’, 40) get_var(‘IO’, 0) get_var(‘P40’) get_var(‘IO0’)
- Parameters:
kind_or_combined (str)
id_num (int | None)
- Return type:
Any
- get_work(work_no=None)[source]
GetWorkDef
- Parameters:
work_no (int | None)
- Return type:
list | tuple | bool
Returns:
- give_arm()[source]
Arm の解放(サーバー側で cobotta 側を解放) サーバーを使うマルチユーザーはまだ考慮してない
- Returns:
可否(例外が出たら否)
- Return type:
bool
- hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
force (int | None)
direction (bool | int)
relative (bool)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_A(pos=None, *, position=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_AH(pos=None, *, position=None, force, speed=None, is_async=False)[source]
- Parameters:
pos (int | float | None)
position (int | float | None)
force (int | float)
speed (int | None)
is_async (bool | None)
- Return type:
bool
- hand_move_H(force, direction=True, *, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
force (int)
direction (bool | int)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- hand_move_R(pos=None, *, position=None, speed=None, is_async=False, bstrOpt=None)[source]
- Parameters:
pos (int | None)
position (int | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- j2p(j_type_pos)[source]
j型をp型に変換する
- Parameters:
j_type_pos (list | tuple)
- Return type:
list | tuple | bool
- property jspeed
- property lock
- property manual_move_mode
- property motion_mode
- move(target, *, motion_mode=None, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
Next は途中で止めるためというよりは、move() 事態を非同期にすることで move() move() がならんだときに、最初の move が終わってないときに次の move を読み込むことで モーションをつなげる意図がある。つまり、そのための非同期実行のオプション デフォルトで True としておく つまり、FINAL にするためには、MotionComplete が必要 というのをデフォルト動作にする –> Next を一般的ではない気がするので、async かな。
- target:
- list(6/7) → vntPose形式 [Pos, coord_type, path_blend] へ自動変換
※7要素なら先頭6要素だけ使う
list(3) → 既にvntPose形式
str → “@P P2”等はそのまま
- Parameters:
target (str | list | tuple)
motion_mode (int | str | MotionMode | None)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- move_C(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
Circle 円弧補完
- Parameters:
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- move_L(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
Line 直線補完
- Parameters:
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- move_P(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
PTP
- Parameters:
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- move_S(target, *, coord_type=None, path_blend=None, offset=None, pose=None, speed=None, accel=None, decel=None, is_async=True, bstrOpt=None)[source]
Spline 自由曲線補完
- Parameters:
target (str | list | tuple)
coord_type (str | None)
path_blend (str | None)
offset (tuple | list | None)
pose (int | None)
speed (int | None)
accel (float | None)
decel (float | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property open_files
コボッタ内部のファイルを開いたりするのに使う
- p2j(p_type_pos)[source]
P型をJ型に変換する
- Parameters:
p_type_pos (list | tuple)
- Return type:
list | tuple | bool
- property path_blend
- property rc8_type
- property rc8_type_name
- rotate("XY", 25[, 200, -20, 197])[source]
- Parameters:
plane (str) – “XY”, “XZ”, “YZ”
angle (float) – 回転角(deg)
center (list) – 回転中心(V(xx,yy,zz)))
path_blend (str)
speed (int) – 速度%
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
Returns:
- rotate_H(angle, *, path_blend=None, speed=None, is_async=True, bstrOpt=None)[source]
相対角度
(*) 相対なので、今いる角度によっては動かないことがある 今のポジションから目標ポジションで、ツールポイントの速度が決まるのでそれがハード限界を超えることがある
アプローチベクトルを軸とした回転動作 ふつうはエンドエフェクタの中心面に垂直がアプローチベクトル つまりJ座標で見れば J6 となる。のが普通
caoRob.Execute”RotateH”, Array(“@P 32.5” ,”S=50” )
- Parameters:
angle (str | float | int)
path_blend (str | None)
speed (int | None)
is_async (bool | None)
bstrOpt (str | int | None)
- Return type:
bool
- property servo_on
- set_P(id_num, value)[source]
- Parameters:
id_num (int)
value (List[float] | Tuple[float, ...])
- Return type:
bool
- set_accel(accel)[source]
軸毎のセットはなく、0:全軸(JSPEED)、-1:合成速度(SPEED)のみ
- Parameters:
accel (float)
- Return type:
bool
- set_coord_type(coord_type)[source]
self._coord_type = “J”
- Parameters:
coord_type (str)
- Return type:
bool
Returns:
- set_decel(decel)[source]
軸毎のセットはなく、0:全軸(JSPEED)、-1:合成速度(SPEED)のみ
- Parameters:
decel (float)
- Return type:
bool
- set_extspeed(speed)[source]
軸毎のセットはなく、0:全軸(JSPEED)、-1:合成速度(SPEED)のみ
- Parameters:
speed (int)
- Return type:
bool
- set_jspeed(speed)[source]
軸毎のセットはなく、0:全軸(JSPEED)、-1:合成速度(SPEED)のみ
- Parameters:
speed (int)
- Return type:
bool
- set_motion_mode(mode)[source]
- Parameters:
mode (int | str | MotionMode)
- Return type:
bool
- set_path_blend(path_blend)[source]
self._path_blend = “@P” パス変異量、次のパスへつなぐ動作をいつ開始するのか?
- Parameters:
path_blend (str)
- Return type:
None
- set_speed(speed)[source]
軸毎のセットはなく、0:全軸(JSPEED)、-1:合成速度(SPEED)のみ
- Parameters:
speed (int)
- Return type:
bool
- set_tool(tool_no, tool_define)[source]
- Parameters:
tool_no (int)
tool_define (tuple | list | str)
- Return type:
bool
- set_tool_define(tool_no, tool_define)[source]
ツール座標軸のセット
- Parameters:
tool_no (int)
tool_define (tuple | list | str) – [X,Y,Z,RX,RY,RZ]
- Returns:
セット成功か否か?
- Return type:
bool | None
- set_var(kind_or_combined, id_or_value, value=None)[source]
kind_or_combined: ‘P’, ‘I’, ‘F’, ‘IO’ または ‘P40’, ‘IO0’ のような形式 id_or_value: ID番号または(combined形式のときは)value value: 実際の値(combined形式のときに指定)
- Parameters:
kind_or_combined (str)
id_or_value (Any)
value (Any)
- Return type:
bool
- set_work(work_no, work_define, work_attribute=0)[source]
1, “P2” 1, “P(100, 200, 300, 180, 0, 180)”
- Parameters:
work_no (int)
work_define (tuple | list | str) – [X,Y,Z,RX,RY,RZ]
work_attribute (int)
- Return type:
bool
- property speed: int | None
内部スピード(100パーセント), take_arm で100に初期化, 実速度=内部x外部
- take_arm()[source]
AddRbot() and Take Arm() cobotta を追加して、手動動作する (PacScript動作ではない)
- Return type:
bool
- take_camera(evp_script_name, pac_script_name=None)[source]
一連の作業を省略するためだけのメソッド
EVP2用のスクリプト名を入れる(事前にカメラ側で作っておく)
撮影用のPacScript自動作成(PacScript名だけを設定する)
take_script
- Parameters:
evp_script_name (str)
pac_script_name (str) – 内部でこっそり使うスクリプト名(なんでもいい)
- Return type:
bool
- take_script(script='pro1')[source]
AddTask() and AddVariable() PacScript を追加して、スクリプト動作する
- Parameters:
script (str) – PacScript Name (拡張しありを入れる)
- Return type:
bool
- property task
- property task_state
- task_stop()[source]
Task 停止 個別の motor の停止とはことなって、task run を止める
- Returns:
True/False
- Return type:
bool
- test(lComp=1, bstrOpt=None)[source]
- Parameters:
lComp (int)
bstrOpt (int | str | None)
- Return type:
bool
- test1(lComp=1, bstrOpt=None)[source]
- Parameters:
lComp (int)
bstrOpt (str | int | None)
- Return type:
bool
- upload_content_to_cobotta(file_content, cobotta_filename)[source]
- Parameters:
file_content (str)
cobotta_filename (str)
- Return type:
bool
Returns:
cobotta2.cobotta_orin2_state module
cobotta2.cobotta_orin2_test module
cobotta2.config module
Kengo NAKADA: https://github.com/shimane-dev, https://github.com/kengo-nakada kengo.nakada@mat.shimane-u.ac.jp, kengo.nakada@gmail.com
- class Config(yaml_path=None)[source]
Bases:
object- BCAP_PORT = 5007
- CLIENT_LOGGER_NAME = 'cobotta_client'
- COBOTTA_IP = '10.170.10.35'
- JOYPAD_INTERVAL = 0.01
- JOYPAD_LOGGER_NAME = 'cobotta_joypad'
- JOYPAD_PORT = 50051
- LOGGER_LEVEL = 'debug'
- SERVER_IP = '10.170.10.33'
- SERVER_LOGGER_NAME = 'cobotta_server'
- SERVER_PORT = 8002
- TIMEOUT = 5
cobotta2.robot_var_manager module
- class RobotVarManager(robot_instance=None, logger=None, filename=None, autosave=False, autoload=False)[source]
Bases:
objectCobotta だけではなく一般的な Robot 向けの座標マネージャ
- Parameters:
filename (str | None)
autosave (bool)
autoload (bool)
- static _make_key(kind_or_combined, num=None)[source]
(“P”, 10) と “P10” を同じキー表現へ正規化する。
- Parameters:
kind_or_combined (str)
num (str | int | None)
- Return type:
str
- get_var(kind_or_combined, num=None, default=False)[source]
単一ローカル変数を取得する。
get_var(“P”, 10) と get_var(“P10”) は同じ意味である。 変数が存在しない場合は CobottaCtrl 側の慣例に合わせて False を返す。
- Parameters:
kind_or_combined (str)
num (str | int | None)
default (Any)
- read_var_from_robot(kind, num=None)[source]
cobotta本体 –> managerに反映
- Parameters:
kind (str)
num (str | int | None)
- read_vars_from_robot(kind, start, end=None)[source]
cobotta本体 –> managerに反映
- Parameters:
kind (str)
start (str | int)
- set_var(kind, num, value=None, save=None)[source]
単一ローカル変数のセット。
set_var(“P”, 10, value) と set_var(“P10”, value) の両方を受け付ける。
- Parameters:
kind (str) – 変数種別または結合済み変数名。例: “P”, “P10”。
num (str | int | Any) – 変数番号、または kind が結合済み変数名の場合の値。
value – 保存する値。
save (bool | None) – JSON保存制御。None の場合は autosave 設定に従う。 True の場合は即保存し、False の場合は保存しない。
- set_vars(kind, start, end=None, value=None)[source]
ローカル変数の一括/範囲セット(cobotta本体には影響しない)
- 例::
set_vars(“P”, 10, value=[1,2,3,4,5,6]) set_vars(“P”, 10, 12, value=[ [1,2,3,4,5,6], … ])
- Parameters:
kind
start
end
value
Returns: