You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo run --bin=scan -- --serialport=/dev/ttyUSB0 --baudrate=1000000 --protocol=v1
81
+
```
82
+
75
83
## Documentation
76
84
77
85
See https://docs.rs/rustypot for more information on APIs and examples.
@@ -88,7 +96,7 @@ To build them locally, you can use [maturin](https://www.maturin.rs).
88
96
maturin build --release --features python
89
97
```
90
98
91
-
or, if you want to install them in your local python environment:
99
+
or, if you want to install them in your local python environment:
92
100
93
101
```bash
94
102
maturin develop --release --features python
@@ -108,4 +116,4 @@ This library is licensed under the [Apache License 2.0](./LICENSE).
108
116
## Support
109
117
110
118
Rustypot is developed and maintained by [Pollen-Robotics](https://pollen-robotics.com). They developed open-source hardware and tools for robotics.
111
-
Visit https://pollen-robotics.com to learn more or join the [Discord community](https://discord.com/invite/Kg3mZHTKgs) if you have any questions or want to share your projects.
119
+
Visit https://pollen-robotics.com to learn more or join the [Discord community](https://discord.com/invite/Kg3mZHTKgs) if you have any questions or want to share your projects.
The Python bindings exposes the same API as the Controller API in the rust crate.
21
+
The Python bindings exposes the same API as the Controller API in the rust crate.
22
22
23
23
You first need to create a Controller object. For instance, to communicate with a serial port to Feetech STS3215 motors, you can do the following:
24
24
@@ -28,17 +28,34 @@ from rustypot.servo import Sts3215SyncController
28
28
c = Sts3215SyncController(serial_port='/dev/ttyUSB0', baudrate=100000, timeout=0.1)
29
29
```
30
30
31
-
Then, you can directly read/write any register of the motor. For instance, to read the present position of the motors with id 1 and 2, you can do:
31
+
32
+
Then, you can directly read/write any register of the motor. For instance, to read the present position of the motor with id 1, you can do:
33
+
34
+
```python
35
+
36
+
pos = c.read_present_position(1)
37
+
print(pos)
38
+
```
39
+
40
+
You can also write to the motors. For instance, to set the goal position of the motors with id 1 to 90° you can do:
32
41
33
42
```python
43
+
import numpy as np
44
+
c.write_goal_position(1, np.deg2rad(90.0))
45
+
```
46
+
47
+
48
+
Then, you can also sync_read any registers on multiple motors in a single operations. For instance, to read the present position of the motors with id 1 and 2, you can do:
34
49
35
-
pos = c.read_present_position([1, 2])
50
+
```python
51
+
52
+
pos = c.sync_read_present_position([1, 2])
36
53
print(pos)
37
54
```
38
55
39
-
You can also write to the motors. For instance, to set the goal position of the motors with id 1 and 2 to 0.0 and 90° respectively, you can do:
56
+
Same with sync_write. For instance, to set the goal position of the motors with id 1 and 2 to 0.0 and 90° respectively, you can do:
0 commit comments