Переглянути джерело

added homing and startPoint logic

still messy, some variables in turns, others in steps and others in
degrees...
Etienne Landon 7 роки тому
батько
коміт
dbc0eb3f69
2 змінених файлів з 141 додано та 50 видалено
  1. 2 2
      OSCstepperCtl.pd
  2. 139 48
      kostepper.pd

+ 2 - 2
OSCstepperCtl.pd

@@ -7,7 +7,7 @@
 #X msg 590 173 devices;
 #X obj 112 299 s /fromOSC;
 #X obj 122 49 r /toOSC;
-#X obj 368 52 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
+#X obj 368 52 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
 1;
 #X obj 368 72 route 0 1;
 #X msg 368 134 close;
@@ -51,7 +51,7 @@
 #X msg 204 505 \$1;
 #X obj 204 527 == 3;
 #X msg 67 429 /home;
-#N canvas 221 565 1323 428 syncControl 1;
+#N canvas 221 565 792 428 syncControl 0;
 #X floatatom 42 238 5 0 0 0 - - -, f 5;
 #X floatatom 218 245 5 0 0 0 - - -, f 5;
 #X obj 23 19 unauthorized/grid grid1 200 -2 2 200 -2 2 1 0.01 0.01

+ 139 - 48
kostepper.pd

@@ -3,17 +3,18 @@
 0;
 #X obj 85 277 cnv 15 130 100 empty empty MANUEL 2 8 0 14 -233017 -128992
 0;
-#X obj 220 172 cnv 15 180 100 empty empty Move 2 8 0 14 -233017 -128992
+#X obj 220 172 cnv 15 180 150 empty empty Move 2 8 0 14 -233017 -128992
 0;
 #X obj 103 19 r /fromOSC;
-#X floatatom 140 195 10 0 0 0 - - -, f 10;
-#X floatatom 141 213 10 0 0 0 - - -, f 10;
-#X floatatom 141 231 10 0 0 0 - - -, f 10;
-#X floatatom 141 249 10 0 0 0 - - -, f 10;
-#X text 94 194 current;
-#X text 101 213 target;
-#X text 107 231 speed;
-#X text 89 249 maxspeed;
+#X floatatom 134 195 10 0 0 0 - /stepper/#1/pos/current /stepper/#1/pos/current
+, f 10;
+#X floatatom 135 213 10 0 0 0 - - -, f 10;
+#X floatatom 135 231 10 0 0 0 - - -, f 10;
+#X floatatom 135 249 10 0 0 0 - - -, f 10;
+#X text 88 194 current;
+#X text 95 213 target;
+#X text 101 231 speed;
+#X text 83 249 maxspeed;
 #X obj 148 64 print stepper\$1;
 #N canvas 1 55 450 300 filter\$1 0;
 #X obj 60 41 t a a;
@@ -55,28 +56,28 @@
 #X connect 11 0 6 0;
 #X restore 103 106 pd conversion;
 #X obj 103 84 route /status /onTarget;
-#X obj 224 250 bng 15 250 50 0 empty empty done 17 7 0 10 -262144 -1
+#X obj 327 304 bng 15 250 50 0 empty empty done 17 7 0 10 -262144 -1
 -1;
 #X obj 180 282 vsl 12 60 0 2 0 0 /stepper/\$1/manualSpeed /stepper/\$1/manualSpeed
-speed -10 70 0 10 -262144 -1 -1 797 1;
+speed -10 70 0 10 -262144 -1 -1 0 1;
 #X obj 105 344 hradio 15 1 0 2 /stepper/\$1/manualDirection /stepper/\$1/manualDirection
 direction -10 22 0 10 -262144 -1 -1 0;
-#X obj 225 222 bng 25 250 50 0 /stepper/\$1/move/go /stepper/\$1/move/go
+#X obj 328 276 bng 25 250 50 0 /stepper/\$1/move/go /stepper/\$1/move/go
 GO 6 13 0 10 -4034 -1 -1;
-#X obj 297 281 tof/menubutton 100 25 \$0-mbS \$0-mbR 1 grey90 black
+#X obj 304 846 tof/menubutton 100 25 \$0-mbS \$0-mbR 1 grey90 black
 grey95 black 0 \, none \, test (autre copie).move \, test.move \, test (3e copie).move
 \, test (4e copie).move \, test (copie).move;
-#X obj 488 204 list prepend add;
-#X obj 488 225 list trim;
-#X obj 484 104 ofGetPatchDirectory;
-#X obj 484 79 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
--1;
-#X text 505 79 get the list of file names in a directory.;
-#X msg 485 152 symbol \$1/moves;
-#X symbolatom 484 125 50 0 0 0 - - -, f 50;
-#X obj 811 100 print;
-#X obj 493 182 ofGetDirectoryFileNames move;
-#N canvas 1 55 450 300 \$0-osc 0;
+#X obj 1412 397 list prepend add;
+#X obj 1412 418 list trim;
+#X obj 1408 297 ofGetPatchDirectory;
+#X obj 1408 222 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+-1 -1;
+#X text 1429 222 get the list of file names in a directory.;
+#X msg 1409 345 symbol \$1/moves;
+#X symbolatom 1408 318 50 0 0 0 - - -, f 50;
+#X obj 1735 293 print;
+#X obj 1417 375 ofGetDirectoryFileNames move;
+#N canvas 448 266 906 607 \$0-osc 0;
 #X obj 47 13 kollabs/osc_bi \$2 /stepper/\$1/driveMode;
 #X obj 47 103 kollabs/osc_bi \$2 /stepper/\$1/move;
 #X obj 47 123 kollabs/osc_bi \$2 /stepper/\$1/moveTo;
@@ -86,6 +87,9 @@ grey95 black 0 \, none \, test (autre copie).move \, test.move \, test (3e copie
 #X obj 47 33 kollabs/osc_bi \$2 /stepper/\$1/accMode;
 #X obj 47 53 kollabs/osc_bi \$2 /stepper/\$1/manualDrive;
 #X obj 47 -6 kollabs/osc_bi \$2 /stepper/\$1/updateStatus;
+#X obj 47 263 kollabs/osc_bi \$2 /stepper/\$1/sequences/list;
+#X obj 47 313 kollabs/osc_bi \$2 /stepper/\$1/pos/current;
+#X obj 47 333 kollabs/osc_bi \$2 /stepper/\$1/pos/current/deg;
 #X restore 1404 48 pd \$0-osc;
 #X obj 952 251 route 0 1;
 #X obj 952 207 r /stepper/\$1/manualDrive;
@@ -127,8 +131,8 @@ empty 17 7 0 10 -204800 -33289 -1 0 1;
 #X obj 772 634 print;
 #X obj 909 317 == 0;
 #X msg 89 647 driveMode \$1 \, setSpeed 0;
-#X obj 224 203 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/move /stepper/\$1/move
-tours 0 -8 0 10 -262144 -1 -1 0.05 256;
+#X obj 224 303 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/move /stepper/\$1/move
+tours 0 -8 0 10 -262144 -1 -1 0 256;
 #X obj 693 742 list;
 #X msg 690 704 move \$2 \$1 \, setSpeed \$3 \$1 \, getStatus \$1 \$1
 ;
@@ -144,17 +148,16 @@ tours 0 -8 0 10 -262144 -1 -1 0.05 256;
 #X obj 694 454 steps2camrot;
 #X obj 748 526 steps2camrot;
 #X obj 168 359 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/manualSpeed /stepper/\$1/manualSpeed
-empty 0 -8 0 10 -262144 -1 -1 0.2701 256;
+empty 0 -8 0 10 -262144 -1 -1 0 256;
 #X obj 295 177 vsl 12 60 0 2 0 0 /stepper/\$1/setMaxSpeed /stepper/\$1/setMaxSpeed
-speed -10 70 0 10 -262144 -1 -1 29 1;
+speed -10 70 0 10 -262144 -1 -1 0 1;
 #X obj 283 254 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/setMaxSpeed /stepper/\$1/setMaxSpeed
-empty 0 -8 0 10 -262144 -1 -1 0.01 256;
+empty 0 -8 0 10 -262144 -1 -1 0 256;
 #X obj 345 177 vsl 12 60 0 2 0 0 /stepper/\$1/acceleration /stepper/\$1/acceleration
-acc -2 70 0 10 -262144 -1 -1 5000 1;
+acc -2 70 0 10 -262144 -1 -1 0 1;
 #X obj 333 254 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/acceleration
-/stepper/\$1/acceleration empty 0 -8 0 10 -262144 -1 -1 1.69492 256
-;
-#X obj 220 277 cnv 15 180 100 empty empty presets 2 8 0 14 -233017
+/stepper/\$1/acceleration empty 0 -8 0 10 -262144 -1 -1 0 256;
+#X obj 227 842 cnv 15 180 100 empty empty presets 2 8 0 14 -233017
 -128992 0;
 #X obj 320 55 r /stepper/\$1/accMode;
 #X obj 320 76 route 0 1;
@@ -167,7 +170,7 @@ refresh -45 8 0 10 -262144 -1 -1;
 #X msg 89 491 /getStatus \$1;
 #X obj 89 512 s /toOSC;
 #X msg 219 106 color 10 10 20;
-#X obj 252 222 tgl 25 0 empty empty empty 17 7 0 10 -233017 -233017
+#X obj 355 276 tgl 25 0 empty empty empty 17 7 0 10 -233017 -233017
 -195568 0 1;
 #X msg 228 123 color 14 14 14;
 #X text 1353 123 prise en compte du homing;
@@ -175,7 +178,6 @@ refresh -45 8 0 10 -262144 -1 -1;
 360° modulo;
 #X text 1387 155 -> utilisation facultative du point de départ d'un
 move;
-#X msg 454 256 clear \, align 0 \, add none \, set 0;
 #X obj 693 788 s /toOSC;
 #X msg 693 766 /\$1 \$3 \$2;
 #X obj 651 414 r /stepper/\$1/move/go;
@@ -186,10 +188,61 @@ move;
 #X msg 428 341 /stop \$1;
 #X msg 659 673 acceleration \$4 \$1 \, maxSpeed \$3 \$1 \, move \$2
 \$1 \, getStatus \$1 \$1;
+#X obj 1408 242 t b b;
+#X obj 1413 476 s /stepper/\$1/sequences/list;
+#X obj 423 817 r /stepper/\$1/sequences/list;
+#X obj 640 52 stepperCue \$1 0;
+#X msg 1436 270 clear \, align 0 \, add none \, set 0;
+#X obj 640 152 stepperCue \$1 1;
+#X obj 83 127 s /stepper/\$1/pos/current;
+#X obj 1156 573 r /stepper/\$1/pos/current;
+#X obj 1156 594 * 360;
+#X obj 1156 615 mod 360;
+#X floatatom 1243 660 5 0 0 0 - - -, f 5;
+#X floatatom 1239 601 5 0 0 0 - - -, f 5;
+#X obj 224 213 nbx 4 14 -1e+37 1e+37 0 0 /stepper/\$1/move/startPos
+/stepper/\$1/move/startPos startPos 0 -8 0 10 -262144 -1 -1 350 256
+;
+#X obj 225 232 bng 15 250 50 0 /stepper/\$1/move/gotoStart /stepper/\$1/move/gotoStart
+goto 17 7 0 10 -262144 -1 -1;
+#X obj 225 252 bng 15 250 50 0 /stepper/\$1/move/setStart /stepper/\$1/move/setStart
+set 17 7 0 10 -262144 -1 -1;
+#X obj 1131 655 f;
+#X obj 1131 547 r /stepper/\$1/move/setStart;
+#X obj 1107 746 r /stepper/\$1/move/gotoStart;
+#X obj 1131 697 s /stepper/\$1/move/startPos;
+#X obj 1444 586 r /stepper/\$1/move/startPos;
+#X obj 1422 633 -;
+#X obj 1444 606 t b f;
+#X text 1452 634 distance currentPos->startPos;
+#X obj 1324 683 moses 180;
+#X obj 1273 820 steps2camrot;
+#X obj 1384 704 - 360;
+#X text 1578 726 go backward \, quickest path;
+#X floatatom 1416 789 5 0 0 0 - - -, f 5;
+#X floatatom 1502 653 5 0 0 0 - - -, f 5;
+#X obj 1152 932 list;
+#X obj 1152 978 s /toOSC;
+#X msg 1152 956 /\$1 \$3 \$2;
+#X obj 1127 792 f \$1;
+#X obj 1324 768 / 360;
+#X obj 1134 853 pack 0 0 8000 0;
+#X msg 1140 889 driveMode 1 \$1 \, move \$2 \$1 \, setSpeed \$3 \$1
+\, getStatus \$1 \$1;
+#X obj 1156 638 s /stepper/\$1/pos/current/deg;
+#X obj 1418 565 r /stepper/\$1/pos/current/deg;
+#X obj 1354 662 abs;
+#X obj 198 195 nbx 3 14 -1e+37 1e+37 0 0 /stepper/\$1/pos/current/deg
+/stepper/\$1/pos/current/deg empty 0 -8 0 10 -262144 -1 -1 10 256;
+#X obj 1420 653 t f f;
+#X obj 1447 678 moses 0;
+#X floatatom 1324 789 5 0 0 0 - - -, f 5;
+#X msg 1447 699 360;
+#X msg 1477 698 -360;
 #X connect 3 0 13 0;
 #X connect 13 0 12 0;
 #X connect 13 0 15 0;
-#X connect 14 1 4 0;
+#X connect 14 1 118 0;
 #X connect 14 2 5 0;
 #X connect 14 3 6 0;
 #X connect 14 4 7 0;
@@ -198,10 +251,10 @@ move;
 #X connect 16 0 98 0;
 #X connect 19 0 100 0;
 #X connect 21 0 22 0;
-#X connect 22 0 20 0;
+#X connect 22 0 113 0;
 #X connect 23 0 26 0;
 #X connect 23 0 27 0;
-#X connect 24 0 23 0;
+#X connect 24 0 112 0;
 #X connect 26 0 29 0;
 #X connect 29 0 21 0;
 #X connect 29 0 28 0;
@@ -231,7 +284,7 @@ move;
 #X connect 58 0 82 1;
 #X connect 59 0 58 0;
 #X connect 60 0 46 0;
-#X connect 61 0 112 0;
+#X connect 61 0 111 0;
 #X connect 61 1 71 0;
 #X connect 62 0 65 0;
 #X connect 63 0 64 0;
@@ -239,7 +292,7 @@ move;
 #X connect 65 0 47 0;
 #X connect 67 0 35 0;
 #X connect 68 0 47 0;
-#X connect 70 0 106 0;
+#X connect 70 0 105 0;
 #X connect 71 0 70 0;
 #X connect 73 0 56 0;
 #X connect 74 0 73 0;
@@ -263,13 +316,51 @@ move;
 #X connect 96 0 97 0;
 #X connect 98 0 99 0;
 #X connect 100 0 99 0;
-#X connect 104 0 20 0;
-#X connect 106 0 105 0;
-#X connect 107 0 55 0;
-#X connect 108 0 98 0;
-#X connect 108 0 41 0;
+#X connect 105 0 104 0;
+#X connect 106 0 55 0;
+#X connect 107 0 98 0;
+#X connect 107 0 41 0;
+#X connect 108 0 109 0;
 #X connect 109 0 110 0;
-#X connect 110 0 111 0;
-#X connect 111 0 50 0;
-#X connect 112 0 70 0;
+#X connect 110 0 50 0;
+#X connect 111 0 70 0;
+#X connect 112 0 23 0;
+#X connect 112 1 116 0;
+#X connect 114 0 20 0;
+#X connect 116 0 113 0;
+#X connect 119 0 120 0;
+#X connect 120 0 121 0;
+#X connect 120 0 123 0;
+#X connect 121 0 122 0;
+#X connect 121 0 127 1;
+#X connect 121 0 148 0;
+#X connect 127 0 130 0;
+#X connect 128 0 127 0;
+#X connect 129 0 144 0;
+#X connect 131 0 133 0;
+#X connect 132 0 140 0;
+#X connect 132 0 152 0;
+#X connect 133 0 132 0;
+#X connect 133 1 132 1;
+#X connect 135 0 145 0;
+#X connect 135 0 139 0;
+#X connect 135 1 137 0;
+#X connect 136 0 146 1;
+#X connect 137 0 145 0;
+#X connect 137 0 139 0;
+#X connect 141 0 143 0;
+#X connect 143 0 142 0;
+#X connect 144 0 146 0;
+#X connect 145 0 154 0;
+#X connect 145 0 136 1;
+#X connect 146 0 147 0;
+#X connect 147 0 141 0;
+#X connect 149 0 132 0;
+#X connect 150 0 135 0;
+#X connect 152 0 150 0;
+#X connect 152 1 153 0;
+#X connect 153 0 155 0;
+#X connect 153 1 156 0;
+#X connect 155 0 145 1;
+#X connect 156 0 145 1;
 #X coords 0 -1 1 1 325 230 1 80 150;