# Dobot Magician

## 新增 Magician

在裝置選單中選擇新增 Magician，選取裝置連接埠後連線。

![](https://3423568874-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fgmii-tw%2F-M2r4JM8vehmrn9XcCIw%2F-M2r6Bz5ELo4pDi7vazv%2Fmagician_new.png?generation=1584693825853550\&alt=media)

## 手臂控制器

* 鎖定：需先設定裝置編號後鎖定，才能在任務中使用。
* 控制：控制器中間區域為控制區，連接後可以控制和設定手臂。
* 警報：若操控有誤或是裝置出現故障，下方會顯示出警報資訊。

![](https://3423568874-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fgmii-tw%2F-M2r4JM8vehmrn9XcCIw%2F-M2r6Bz30wYAEoK1C4A5%2Fmagician_controller.png?generation=1584693825860480\&alt=media)

## 在任務中使用手臂

Blockly和Python皆提供控制手臂的API，API的編號對應手臂控制器鎖定的編號，相同編號並且鎖定的手臂會執行對應的任務。

### Blockly 範例

![](https://3423568874-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fgmii-tw%2F-M2r4JM8vehmrn9XcCIw%2F-M2r6Bz4FA-vb-Wk_XrV%2Fmagician_example_blockly.png?generation=1584693825872743\&alt=media)

### Python 範例

```
from api import GmiiVisionAPI
import time

GmiiVisionSocket = GmiiVisionAPI.load()


i = None


while True:
  GmiiVisionAPI.DobotMagician_SetPTPCommonParams(GmiiVisionSocket, 0, 100, 100)
  GmiiVisionAPI.DobotMagician_SetPTPCmd(GmiiVisionSocket, 0, 0, [200, (-30), 0, 0])
  GmiiVisionAPI.DobotMagician_WaitQueuedCmdCompleted(GmiiVisionSocket, 0)
  GmiiVisionAPI.DobotMagician_SetPTPCommonParams(GmiiVisionSocket, 0, 30, 30)
  for i in range(1, 7):
    GmiiVisionAPI.DobotMagician_SetPTPCmd(GmiiVisionSocket, 0, 7, [10, 10,  0, 0])
    GmiiVisionAPI.DobotMagician_WaitQueuedCmdCompleted(GmiiVisionSocket, 0)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gmii.gitbook.io/gmii-tw/gmii-vision/device/arm/dobot-magician.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
