Skip to content

Commit 269f622

Browse files
Merge pull request #1 from Jialn/master
Add google docstring style comments for the python API
2 parents 78a1f29 + 0b616ab commit 269f622

3 files changed

Lines changed: 214 additions & 67 deletions

File tree

‎README.md‎

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
1-
Introduction
1+
## Introduction
22

33
DexArm is developed based on the world's leading open source project **Marlin**, the DexArm firmware is completely open source, and its control commands (G-code) are compatible with Marlin.
44

55
G-code commands are the general control commands for CNC machines, 3D printers, etc. It is composed of ASCII strings, such as `G1 F2000 X0 Y300 Z0`, G-code commands usually uses `\n` as the sending end character.
66

7-
In Marlin, the slave device will reply `ok` after receiving the G-code commands, the host computer then can send the next commands after receiving the `ok`. In DexArm SDK (pydexarm, etc.), we have encapsulated this sending and receiving mechanism and make it convenient for users to use.
7+
In Marlin, the device will reply `ok` after receiving the G-code commands, the host computer then can send the next commands after receiving the `ok`. In DexArm SDK (pydexarm, etc.), we have encapsulated this sending and receiving mechanism and make it convenient for users to use.
88

99

10+
## Install dependency
1011

11-
Communication Parameters
12+
```
13+
pip install pyserial
14+
```
15+
16+
## Initialization
17+
18+
After the host computer is connected to the robot arm, please send the `GoHOME` command at first to move the arm to the HOME (`X0 Y300 Z0`) position.
19+
20+
## Run the example
21+
22+
Change the port in pydexarm/example.py properly and run:
23+
24+
```
25+
python pydexarm/example.py
26+
```
27+
28+
## Communication Parameters
1229

1330
- Baud rate: 115200
1431
- Data bits: 8
1532
- Stop bits: 1
1633
- Parity: None
1734
- Flow control: None
1835

19-
**Initialization**
20-
21-
After the host computer is connected to the robot arm, please send the `GoHOME` command at first to move the arm to the HOME (`X0 Y300 Z0`) position.
22-
23-
**Front-end modules**
36+
## Front-end modules
2437

2538
Different front-end modules have different offset values. You need to set the actual front-end module through command `M888 Pn`. After that, the parameters will be saved in the firmware, and when you re-start the arm next time, it will load the saved front-end module parameters automatically.
2639

@@ -29,23 +42,23 @@ Different front-end modules have different offset values. You need to set the ac
2942
- Pneumatic module: `M888 P2`
3043
- 3D printing module: `M888 P3`
3144

32-
**Re-calibrate the initial position**
45+
## Re-calibrate the initial position
3346

3447
The DexArm HOME position and motion coordinates are based on the initial position. The initial position has been calibrated before leaving the factory. If there is any error in the arm movement, please re-calibrate the initial position according to the following instruction:
3548

3649
1. Adjust the arm to the following position, make sure Axis 1 and Axis 2 is in the maximum position:
3750

3851
2. Send command `M889`
3952

40-
**Motion commands**
53+
## Motion commands
4154

4255
Please refer to this section for the details.
4356

44-
**Stop Commands**
57+
## Stop Commands
4558

4659
Related command `G4`
4760

48-
## **Pneumatic module control commands**
61+
## Pneumatic module control commands
4962

5063
- M1000(0D0A) - air pump box to pump in
5164
- M1001(0D0A) - air pump box to pump out
@@ -55,17 +68,13 @@ Related command `G4`
5568

5669
Attention: the commands for the soft gripper and the suction cup is opposite. When air pump box pump in, suction cup will pick the item while the soft gripper will release the item. When air pump box pump out, suction cup will release the item while the soft gripper will grab the item.
5770

58-
**Laser module control commands**
71+
## Laser module control commands
5972

6073
- M3 - initiate laser, set duty cycle. Parameters:
61-
- S - duty cycle, arrange 0-255
62-
63-
Sample
64-
65-
74+
- S - duty cycle, arrange 0-255
75+
- M5 - stop laser
6676

77+
Sample: engrave under the maxium power
6778
```
68-
;engrave under the maxium powerM3 S255
69-
```
70-
71-
- M5 - stop laser
79+
M3 S255
80+
```

‎pydexarm/example.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from pydexarm import Dexarm
22

33
'''windows'''
4-
dexarm = Dexarm("COM67")
4+
dexarm = Dexarm(port="COM67")
55
'''mac & linux'''
6-
#device = Dexarm("/dev/tty.usbmodem3086337A34381")
6+
# device = Dexarm(port="/dev/tty.usbmodem3086337A34381")
77

88
dexarm.go_home()
99

@@ -15,4 +15,5 @@
1515
dexarm.move_to(-50, 300, -50)
1616
dexarm.air_picker_place()
1717

18-
dexarm.go_home()
18+
dexarm.go_home()
19+
dexarm.close()

0 commit comments

Comments
 (0)