dobot package
Dobot MG400 制御パッケージ。
Subpackages
Submodules
dobot.config module
Dobot の設定構造と YAML 読み込みを定義する。
- class dobot.config.Config(yaml_path=None)[ソース]
ベースクラス:
objectDobot の設定構造。
実際の環境ごとの設定値は YAML から読み込む。 クラスとしての読み込みと、インスタンスごとの読み込みの両方に対応する。
- CLIENT_LOGGER_NAME = 'dobot_client'
- DOBOT_IP = '192.168.1.6'
- INSTANCE_NAME = 'Ctrl'
- LOGGER_LEVEL = 'INFO'
- SERVER_IP = '127.0.0.1'
- SERVER_LOGGER_NAME = 'dobot_server'
- SERVER_PORT = 8000
- TIMEOUT = 5
dobot.dobot_api module
- class dobot.dobot_api.DobotApiDashboard(ip, port, *args)[ソース]
ベースクラス:
DobotApiDefine class dobot_api_dashboard to establish a connection to Dobot
- AccJ(speed)[ソース]
Set joint acceleration ratio (Only for MovJ, MovJIO, MovJR, JointMovJ commands) speed : Joint acceleration ratio (Value range:1~100)
- AccL(speed)[ソース]
Set the coordinate system acceleration ratio (Only for MovL, MovLIO, MovLR, Jump, Arc, Circle commands) speed : Cartesian acceleration ratio (Value range:1~100)
- Arch(index)[ソース]
Set the Jump gate parameter index (This index contains: start point lift height, maximum lift height, end point drop height) index : Parameter index (Value range:0~9)
- DO(index, status)[ソース]
Set digital signal output (Queue instruction) index : Digital output index (Value range:1~24) status : Status of digital signal output port(0:Low level,1:High level
- GetHoldRegs(id, addr, count, type=None)[ソース]
Read hold register id :Secondary device NUMBER (A maximum of five devices can be supported. The value ranges from 0 to 4
Set to 0 when accessing the internal slave of the controller)
addr :Hold the starting address of the register (Value range:3095~4095) count :Reads the specified number of types of data (Value range:1~16) type :The data type
If null, the 16-bit unsigned integer (2 bytes, occupying 1 register) is read by default "U16" : reads 16-bit unsigned integers (2 bytes, occupying 1 register) "U32" : reads 32-bit unsigned integers (4 bytes, occupying 2 registers) "F32" : reads 32-bit single-precision floating-point number (4 bytes, occupying 2 registers) "F64" : reads 64-bit double precision floating point number (8 bytes, occupying 4 registers)
- LimZ(value)[ソース]
Set the maximum lifting height of door type parameters value : Maximum lifting height (Highly restricted:Do not exceed the limit position of the z-axis of the manipulator)
- PayLoad(weight, inertia)[ソース]
Setting robot load weight : The load weight inertia: The load moment of inertia
- SetHoldRegs(id, addr, count, table, type=None)[ソース]
Write hold register id :Secondary device NUMBER (A maximum of five devices can be supported. The value ranges from 0 to 4
Set to 0 when accessing the internal slave of the controller)
addr :Hold the starting address of the register (Value range:3095~4095) count :Writes the specified number of types of data (Value range:1~16) type :The data type
If null, the 16-bit unsigned integer (2 bytes, occupying 1 register) is read by default "U16" : reads 16-bit unsigned integers (2 bytes, occupying 1 register) "U32" : reads 32-bit unsigned integers (4 bytes, occupying 2 registers) "F32" : reads 32-bit single-precision floating-point number (4 bytes, occupying 2 registers) "F64" : reads 64-bit double precision floating point number (8 bytes, occupying 4 registers)
- SpeedJ(speed)[ソース]
Set joint speed ratio (Only for MovJ, MovJIO, MovJR, JointMovJ commands) speed : Joint velocity ratio (Value range:1~100)
- SpeedL(speed)[ソース]
Set the cartesian acceleration ratio (Only for MovL, MovLIO, MovLR, Jump, Arc, Circle commands) speed : Cartesian acceleration ratio (Value range:1~100)
- Tool(index)[ソース]
Select the calibrated tool coordinate system index : Calibrated index of tool coordinates
- class dobot.dobot_api.DobotApiMove(ip, port, *args)[ソース]
ベースクラス:
DobotApiDefine class dobot_api_move to establish a connection to Dobot
- Arc(x1, y1, z1, r1, x2, y2, z2, r2, *dynParams)[ソース]
Circular motion instruction x1, y1, z1, r1 :Is the point value of intermediate point coordinates x2, y2, z2, r2 :Is the value of the end point coordinates Note: This instruction should be used together with other movement instructions
- Circle(x1, y1, z1, r1, x2, y2, z2, r2, count, *dynParams)[ソース]
Full circle motion command count:Run laps x1, y1, z1, r1 :Is the point value of intermediate point coordinates x2, y2, z2, r2 :Is the value of the end point coordinates Note: This instruction should be used together with other movement instructions
- JointMovJ(j1, j2, j3, j4, *dynParams)[ソース]
Joint motion interface (linear motion mode) j1~j6:Point position values on each joint
- Jump(x, y, z, r, User=None, Tool=None, SpeedL=None, AccL=None, Start=None, End=None, ZLimit=None, auxJoint=None)[ソース]
调用示例:dobot.Jump(100, 200, 50, 45, User=1, Tool=2, SpeedL=50, AccL=50, Start=10, End=10, ZLimit=80) 门型运动指令 (Jump motion) x: X轴位置,单位:毫米 y: Y轴位置,单位:毫米 z: Z轴位置,单位:毫米 r: R轴位置,单位:毫米 User: 用户坐标系索引,取值范围:0~9,不填按照上一次设置的值 Tool: 工具坐标系索引,取值范围:0~9,不填按照上一次设置的值 SpeedL: 笛卡尔速度比例,取值范围:1~100,不填按照上一次设置的值 AccL: 笛卡尔加速度比例,取值范围:1~100,不填按照上一次设置的值 Start: 门型起始点抬升高度(单位:毫米),不填沿用 Arch() 设置 End: 门型结束点下降高度(单位:毫米),不填沿用 Arch() 设置 ZLimit: 门型最大抬升高度(单位:毫米),不填沿用 Arch() 设置 auxJoint: 滑轨辅助关节值
- MovJ(x, y, z, r, *dynParams)[ソース]
Joint motion interface (point-to-point motion mode) x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system R
- MovJIO(x, y, z, r, *dynParams)[ソース]
Set the digital output port state in parallel during point-to-point motion x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system r *dynParams :Parameter Settings(Mode、Distance、Index、Status)
Mode :Set Distance mode (0: Distance percentage; 1: distance from starting point or target point) Distance :Runs the specified distance(If Mode is 0, the value ranges from 0 to 100;When Mode is 1, if the value is positive,
it indicates the distance from the starting point. If the value of Distance is negative, it represents the Distance from the target point)
Index :Digital output index (Value range:1~24) Status :Digital output state(Value range:0/1)
- MovL(x, y, z, r, *dynParams)[ソース]
Coordinate system motion interface (linear motion mode) x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system R
- MovLIO(x, y, z, r, *dynParams)[ソース]
Set the digital output port state in parallel while moving in a straight line x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system r *dynParams :Parameter Settings(Mode、Distance、Index、Status)
Mode :Set Distance mode (0: Distance percentage; 1: distance from starting point or target point) Distance :Runs the specified distance(If Mode is 0, the value ranges from 0 to 100;When Mode is 1, if the value is positive,
it indicates the distance from the starting point. If the value of Distance is negative, it represents the Distance from the target point)
Index :Digital output index (Value range:1~24) Status :Digital output state(Value range:0/1)
- MoveJog(axis_id=None, *dynParams)[ソース]
Joint motion axis_id: Joint motion axis, optional string value:
J1+ J2+ J3+ J4+ J5+ J6+ J1- J2- J3- J4- J5- J6- X+ Y+ Z+ Rx+ Ry+ Rz+ X- Y- Z- Rx- Ry- Rz-
- *dynParams: Parameter Settings(coord_type, user_index, tool_index)
coord_type: 1: User coordinate 2: tool coordinate (default value is 1) user_index: user index is 0 ~ 9 (default value is 0) tool_index: tool index is 0 ~ 9 (default value is 0)
- RelJointMovJ(offset1, offset2, offset3, offset4, *dynParams)[ソース]
The relative motion command is carried out along the joint coordinate system of each axis, and the end motion mode is joint motion Offset motion interface (point-to-point motion mode) j1~j6:Point position values on each joint *dynParams: parameter Settings(speed_j, acc_j, user)
speed_j: Set Cartesian speed scale, value range: 1 ~ 100 acc_j: Set acceleration scale value, value range: 1 ~ 100
- RelMovJ(x, y, z, r, *dynParams)[ソース]
Offset motion interface (point-to-point motion mode) j1~j6:Point position values on each joint
- RelMovJUser(offset_x, offset_y, offset_z, offset_r, user, *dynParams)[ソース]
The relative motion command is carried out along the user coordinate system, and the end motion mode is joint motion offset_x: X-axis direction offset offset_y: Y-axis direction offset offset_z: Z-axis direction offset offset_r: R-axis direction offset
user: Select the calibrated user coordinate system, value range: 0 ~ 9 *dynParams: parameter Settings(speed_j, acc_j, tool)
speed_j: Set joint speed scale, value range: 1 ~ 100 acc_j: Set acceleration scale value, value range: 1 ~ 100 tool: Set tool coordinate system index
- RelMovL(offsetX, offsetY, offsetZ, offsetR, *dynParams)[ソース]
Offset motion interface (point-to-point motion mode) x: Offset in the Cartesian coordinate system x y: offset in the Cartesian coordinate system y z: Offset in the Cartesian coordinate system Z r: Offset in the Cartesian coordinate system R
- RelMovLUser(offset_x, offset_y, offset_z, offset_r, user, *dynParams)[ソース]
The relative motion command is carried out along the user coordinate system, and the end motion mode is linear motion offset_x: X-axis direction offset offset_y: Y-axis direction offset offset_z: Z-axis direction offset offset_r: R-axis direction offset user: Select the calibrated user coordinate system, value range: 0 ~ 9 *dynParams: parameter Settings(speed_l, acc_l, tool)
speed_l: Set Cartesian speed scale, value range: 1 ~ 100 acc_l: Set acceleration scale value, value range: 1 ~ 100 tool: Set tool coordinate system index
dobot.dobot_api_ext module
DOBOTベンダーAPIのプロジェクト向け拡張。
ベンダー提供 dobot_api.py は変更しない。
このモジュールでは、ベンダークラスを継承し、プロジェクト共通loggerへの
出力統一と、保持中TCPソケットの送信前死活確認だけを追加する。
- class dobot.dobot_api_ext.DobotApiDashboardExt(ip, port, logger)[ソース]
ベースクラス:
_DobotApiExtMixin,DobotApiDashboardDobotApiDashboardのプロジェクト向け派生クラス。
- class dobot.dobot_api_ext.DobotApiExt(ip, port, logger)[ソース]
ベースクラス:
_DobotApiExtMixin,DobotApiDobotApiのプロジェクト向け派生クラス。
- class dobot.dobot_api_ext.DobotApiMoveExt(ip, port, logger)[ソース]
ベースクラス:
_DobotApiExtMixin,DobotApiMoveDobotApiMoveのプロジェクト向け派生クラス。- Arc(x1, y1, z1, r1, x2, y2, z2, r2, *dynParams)[ソース]
Circular motion instruction x1, y1, z1, r1 :Is the point value of intermediate point coordinates x2, y2, z2, r2 :Is the value of the end point coordinates Note: This instruction should be used together with other movement instructions
- Circle(x1, y1, z1, r1, x2, y2, z2, r2, count, *dynParams)[ソース]
Full circle motion command count:Run laps x1, y1, z1, r1 :Is the point value of intermediate point coordinates x2, y2, z2, r2 :Is the value of the end point coordinates Note: This instruction should be used together with other movement instructions
- JointMovJ(j1, j2, j3, j4, *dynParams)[ソース]
Joint motion interface (linear motion mode) j1~j6:Point position values on each joint
- Jump(x, y, z, r, User=None, Tool=None, SpeedL=None, AccL=None, Start=None, End=None, ZLimit=None, auxJoint=None)[ソース]
调用示例:dobot.Jump(100, 200, 50, 45, User=1, Tool=2, SpeedL=50, AccL=50, Start=10, End=10, ZLimit=80) 门型运动指令 (Jump motion) x: X轴位置,单位:毫米 y: Y轴位置,单位:毫米 z: Z轴位置,单位:毫米 r: R轴位置,单位:毫米 User: 用户坐标系索引,取值范围:0~9,不填按照上一次设置的值 Tool: 工具坐标系索引,取值范围:0~9,不填按照上一次设置的值 SpeedL: 笛卡尔速度比例,取值范围:1~100,不填按照上一次设置的值 AccL: 笛卡尔加速度比例,取值范围:1~100,不填按照上一次设置的值 Start: 门型起始点抬升高度(单位:毫米),不填沿用 Arch() 设置 End: 门型结束点下降高度(单位:毫米),不填沿用 Arch() 设置 ZLimit: 门型最大抬升高度(单位:毫米),不填沿用 Arch() 设置 auxJoint: 滑轨辅助关节值
- MovJ(x, y, z, r, *dynParams)[ソース]
Joint motion interface (point-to-point motion mode) x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system R
- MovJIO(x, y, z, r, *dynParams)[ソース]
Set the digital output port state in parallel during point-to-point motion x: A number in the Cartesian coordinate system x y: A number in the Cartesian coordinate system y z: A number in the Cartesian coordinate system z r: A number in the Cartesian coordinate system r *dynParams :Parameter Settings(Mode、Distance、Index、Status)
Mode :Set Distance mode (0: Distance percentage; 1: distance from starting point or target point) Distance :Runs the specified distance(If Mode is 0, the value ranges from 0 to 100;When Mode is 1, if the value is positive,
it indicates the distance from the starting point. If the value of Distance is negative, it represents the Distance from the target point)
Index :Digital output index (Value range:1~24) Status :Digital output state(Value range:0/1)
dobot.dobot_ctrl module
DOBOT MG400 の共通制御 I/F。
このクラスは公開 I/F 層である。 MG400 固有の TCP/IP API、座標変換、コマンド変換、状態取得などの 実装は DobotTcp に置き、このクラスでは実装しない。
公開I/Fはロボット制御層として必要な操作をまとめ、 MG400固有の実装は DobotTcp に委譲する。
- class dobot.dobot_ctrl.DobotCtrl(dobot_ip='192.168.1.6', instance_name='Ctrl', logger=None, log_level=None, auto_connect=True)[ソース]
ベースクラス:
object共通制御 I/F を DOBOT MG400 実装へ委譲する。
- property accel
- property busy_status
- property coord_type
- property current_angle
- property current_position
- property decel
- property direct_mode
- property error_code
- property error_description
- property extaccel
- property extdecel
- property extspeed
- hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False)[ソース]
- jog(axis, direction, speed, step=None)[ソース]
関節JOGの共通I/F。
step=Noneでは、jog_stop()を呼ぶまで指定方向へ連続JOGする。stepを指定した場合は、その絶対値だけ有限相対移動する。- パラメータ:
axis (int) -- 関節番号。
direction (int) -- 正方向は1、負方向は-1。
speed (float) -- 速度の大きさ。DOBOTでは速度倍率[%]として扱う。
step (Optional[float]) -- 有限JOG量。DOBOTでは関節角度[deg]。
- property jspeed
- 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)[ソース]
- property path_blend
- property servo_on
- property speed
- property task
- property task_state
dobot.dobot_error module
Dobot MG400のエラー取得・解析・表示を管理する。
DobotTcp からエラー関連処理を分離し、次の責務を集約する。
Dashboard
GetErrorID()の構造解析コントローラ/サーボアラームの識別
alarm JSONからの日本語説明・原因・対処取得
Feedback
ErrorStatusとGetErrorID()による実行失敗判定非同期モーション受付直後のアラーム監視
TCP接続そのものは所有せず、Dashboard取得関数とFeedback状態取得関数を
DobotTcp から受け取る。これにより通信ライフサイクルとエラー解釈を分離する。
- class dobot.dobot_error.DobotErrorManager(*, dashboard_getter: Callable[[], Any], state_getter: Callable[[...], Any], scalar_status: Callable[[Any], int], logger: Any)[ソース]
ベースクラス:
objectDobotのアラーム取得・解釈・モーション失敗判定を担当する。
- property error_description: str
現在発生中の全アラームを利用者向け文字列として返す。
dobot.dobot_tcp module
Dobot MG400 TCP/IP制御バックエンド。
Dashboard、Motion、Feedbackの3ソケットを管理し、MG400の基本制御、 状態取得、エラー取得、移動命令を一つのクラスにまとめる。
30004番ポートのリアルタイムステータスを別スレッドで受信し、最新フレームを スレッドセーフに保持する。移動の同期/非同期は共通I/Fの意味に合わせ、DOBOT公式APIのSYNCパラメータを使う。 非同期移動を明示的に待つ場合はDOBOT公式APIのSync()を使う。
- class dobot.dobot_tcp.DobotTcp(dobot_ip: str = '192.168.1.6', instance_name: str = 'Ctrl', logger: Any | None = None, log_level: str | None = None, auto_connect: bool = True)[ソース]
ベースクラス:
objectDobot MG400のTCP/IP通信を管理する。
Dashboard API、Motion API、Feedback APIへの接続を保持し、 ロボットの制御と状態取得を提供する。
- パラメータ:
dobot_ip (str) -- MG400のIPアドレス。
instance_name (str) -- インスタンス識別名。
logger (Optional[Any]) -- 呼び出し側から渡されるロガー。 Noneの場合の処理は既存実装に従う。
log_level (Optional[str]) -- loggerがNoneの場合に使用するログレベル。
auto_connect (bool) -- Trueの場合、初期化時に接続する。
- DASHBOARD_PORT = 29999
- FEEDBACK_MAGIC = 81985529216486895
- FEEDBACK_PORT = 30004
- FEEDBACK_SIZE = 1440
- MOVE_PORT = 30003
- property accel
- property busy_status
MG400が現在動作中かを真偽値で返す。
Feedbackの
RunningStatusとJogStatusを参照し、 キュー動作中またはJOG中であればTrueを返す。
- connect() bool[ソース]
MG400の3つのTCP/IPポートへ接続する。
Dashboard、Motion、Feedbackの順にソケットを生成し、接続成功後に Feedback受信スレッドを開始する。
- 戻り値:
- すべての接続と受信スレッド開始に成功した場合はTrue。
接続処理で例外が発生した場合はFalse。
- 戻り値の型:
bool
- property coord_type
- property current_angle
- property current_position
- property decel
- dev(base, offset)[ソース]
MG400で実現可能な範囲のDev(P姿勢変位)を計算する。
MG400はP=[x,y,z,rx,ry,rz]のうちrx/ryを実現できない。 したがってbase/offset双方のrx/ryが0の場合だけ、 x,y,z,rzの変位を合成する。
rx/ryを黙って捨てることはしない。
- property direct_mode
- disconnect() bool[ソース]
MG400とのTCP/IP接続を閉じる。
Feedback受信スレッドへ停止を通知した後、Feedback、Motion、 Dashboardの各ソケットを閉じる。
- 戻り値:
切断処理を実行した場合はTrue。
- 戻り値の型:
bool
- drive(target, *, relative=False, path_blend=None, speed=None, is_async=False)[ソース]
軸番号と値によるDrive共通I/F。
- property error_code
- property error_description
- property extaccel
- property extdecel
- property extspeed
- get_IO(id_num: int)[ソース]
共通
IO*の出力readbackを返す。set_IO()がDOを書き込むため、同じI/Fのget_IO()もDO状態を 読む。入力はget_digital_input()で明示的に取得する。
- get_current_angle()[ソース]
現在関節値を6成分として同期取得して返す。
MG400のDashboard API
GetAngle()を直接使用する。MG400は4軸 なのでJ5/J6は0.0として公開する。
- get_current_position()[ソース]
現在TCP位置を6成分座標として同期取得して返す。
MG400のDashboard API
GetPose()を直接使用する。4軸MG400の [x, y, z, r] は公開I/Fで [x, y, z, 0.0, 0.0, rz] として返す。
- get_current_work_no()[ソース]
現在のユーザー座標系番号を取得する。
- 戻り値:
- フィードバックで取得したユーザー座標系番号。
未受信時は最後に設定した番号。
- 戻り値の型:
int
- get_digital_input(index)[ソース]
DOBOT固有: 指定DIの状態を取得する。
ベンダーDashboard APIの DI(index) を使用する。 共通Ctrl I/Fには公開しない。
- get_motion_complete()[ソース]
現在ロボットがモーション実行中でないかを返す。
モーション実行状態の判定には、DOBOTのリアルタイムステータス
RunningStatusを使う。
- get_speed()[ソース]
最後に共通I/Fから設定した内部移動速度[%]を返す。
MG400 TCP/IPには
SpeedLのreadback APIがないため、 DobotTcpが最後に設定した値を保持して返す。実速度計測値ではない。
- get_tool_define(tool_no: int)[ソース]
指定Tool座標系定義を6成分座標で返す。
MG400には任意番号を直接readするGetToolDef相当がないため、現在Toolを 保存して一時選択し、Feedback
toolを取得後に元へ戻す。
- get_work(work_no=None)[ソース]
ユーザー座標系定義を取得する。
MG400のUser座標系定義を、30004番ポートのリアルタイムステータス
userから取得する。work_noがNoneの場合は現在選択中のUser座標系をそのまま返す。 番号を指定した場合、MG400の現在のPython APIには任意番号の User座標系定義だけを直接取得する命令がないため、一時的に User(work_no)で選択してuserを取得し、その後で元のUserへ戻す。- パラメータ:
work_no (int or None) -- 取得するWork/User座標系番号。 Noneの場合は現在選択中の座標系。
- 戻り値:
- [x, y, z, rx, ry, rz] の6成分座標系定義。
リアルタイムステータスを取得できない場合はNone。
- 戻り値の型:
list
- give_arm() bool[ソース]
アーム制御権解放I/Fを処理する。
MG400のTCP/IP APIには独立した制御権解放操作がないため、 ロボットへコマンドは送信せず成功として扱う。 DisableRobot()とは役割が異なるため、ここでは呼び出さない。
- halt() bool[ソース]
即時停止を行う。
現在利用しているMG400 APIでは、このI/Fに必要な停止動作と同義であることを 確認できるコマンドがないため未対応とする。ResetRobot()は代用しない。
- 例外:
NotImplementedError -- 対応するMG400実装がない。
- hand(pos=None, *, position=None, force=None, direction=True, relative=False, speed=None, is_async=False)[ソース]
- jog(axis, direction, speed, step=None)[ソース]
共通JOG I/FをMG400へ変換する。
- パラメータ:
axis (int) -- 関節番号。MG400では1..4。
direction (int) -- 正方向は1、負方向は-1。
speed (float) -- DOBOTの速度倍率[%]。1..100。
step (Optional[float]) -- Noneなら連続JOG。値を指定した場合は その絶対値[deg]だけ指定関節を相対移動する。
- 戻り値:
コマンド受付または有限ステップ移動に成功した場合True。
- 戻り値の型:
bool
メモ
連続JOGにはDOBOT公式TCP/IP APIの
MoveJogを使用する。MoveJog("J1+")等で開始し、MoveJog()で停止する。 MoveJogには個別速度引数がないため、speedはグローバル速度倍率SpeedFactorに写像する。
- property jspeed
- property lock
ロック状態を取得する。MG400では対応状態を確認できないため未対応。
- 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)[ソース]
公開move I/FをMG400の移動コマンドへ変換する。
- 公開座標:
P = [x, y, z, rx, ry, rz] J = [j1, j2, j3, j4, j5, j6]
- MG400内部:
P = [x, y, z, r] (r <- rz) J = [j1, j2, j3, j4]
- 同期契約:
- is_async=True:
TCP/IPのMovJ/MovL/JointMovJを送信し、受付応答後に戻る。
- is_async=False:
TCP/IPのMovJ/MovL/JointMovJを送信した後、Sync()を送信して 投入済みモーションの実行完了まで待ってから戻る。
DobotStudio ProスクリプトのMovJ/MovLにあるSYNCオプションは、 TCP/IP 30003ポートのMovJ/MovLオプションではないため送信しない。
- property path_blend
- run_script()[ソース]
共通 I/F のスクリプト実行。
公開I/Fの
run_script()は引数なしだが、MG400のRunScript(projectName)はプロジェクト名を必要とするため、 このメソッドでは別の意味を割り当てず未対応とする。
- property servo_on
MG400の駆動Enable状態を返す。
Feedbackの
EnableStatusを使用し、EnableRobot()/DisableRobot()による現在のEnable状態を取得する。RobotModeやbusy_statusとは別の状態である。
- set_path_blend(path_blend)[ソース]
パス遷移条件を設定する。
現在の
path_blendの値をDOBOTのCP値へ安全に変換する規則を 定義していないため、Noneだけを「指定なし」として受理する。
- set_speed(speed)[ソース]
MG400の直線移動速度率を設定する。
Dashboard APIの
SpeedLを使用する。 グローバル速度倍率はSpeedFactorを使用する別I/Fで管理する。
- set_work(work_no, work_define, work_attribute=0) bool[ソース]
ユーザー座標系を定義する。
MG400のUser座標系を
SetUser(index,{x,y,z,r})で定義する。work_defineは [x, y, z, rx, ry, rz] として受け取り、MG400の4軸座標系 [x, y, z, r] へ変換する。MG400のrにはrzを対応させる。 rx/ryが0でない座標系はMG400では表現できないため拒否する。work_attributeは公開I/Fとの互換性のため受け取るが、 MG400の座標系定義には使用しない。- 注意:
MG400マニュアル上、SetUserによる変更は現在の プロジェクト実行中のみ有効で、プロジェクト停止後は 変更前の値へ戻る。
- パラメータ:
work_no (int) -- Work/User座標系番号。0..9。
work_define (list or tuple) -- [x,y,z,rx,ry,rz]。
work_attribute -- 互換引数。現在は未使用。
- 戻り値:
SetUserが成功した場合True。
- 戻り値の型:
bool
- property speed
- state()[ソース]
現在の実行状態を返す。
MG400 Feedbackの
RunningStatusを返す。busy_statusはJOGも含む「ロボットが動作中」の判定であり、state()とは意図的に分ける。DOBOT固有のRobotMode番号が必要な場合はget_robot_mode()を使用する。
- stop_script()[ソース]
DOBOT固有: 実行中のスクリプトを停止する。
ベンダーDashboard APIの StopScript() をそのまま使用する。 共通Ctrl I/Fには公開しない。
- take_arm() bool[ソース]
アーム制御権取得I/Fを処理する。
MG400のTCP/IP APIには独立した制御権取得操作がないため、 ロボットへコマンドは送信せず成功として扱う。 EnableRobot()とは役割が異なるため、ここでは呼び出さない。
- property task
実行タスクを取得する。MG400では対応するタスクハンドルがないため未対応。
- property task_state
タスク状態を取得する。MG400では対応する状態ハンドルがないため未対応。
dobot.robot_var_manager module
COBOTTA互換I/Fで使用するロボット非依存変数ストア。
P/J/I/F/IO変数の値管理とJSON保存だけを担当する。 実ロボット制御やTCP通信は行わない。
dobot.server module
Dobot FastAPI 関連の公開入口。