can-motor-control 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- can_motor_control-0.1.0/Cargo.lock +484 -0
- can_motor_control-0.1.0/Cargo.toml +29 -0
- can_motor_control-0.1.0/PKG-INFO +14 -0
- can_motor_control-0.1.0/crates/can-motor-control/Cargo.toml +25 -0
- can_motor_control-0.1.0/crates/can-motor-control/examples/00_can_interface_check.rs +111 -0
- can_motor_control-0.1.0/crates/can-motor-control/examples/01_single_motor_enable_disable.rs +265 -0
- can_motor_control-0.1.0/crates/can-motor-control/examples/03_single_motor_mit_hold.rs +281 -0
- can_motor_control-0.1.0/crates/can-motor-control/examples/05_gripper_control.rs +464 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/bus.rs +155 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/config.rs +223 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/error.rs +106 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/group.rs +878 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/lib.rs +37 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/motor.rs +189 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/robot.rs +742 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/spec.rs +44 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/transport/mock.rs +237 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/transport/mod.rs +96 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/transport/poller.rs +122 -0
- can_motor_control-0.1.0/crates/can-motor-control/src/transport/socketcan.rs +587 -0
- can_motor_control-0.1.0/crates/can-motor-control/tests/config_loader.rs +206 -0
- can_motor_control-0.1.0/crates/can-motor-control/tests/integration_single_arm.rs +57 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/Cargo.toml +23 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/codec.rs +99 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/errors.rs +28 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/frame.rs +86 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/lib.rs +90 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/robot.rs +991 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/spec.rs +45 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/src/transport.rs +93 -0
- can_motor_control-0.1.0/crates/can-motor-control-py/uv.lock +818 -0
- can_motor_control-0.1.0/crates/damiao-codec/Cargo.toml +18 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/bitpack.rs +186 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/codec.rs +578 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/ext.rs +155 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/lib.rs +26 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/limits.rs +101 -0
- can_motor_control-0.1.0/crates/damiao-codec/src/types.rs +186 -0
- can_motor_control-0.1.0/crates/motor-codec/Cargo.toml +19 -0
- can_motor_control-0.1.0/crates/motor-codec/src/caps.rs +50 -0
- can_motor_control-0.1.0/crates/motor-codec/src/codec.rs +216 -0
- can_motor_control-0.1.0/crates/motor-codec/src/command.rs +114 -0
- can_motor_control-0.1.0/crates/motor-codec/src/event.rs +91 -0
- can_motor_control-0.1.0/crates/motor-codec/src/frame.rs +248 -0
- can_motor_control-0.1.0/crates/motor-codec/src/lib.rs +36 -0
- can_motor_control-0.1.0/crates/motor-codec/src/motor.rs +81 -0
- can_motor_control-0.1.0/pyproject.toml +31 -0
- can_motor_control-0.1.0/python/can_motor_control/__init__.py +41 -0
- can_motor_control-0.1.0/python/can_motor_control/__init__.pyi +115 -0
- can_motor_control-0.1.0/python/can_motor_control/damiao.py +5 -0
- can_motor_control-0.1.0/python/can_motor_control/damiao.pyi +23 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "bitflags"
|
|
13
|
+
version = "2.12.1"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "84d7ced0ae9557296835c32bf1b1e02b44c746701f898460fb000d7eaa84f00a"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "can-motor-codec"
|
|
19
|
+
version = "0.1.0"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"bitflags",
|
|
22
|
+
"thiserror",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[[package]]
|
|
26
|
+
name = "can-motor-control"
|
|
27
|
+
version = "0.1.0"
|
|
28
|
+
dependencies = [
|
|
29
|
+
"can-motor-codec",
|
|
30
|
+
"can-motor-damiao-codec",
|
|
31
|
+
"libc",
|
|
32
|
+
"log",
|
|
33
|
+
"mio",
|
|
34
|
+
"serde",
|
|
35
|
+
"thiserror",
|
|
36
|
+
"toml",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[[package]]
|
|
40
|
+
name = "can-motor-control-py"
|
|
41
|
+
version = "0.1.0"
|
|
42
|
+
dependencies = [
|
|
43
|
+
"can-motor-codec",
|
|
44
|
+
"can-motor-control",
|
|
45
|
+
"can-motor-damiao-codec",
|
|
46
|
+
"log",
|
|
47
|
+
"numpy",
|
|
48
|
+
"pyo3",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[[package]]
|
|
52
|
+
name = "can-motor-damiao-codec"
|
|
53
|
+
version = "0.1.0"
|
|
54
|
+
dependencies = [
|
|
55
|
+
"can-motor-codec",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[[package]]
|
|
59
|
+
name = "cfg-if"
|
|
60
|
+
version = "1.0.4"
|
|
61
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
62
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
63
|
+
|
|
64
|
+
[[package]]
|
|
65
|
+
name = "equivalent"
|
|
66
|
+
version = "1.0.2"
|
|
67
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
68
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
69
|
+
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "hashbrown"
|
|
72
|
+
version = "0.17.1"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
75
|
+
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "heck"
|
|
78
|
+
version = "0.5.0"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "indexmap"
|
|
84
|
+
version = "2.14.0"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"equivalent",
|
|
89
|
+
"hashbrown",
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
[[package]]
|
|
93
|
+
name = "indoc"
|
|
94
|
+
version = "2.0.7"
|
|
95
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
96
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
97
|
+
dependencies = [
|
|
98
|
+
"rustversion",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
[[package]]
|
|
102
|
+
name = "libc"
|
|
103
|
+
version = "0.2.186"
|
|
104
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
105
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
106
|
+
|
|
107
|
+
[[package]]
|
|
108
|
+
name = "log"
|
|
109
|
+
version = "0.4.31"
|
|
110
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111
|
+
checksum = "113b30b4cd05f7c06868fdb2854f66a7b9fece9a48425351cd532e810d74024f"
|
|
112
|
+
|
|
113
|
+
[[package]]
|
|
114
|
+
name = "matrixmultiply"
|
|
115
|
+
version = "0.3.10"
|
|
116
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
117
|
+
checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08"
|
|
118
|
+
dependencies = [
|
|
119
|
+
"autocfg",
|
|
120
|
+
"rawpointer",
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
[[package]]
|
|
124
|
+
name = "memchr"
|
|
125
|
+
version = "2.8.1"
|
|
126
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
127
|
+
checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
|
|
128
|
+
|
|
129
|
+
[[package]]
|
|
130
|
+
name = "memoffset"
|
|
131
|
+
version = "0.9.1"
|
|
132
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
133
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
134
|
+
dependencies = [
|
|
135
|
+
"autocfg",
|
|
136
|
+
]
|
|
137
|
+
|
|
138
|
+
[[package]]
|
|
139
|
+
name = "mio"
|
|
140
|
+
version = "1.2.1"
|
|
141
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
142
|
+
checksum = "02bd0af71c67b473010cbbc60715ee815645a4dc942899111f494b4b737d6fda"
|
|
143
|
+
dependencies = [
|
|
144
|
+
"libc",
|
|
145
|
+
"log",
|
|
146
|
+
"wasi",
|
|
147
|
+
"windows-sys",
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
[[package]]
|
|
151
|
+
name = "ndarray"
|
|
152
|
+
version = "0.16.1"
|
|
153
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
154
|
+
checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841"
|
|
155
|
+
dependencies = [
|
|
156
|
+
"matrixmultiply",
|
|
157
|
+
"num-complex",
|
|
158
|
+
"num-integer",
|
|
159
|
+
"num-traits",
|
|
160
|
+
"portable-atomic",
|
|
161
|
+
"portable-atomic-util",
|
|
162
|
+
"rawpointer",
|
|
163
|
+
]
|
|
164
|
+
|
|
165
|
+
[[package]]
|
|
166
|
+
name = "num-complex"
|
|
167
|
+
version = "0.4.6"
|
|
168
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
169
|
+
checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495"
|
|
170
|
+
dependencies = [
|
|
171
|
+
"num-traits",
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "num-integer"
|
|
176
|
+
version = "0.1.46"
|
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
178
|
+
checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
|
|
179
|
+
dependencies = [
|
|
180
|
+
"num-traits",
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
[[package]]
|
|
184
|
+
name = "num-traits"
|
|
185
|
+
version = "0.2.19"
|
|
186
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
187
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
188
|
+
dependencies = [
|
|
189
|
+
"autocfg",
|
|
190
|
+
]
|
|
191
|
+
|
|
192
|
+
[[package]]
|
|
193
|
+
name = "numpy"
|
|
194
|
+
version = "0.22.1"
|
|
195
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
196
|
+
checksum = "edb929bc0da91a4d85ed6c0a84deaa53d411abfb387fc271124f91bf6b89f14e"
|
|
197
|
+
dependencies = [
|
|
198
|
+
"libc",
|
|
199
|
+
"ndarray",
|
|
200
|
+
"num-complex",
|
|
201
|
+
"num-integer",
|
|
202
|
+
"num-traits",
|
|
203
|
+
"pyo3",
|
|
204
|
+
"rustc-hash",
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
[[package]]
|
|
208
|
+
name = "once_cell"
|
|
209
|
+
version = "1.21.4"
|
|
210
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
211
|
+
checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
212
|
+
|
|
213
|
+
[[package]]
|
|
214
|
+
name = "portable-atomic"
|
|
215
|
+
version = "1.13.1"
|
|
216
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
218
|
+
|
|
219
|
+
[[package]]
|
|
220
|
+
name = "portable-atomic-util"
|
|
221
|
+
version = "0.2.7"
|
|
222
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
+
checksum = "c2a106d1259c23fac8e543272398ae0e3c0b8d33c88ed73d0cc71b0f1d902618"
|
|
224
|
+
dependencies = [
|
|
225
|
+
"portable-atomic",
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
[[package]]
|
|
229
|
+
name = "proc-macro2"
|
|
230
|
+
version = "1.0.106"
|
|
231
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
232
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
233
|
+
dependencies = [
|
|
234
|
+
"unicode-ident",
|
|
235
|
+
]
|
|
236
|
+
|
|
237
|
+
[[package]]
|
|
238
|
+
name = "pyo3"
|
|
239
|
+
version = "0.22.6"
|
|
240
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
241
|
+
checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
|
|
242
|
+
dependencies = [
|
|
243
|
+
"cfg-if",
|
|
244
|
+
"indoc",
|
|
245
|
+
"libc",
|
|
246
|
+
"memoffset",
|
|
247
|
+
"once_cell",
|
|
248
|
+
"portable-atomic",
|
|
249
|
+
"pyo3-build-config",
|
|
250
|
+
"pyo3-ffi",
|
|
251
|
+
"pyo3-macros",
|
|
252
|
+
"unindent",
|
|
253
|
+
]
|
|
254
|
+
|
|
255
|
+
[[package]]
|
|
256
|
+
name = "pyo3-build-config"
|
|
257
|
+
version = "0.22.6"
|
|
258
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
259
|
+
checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
|
|
260
|
+
dependencies = [
|
|
261
|
+
"once_cell",
|
|
262
|
+
"target-lexicon",
|
|
263
|
+
]
|
|
264
|
+
|
|
265
|
+
[[package]]
|
|
266
|
+
name = "pyo3-ffi"
|
|
267
|
+
version = "0.22.6"
|
|
268
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
269
|
+
checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
|
|
270
|
+
dependencies = [
|
|
271
|
+
"libc",
|
|
272
|
+
"pyo3-build-config",
|
|
273
|
+
]
|
|
274
|
+
|
|
275
|
+
[[package]]
|
|
276
|
+
name = "pyo3-macros"
|
|
277
|
+
version = "0.22.6"
|
|
278
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
279
|
+
checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
|
|
280
|
+
dependencies = [
|
|
281
|
+
"proc-macro2",
|
|
282
|
+
"pyo3-macros-backend",
|
|
283
|
+
"quote",
|
|
284
|
+
"syn",
|
|
285
|
+
]
|
|
286
|
+
|
|
287
|
+
[[package]]
|
|
288
|
+
name = "pyo3-macros-backend"
|
|
289
|
+
version = "0.22.6"
|
|
290
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
291
|
+
checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
|
|
292
|
+
dependencies = [
|
|
293
|
+
"heck",
|
|
294
|
+
"proc-macro2",
|
|
295
|
+
"pyo3-build-config",
|
|
296
|
+
"quote",
|
|
297
|
+
"syn",
|
|
298
|
+
]
|
|
299
|
+
|
|
300
|
+
[[package]]
|
|
301
|
+
name = "quote"
|
|
302
|
+
version = "1.0.45"
|
|
303
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
304
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
305
|
+
dependencies = [
|
|
306
|
+
"proc-macro2",
|
|
307
|
+
]
|
|
308
|
+
|
|
309
|
+
[[package]]
|
|
310
|
+
name = "rawpointer"
|
|
311
|
+
version = "0.2.1"
|
|
312
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
313
|
+
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
|
314
|
+
|
|
315
|
+
[[package]]
|
|
316
|
+
name = "rustc-hash"
|
|
317
|
+
version = "1.1.0"
|
|
318
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
319
|
+
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
320
|
+
|
|
321
|
+
[[package]]
|
|
322
|
+
name = "rustversion"
|
|
323
|
+
version = "1.0.22"
|
|
324
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
325
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
326
|
+
|
|
327
|
+
[[package]]
|
|
328
|
+
name = "serde"
|
|
329
|
+
version = "1.0.228"
|
|
330
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
331
|
+
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
|
332
|
+
dependencies = [
|
|
333
|
+
"serde_core",
|
|
334
|
+
"serde_derive",
|
|
335
|
+
]
|
|
336
|
+
|
|
337
|
+
[[package]]
|
|
338
|
+
name = "serde_core"
|
|
339
|
+
version = "1.0.228"
|
|
340
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
341
|
+
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
|
342
|
+
dependencies = [
|
|
343
|
+
"serde_derive",
|
|
344
|
+
]
|
|
345
|
+
|
|
346
|
+
[[package]]
|
|
347
|
+
name = "serde_derive"
|
|
348
|
+
version = "1.0.228"
|
|
349
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
350
|
+
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|
351
|
+
dependencies = [
|
|
352
|
+
"proc-macro2",
|
|
353
|
+
"quote",
|
|
354
|
+
"syn",
|
|
355
|
+
]
|
|
356
|
+
|
|
357
|
+
[[package]]
|
|
358
|
+
name = "serde_spanned"
|
|
359
|
+
version = "0.6.9"
|
|
360
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
361
|
+
checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"
|
|
362
|
+
dependencies = [
|
|
363
|
+
"serde",
|
|
364
|
+
]
|
|
365
|
+
|
|
366
|
+
[[package]]
|
|
367
|
+
name = "syn"
|
|
368
|
+
version = "2.0.117"
|
|
369
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
370
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
371
|
+
dependencies = [
|
|
372
|
+
"proc-macro2",
|
|
373
|
+
"quote",
|
|
374
|
+
"unicode-ident",
|
|
375
|
+
]
|
|
376
|
+
|
|
377
|
+
[[package]]
|
|
378
|
+
name = "target-lexicon"
|
|
379
|
+
version = "0.12.16"
|
|
380
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
381
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
382
|
+
|
|
383
|
+
[[package]]
|
|
384
|
+
name = "thiserror"
|
|
385
|
+
version = "2.0.18"
|
|
386
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
387
|
+
checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"
|
|
388
|
+
dependencies = [
|
|
389
|
+
"thiserror-impl",
|
|
390
|
+
]
|
|
391
|
+
|
|
392
|
+
[[package]]
|
|
393
|
+
name = "thiserror-impl"
|
|
394
|
+
version = "2.0.18"
|
|
395
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
396
|
+
checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"
|
|
397
|
+
dependencies = [
|
|
398
|
+
"proc-macro2",
|
|
399
|
+
"quote",
|
|
400
|
+
"syn",
|
|
401
|
+
]
|
|
402
|
+
|
|
403
|
+
[[package]]
|
|
404
|
+
name = "toml"
|
|
405
|
+
version = "0.8.23"
|
|
406
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
407
|
+
checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"
|
|
408
|
+
dependencies = [
|
|
409
|
+
"serde",
|
|
410
|
+
"serde_spanned",
|
|
411
|
+
"toml_datetime",
|
|
412
|
+
"toml_edit",
|
|
413
|
+
]
|
|
414
|
+
|
|
415
|
+
[[package]]
|
|
416
|
+
name = "toml_datetime"
|
|
417
|
+
version = "0.6.11"
|
|
418
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
419
|
+
checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"
|
|
420
|
+
dependencies = [
|
|
421
|
+
"serde",
|
|
422
|
+
]
|
|
423
|
+
|
|
424
|
+
[[package]]
|
|
425
|
+
name = "toml_edit"
|
|
426
|
+
version = "0.22.27"
|
|
427
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
428
|
+
checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"
|
|
429
|
+
dependencies = [
|
|
430
|
+
"indexmap",
|
|
431
|
+
"serde",
|
|
432
|
+
"serde_spanned",
|
|
433
|
+
"toml_datetime",
|
|
434
|
+
"toml_write",
|
|
435
|
+
"winnow",
|
|
436
|
+
]
|
|
437
|
+
|
|
438
|
+
[[package]]
|
|
439
|
+
name = "toml_write"
|
|
440
|
+
version = "0.1.2"
|
|
441
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
442
|
+
checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"
|
|
443
|
+
|
|
444
|
+
[[package]]
|
|
445
|
+
name = "unicode-ident"
|
|
446
|
+
version = "1.0.24"
|
|
447
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
448
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
449
|
+
|
|
450
|
+
[[package]]
|
|
451
|
+
name = "unindent"
|
|
452
|
+
version = "0.2.4"
|
|
453
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
454
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
455
|
+
|
|
456
|
+
[[package]]
|
|
457
|
+
name = "wasi"
|
|
458
|
+
version = "0.11.1+wasi-snapshot-preview1"
|
|
459
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
460
|
+
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
|
461
|
+
|
|
462
|
+
[[package]]
|
|
463
|
+
name = "windows-link"
|
|
464
|
+
version = "0.2.1"
|
|
465
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
466
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
|
467
|
+
|
|
468
|
+
[[package]]
|
|
469
|
+
name = "windows-sys"
|
|
470
|
+
version = "0.61.2"
|
|
471
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
472
|
+
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
|
473
|
+
dependencies = [
|
|
474
|
+
"windows-link",
|
|
475
|
+
]
|
|
476
|
+
|
|
477
|
+
[[package]]
|
|
478
|
+
name = "winnow"
|
|
479
|
+
version = "0.7.15"
|
|
480
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
481
|
+
checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945"
|
|
482
|
+
dependencies = [
|
|
483
|
+
"memchr",
|
|
484
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
resolver = "2"
|
|
3
|
+
members = ["crates/motor-codec", "crates/damiao-codec", "crates/can-motor-control", "crates/can-motor-control-py"]
|
|
4
|
+
|
|
5
|
+
[workspace.package]
|
|
6
|
+
version = "0.1.0"
|
|
7
|
+
edition = "2021"
|
|
8
|
+
rust-version = "1.85"
|
|
9
|
+
license = "Apache-2.0 OR MIT"
|
|
10
|
+
repository = "https://github.com/cc/can-motor-control"
|
|
11
|
+
|
|
12
|
+
[workspace.dependencies]
|
|
13
|
+
thiserror = { version = "2.0", default-features = false }
|
|
14
|
+
bitflags = { version = "2.6", default-features = false }
|
|
15
|
+
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
|
16
|
+
toml = "0.8"
|
|
17
|
+
mio = { version = "1.0", features = ["os-poll", "os-ext"] }
|
|
18
|
+
libc = "0.2"
|
|
19
|
+
pyo3 = { version = "0.22", features = ["extension-module", "abi3-py310"] }
|
|
20
|
+
numpy = "0.22"
|
|
21
|
+
log = "0.4"
|
|
22
|
+
|
|
23
|
+
motor-codec = { path = "crates/motor-codec", package = "can-motor-codec", version = "0.1.0", default-features = false }
|
|
24
|
+
damiao-codec = { path = "crates/damiao-codec", package = "can-motor-damiao-codec", version = "0.1.0", default-features = false }
|
|
25
|
+
can-motor-control = { path = "crates/can-motor-control", version = "0.1.0" }
|
|
26
|
+
|
|
27
|
+
[profile.release]
|
|
28
|
+
lto = "thin"
|
|
29
|
+
codegen-units = 1
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: can-motor-control
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
7
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Requires-Dist: numpy>=1.24
|
|
10
|
+
Requires-Dist: mkdocs-material>=9.5 ; extra == 'docs'
|
|
11
|
+
Requires-Dist: mkdocstrings[python]>=0.26 ; extra == 'docs'
|
|
12
|
+
Provides-Extra: docs
|
|
13
|
+
Summary: Rust-backed control library for Damiao-family CAN motors
|
|
14
|
+
Requires-Python: >=3.10
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "can-motor-control"
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
rust-version.workspace = true
|
|
6
|
+
license.workspace = true
|
|
7
|
+
repository.workspace = true
|
|
8
|
+
description = "Robot control library for Damiao-family motors over Linux SocketCAN; vendor-agnostic above the codec seam"
|
|
9
|
+
|
|
10
|
+
[features]
|
|
11
|
+
default = ["socketcan", "mock"]
|
|
12
|
+
socketcan = []
|
|
13
|
+
mock = []
|
|
14
|
+
|
|
15
|
+
[dependencies]
|
|
16
|
+
motor-codec = { workspace = true, features = ["std"] }
|
|
17
|
+
thiserror = { workspace = true, features = ["std"] }
|
|
18
|
+
serde = { workspace = true, features = ["std", "derive"] }
|
|
19
|
+
toml = { workspace = true }
|
|
20
|
+
mio = { workspace = true }
|
|
21
|
+
libc = { workspace = true }
|
|
22
|
+
log = { workspace = true }
|
|
23
|
+
|
|
24
|
+
[dev-dependencies]
|
|
25
|
+
damiao-codec = { workspace = true, features = ["std"] }
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//! Tier 0 Rust bring-up: verify a SocketCAN interface without sending frames.
|
|
2
|
+
//!
|
|
3
|
+
//! This example never opens a CAN socket and never constructs a Robot. It only
|
|
4
|
+
//! checks `/sys/class/net/<interface>` and prints the assumptions needed before
|
|
5
|
+
//! moving to hardware-affecting examples.
|
|
6
|
+
//!
|
|
7
|
+
//! Usage:
|
|
8
|
+
//!
|
|
9
|
+
//! ```bash
|
|
10
|
+
//! cargo run -p can-motor-control --example 00_can_interface_check -- --interface can0
|
|
11
|
+
//! ```
|
|
12
|
+
|
|
13
|
+
use std::env;
|
|
14
|
+
use std::io::{self, Write};
|
|
15
|
+
use std::path::Path;
|
|
16
|
+
use std::process::ExitCode;
|
|
17
|
+
|
|
18
|
+
const DEFAULT_INTERFACE: &str = "can0";
|
|
19
|
+
|
|
20
|
+
fn print_help() {
|
|
21
|
+
println!(
|
|
22
|
+
"Tier 0 Rust bring-up: verify a SocketCAN interface without sending frames.\n\
|
|
23
|
+
\n\
|
|
24
|
+
Usage:\n\
|
|
25
|
+
cargo run -p can-motor-control --example 00_can_interface_check -- [--interface <iface>]\n\
|
|
26
|
+
\n\
|
|
27
|
+
Options:\n\
|
|
28
|
+
--interface <iface> SocketCAN interface name (default: can0)\n\
|
|
29
|
+
--fd Assume a CAN-FD bus (adjusts the wire-format notes)\n\
|
|
30
|
+
-h, --help Print this help text"
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fn parse_args() -> Result<Option<(String, bool)>, String> {
|
|
35
|
+
let mut interface = DEFAULT_INTERFACE.to_string();
|
|
36
|
+
let mut fd = false;
|
|
37
|
+
let mut args = env::args().skip(1);
|
|
38
|
+
|
|
39
|
+
while let Some(arg) = args.next() {
|
|
40
|
+
match arg.as_str() {
|
|
41
|
+
"-h" | "--help" => return Ok(None),
|
|
42
|
+
"--fd" => fd = true,
|
|
43
|
+
"--interface" => {
|
|
44
|
+
interface = args
|
|
45
|
+
.next()
|
|
46
|
+
.ok_or_else(|| "--interface requires a value".to_string())?;
|
|
47
|
+
}
|
|
48
|
+
_ => return Err(format!("unknown argument: {arg}")),
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Ok(Some((interface, fd)))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
fn print_assumptions(interface: &str, fd: bool) {
|
|
56
|
+
println!("=== Rust 00 CAN interface check ===");
|
|
57
|
+
println!(" - interface : {interface}");
|
|
58
|
+
println!(" - sends CAN frames? : no -- this example never opens the bus");
|
|
59
|
+
println!(" - hardware required : none");
|
|
60
|
+
println!();
|
|
61
|
+
if fd {
|
|
62
|
+
println!(" Target is a CAN-FD bus; the interface must be FD-capable.");
|
|
63
|
+
println!(" Confirm the bus is up and `candump {interface}` shows traffic before powering motors.");
|
|
64
|
+
} else {
|
|
65
|
+
println!(" Target is classical CAN (pass --fd for a CAN-FD bus).");
|
|
66
|
+
println!(" Confirm the bus is up at the expected bitrate (commonly 1 Mbit/s)");
|
|
67
|
+
println!(" and that `candump {interface}` shows traffic before powering motors.");
|
|
68
|
+
}
|
|
69
|
+
println!("===================================");
|
|
70
|
+
let _ = io::stdout().flush();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fn main() -> ExitCode {
|
|
74
|
+
let (interface, fd) = match parse_args() {
|
|
75
|
+
Ok(Some(parsed)) => parsed,
|
|
76
|
+
Ok(None) => {
|
|
77
|
+
print_help();
|
|
78
|
+
return ExitCode::SUCCESS;
|
|
79
|
+
}
|
|
80
|
+
Err(message) => {
|
|
81
|
+
eprintln!("ERROR: {message}");
|
|
82
|
+
eprintln!("Try --help for usage.");
|
|
83
|
+
return ExitCode::from(2);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
print_assumptions(&interface, fd);
|
|
88
|
+
|
|
89
|
+
let sysfs_path = format!("/sys/class/net/{interface}");
|
|
90
|
+
if !Path::new(&sysfs_path).exists() {
|
|
91
|
+
eprintln!("\nERROR: {sysfs_path} does not exist.");
|
|
92
|
+
eprintln!(" * For a real interface, plug in the adapter and check `dmesg`.");
|
|
93
|
+
eprintln!(" * For a virtual interface, set it up with:");
|
|
94
|
+
eprintln!(" sudo ip link add dev {interface} type vcan");
|
|
95
|
+
if fd {
|
|
96
|
+
eprintln!(" sudo ip link set {interface} mtu 72 # CAN-FD frame size");
|
|
97
|
+
}
|
|
98
|
+
eprintln!(" sudo ip link set {interface} up");
|
|
99
|
+
eprintln!(" * Verify with: ip link show");
|
|
100
|
+
return ExitCode::from(2);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
println!("\nOK: {sysfs_path} is present.");
|
|
104
|
+
println!("Next manual checks (run in another terminal):");
|
|
105
|
+
println!(" ip link show {interface}");
|
|
106
|
+
println!(" candump {interface}");
|
|
107
|
+
println!("\nWhen `candump` is quiet and the interface is `UP`, proceed to:");
|
|
108
|
+
println!(" cargo run -p can-motor-control --example 01_single_motor_enable_disable -- --interface {interface}");
|
|
109
|
+
|
|
110
|
+
ExitCode::SUCCESS
|
|
111
|
+
}
|