Skip to content

Commit

Permalink
Merge pull request #92 from elephantrobotics/mycobot_280_refactor
Browse files Browse the repository at this point in the history
Mycobot 280 refactor
  • Loading branch information
wangWking authored Oct 17, 2024
2 parents 69f819e + 5a45284 commit 981c6ad
Show file tree
Hide file tree
Showing 15 changed files with 1,287 additions and 91 deletions.
52 changes: 47 additions & 5 deletions docs/MechArm_270_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ mc.send_angle(1, 40, 20)
- Attentions:After the joint is disabled, it needs to be enabled to control within 1 second
- **Parameters**`data`(optional):The way to relax the joints. The default is damping mode, and if the 'data' parameter is provided, it can be specified as non damping mode (1- Undamping).

#### `focus_servos(servo_id)`
#### `focus_servo(servo_id)`

- **function:** Power on designated servo

Expand Down Expand Up @@ -114,6 +114,21 @@ mc.send_angle(1, 40, 20)
- `1`: Always execute the latest command first.
- `0`: Execute instructions sequentially in the form of a queue.

#### `focus_all_servos()`

- **Function:** All servos are powered on

- **Return value:**
- `1`: complete

#### `set_vision_mode()`

- **Function:** Set the vision tracking mode, limit the posture flipping of send_coords in refresh mode. (Applicable only to vision tracking function)

- **Parameter:**
- `1`: open
- `0`: close

### 3.MDI Mode and Operation

#### `get_angles()`
Expand Down Expand Up @@ -182,20 +197,22 @@ mc.send_angle(1, 40, 20)
- `0` - not stop
- `-1` - error

#### `sync_send_angles(angles, speed)`
#### `sync_send_angles(angles, speed, timeout=15)`

- **function:** Send the angle in synchronous state and return when the target point is reached
- **Parameters:**
- `angles`: a list of degree value(`List[float]`), length 6
- `speed`: (`int`) 1 ~ 100
- `timeout`: default 15 s

#### `sync_send_coords(coords, mode, speed)`
#### `sync_send_coords(coords, speed, mode=0, timeout=15)`

- **function:** Send the coord in synchronous state and return when the target point is reached
- **Parameters:**
- `coords`: a list of coord value(`List[float]`), length 6
- `speed`: (`int`) 1 ~ 100
- `mode`: (`int`) 0 - angular(default), 1 - linear
- `timeout`: default 15 s

#### `get_angles_coords()`

Expand Down Expand Up @@ -244,6 +261,21 @@ mc.send_angle(1, 40, 20)
- `0` not moving
- `-1` error

#### `angles_to_coords(angles)`

- **Function** : Convert angles to coordinates.
- **Parameters:**
- `angles`: `list` List of floating points for all angles.
- **Return value**: `list` List of floating points for all coordinates.

#### `solve_inv_kinematics(target_coords, current_angles)`

- **Function** : Convert coordinates to angles.
- **Parameters:**
- `target_coords`: `list` List of floating points for all coordinates.
- `current_angles`: `list` List of floating points for all angles, current angles of the robot
- **Return value**: `list` List of floating points for all angles.

### 4. JOG Mode and Operation

#### `jog_angle(joint_id, direction, speed)`
Expand All @@ -270,14 +302,24 @@ mc.send_angle(1, 40, 20)
- `direction`: (`int`) To control the direction of machine arm movement, `1` - forward rotation, `0` - reverse rotation
- `speed`: (`int`) 1 ~ 100

#### `jog_increment(joint_id, increment, speed)`
#### `jog_increment_angle(joint_id, increment, speed)`

- **function:** Single joint angle increment control
- **function:** Angle step, single joint angle increment control
- **Parameters**:
- `joint_id`: 1-6
- `increment`: Incremental movement based on the current position angle
- `speed`: 1 ~ 100

#### `jog_increment_coord(id, increment, speed)`

- **function:** Coord step, single coord increment control
- **Parameters**:
- `id`: axis 1-6
- `increment`: Incremental movement based on the current position coord
- `speed`: 1 ~ 100
- **Return value:**
- `1`: completed

#### `set_encoder(joint_id, encoder, speed)`

- **function**: Set a single joint rotation to the specified potential value
Expand Down
61 changes: 53 additions & 8 deletions docs/MechArm_270_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mc.send_angle(1, 40, 20)
- **功能:** 放松所有机械臂关节
- **参数**`data`(可选):关节放松方式,默认为阻尼模式,若提供 `data`参数可指定为非阻尼模式(1-Undamping)。

#### `focus_servos(servo_id)`
#### `focus_servo(servo_id)`

- **功能:** 单个舵机上电

Expand Down Expand Up @@ -113,6 +113,24 @@ mc.send_angle(1, 40, 20)
- `1`: 总是首先执行最新的命令。
- `0`: 以队列的形式按顺序执行指令。

#### `focus_all_servos()`

- **功能:** 所有舵机上电

- **返回值:**
- `1`: complete

#### `set_vision_mode()`

- **功能:** 设置视觉跟踪模式,限制刷新模式下send_coords的姿态翻转。(仅适用于视觉跟踪功能)

- **参数:**
- `1`: 打开
- `0`: 关闭

- **返回值:**
- `1`: 完成

### 3. MDI运行与操作

#### `get_angles()`
Expand Down Expand Up @@ -181,20 +199,22 @@ mc.send_angle(1, 40, 20)
- `0` - 没有停止
- `-1` - 错误

#### `sync_send_angles(angles, speed)`
#### `sync_send_angles(angles, speed, timeout=15)`

- **功能:** 同步状态下发送角度,到达目标点后返回
- **参数:**
- `angles`:角度值列表(`List[float]`),长度 6
- `speed`:(`int`)1 ~ 100
- `timeout`: 默认15秒

#### `sync_send_coords(coords, mode, speed)`
#### `sync_send_coords(coords, speed,mode=0, timeout=15)`

- **功能:** 同步状态下发送坐标,到达目标点后返回
- **参数:**
- `coords`:坐标值列表(`List[float]`),长度6
- `speed`:(`int`)1~100
- `mode`:(`int`)0-非线性(默认),1-直线运动
- `timeout`: 默认15秒

#### `get_angles_coords()`

Expand Down Expand Up @@ -243,6 +263,21 @@ mc.send_angle(1, 40, 20)
- `0` 未运动
- `-1` 错误

#### `angles_to_coords(angles)`

- **功能** : 将角度转为坐标。
- **参数:**
- `angles``list` 所有角度的浮点列表。
- **返回值**: `list` 所有坐标的浮点列表。

#### `solve_inv_kinematics(target_coords, current_angles)`

- **功能** : 将坐标转为角度。
- **参数:**
- `target_coords`: `list` 所有坐标的浮点列表。
- `current_angles`: `list` 所有角度的浮点列表,机械臂当前角度
- **返回值**: `list` 所有角度的浮点列表。

### 4. JOG运行与操作

#### `jog_angle(joint_id, direction, speed)`
Expand All @@ -269,22 +304,32 @@ mc.send_angle(1, 40, 20)
- `direction`: (`int`) 控制机臂运动方向,`1` - 正转,`0` - 反转
- `speed`: (`int`) 1 ~ 100

#### `jog_increment(joint_id, increment, speed)`
#### `jog_increment_angle(joint_id, increment, speed)`

- **功能**:单关节角度增量控制
- **功能**角度步进,单关节角度增量控制
- **参数**
- `joint_id`:1-6
- `increment`:基于当前位置角度的增量移动
- `speed`:1~100

#### `jog_increment_coord(id, increment, speed)`

- **功能**:坐标步进,单坐标增量控制
- **参数**
- `id`:坐标 id 1-6
- `increment`:基于当前位置坐标的增量移动
- `speed`:1~100
- **返回值**
- `1`:完成

#### `set_encoder(joint_id,coder,speed)`

- **功能**:设置单关节旋转为指定的潜在值

- **参数**
- `joint_id`:(`int`) 1-6
- `encoder`:0~4096
- `speed`:1~100
- `joint_id`:(`int`) 1-6
- `encoder`:0~4096
- `speed`:1~100

#### `get_encoder(joint_id)`

Expand Down
61 changes: 54 additions & 7 deletions docs/MyCobot_280_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ mc.send_angle(1, 40, 20)
- **Return value:**
- `1` - release completed.

#### `focus_servos(servo_id)`
#### `focus_servo(servo_id)`

- **function:** Power on designated servo

Expand Down Expand Up @@ -147,6 +147,24 @@ mc.send_angle(1, 40, 20)
- `1`: free mode
- `0`: on-free mode

#### `focus_all_servos()`

- **Function:** All servos are powered on

- **Return value:**
- `1`: complete

#### `set_vision_mode()`

- **Function:** Set the vision tracking mode, limit the posture flipping of send_coords in refresh mode. (Applicable only to vision tracking function)

- **Parameter:**
- `1`: open
- `0`: close

- **Return value:**
- `1`: complete

### 3.MDI Mode and Operation

#### `get_angles()`
Expand Down Expand Up @@ -223,24 +241,26 @@ mc.send_angle(1, 40, 20)
- `0` - not stop
- `-1` - error

#### `sync_send_angles(angles, speed)`
#### `sync_send_angles(angles, speed, timeout=15)`

- **function:** Send the angle in synchronous state and return when the target point is reached
- **Parameters:**
- `angles`: a list of degree value(`List[float]`), length 6
- `speed`: (`int`) 1 ~ 100
- `timeout`: default 15 s
- **Return value:**
- `1`: complete
- `1` - complete

#### `sync_send_coords(coords, mode, speed)`
#### `sync_send_coords(coords, speed, mode=0, timeout=15)`

- **function:** Send the coord in synchronous state and return when the target point is reached
- **Parameters:**
- `coords`: a list of coord value(`List[float]`), length 6
- `speed`: (`int`) 1 ~ 100
- `mode`: (`int`) 0 - angular(default), 1 - linear
- `timeout`: default 15 s
- **Return value:**
- `1`: complete
- `1` - complete

#### `get_angles_coords()`

Expand Down Expand Up @@ -291,6 +311,21 @@ mc.send_angle(1, 40, 20)
- `0` not moving
- `-1` error

#### `angles_to_coords(angles)`

- **Function** : Convert angles to coordinates.
- **Parameters:**
- `angles`: `list` List of floating points for all angles.
- **Return value**: `list` List of floating points for all coordinates.

#### `solve_inv_kinematics(target_coords, current_angles)`

- **Function** : Convert coordinates to angles.
- **Parameters:**
- `target_coords`: `list` List of floating points for all coordinates.
- `current_angles`: `list` List of floating points for all angles, current angles of the robot
- **Return value**: `list` List of floating points for all angles.

### 4. JOG Mode and Operation

#### `jog_angle(joint_id, direction, speed)`
Expand Down Expand Up @@ -323,13 +358,25 @@ mc.send_angle(1, 40, 20)
- **Return value:**
- `1`: complete

#### `jog_increment(joint_id, increment, speed)`
#### `jog_increment_angle(joint_id, increment, speed)`

- **function:** Single joint angle increment control
- **function:** Angle step, single joint angle increment control
- **Parameters**:
- `joint_id`: 1-6
- `increment`: Incremental movement based on the current position angle
- `speed`: 1 ~ 100
- **Return value:**
- `1`: completed

#### `jog_increment_coord(id, increment, speed)`

- **function:** Coord step, single coord increment control
- **Parameters**:
- `id`: axis 1-6
- `increment`: Incremental movement based on the current position coord
- `speed`: 1 ~ 100
- **Return value:**
- `1`: completed

#### `set_encoder(joint_id, encoder, speed)`

Expand Down
Loading

0 comments on commit 981c6ad

Please sign in to comment.