ソースを参照

chataigne sequences

titi 5 年 前
コミット
6e34245c13

+ 27 - 11
HTequi-firmware/lib/Atm_lien/Atm_AccelStepper.cpp

@@ -115,6 +115,7 @@ void Atm_AccelStepper::action( int id ) {
       _isHoming = 0 ;
       if(last_trigger == EVT_ON_TARGET){push( connectors, ON_ONTARGET, 0, _currentStep, 0 );};
       push(connectors, ON_CHANGESTATE, 0,  state(), 0);
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       enabled = _enableReversed ? LOW : HIGH ;
       digitalWrite(_enablePin, enabled);
 
@@ -122,6 +123,7 @@ void Atm_AccelStepper::action( int id ) {
       return;
     case ENT_RUNNING:
       push(connectors, ON_CHANGESTATE, 0,  state(), 0);
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       _isHoming = 0;
       //reset limit state so that they trigger again if we're stopped on it
       // limitLow_State = 0;
@@ -136,59 +138,69 @@ void Atm_AccelStepper::action( int id ) {
       return;
     case LP_RUNNING:
       stepper_update();
+      if(stepper->speed() == 0.) {trigger(EVT_ON_TARGET);}
       return;
     case ENT_STOP:
     push(connectors, ON_CHANGESTATE, 0,  state(), 0);
+    push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       if (last_trigger == EVT_STOP) {
-        runMode = 0 ;
+        // runMode = 0 ;
         stepper->stop();
         _targetStep = stepper->targetPosition();
         push( connectors, ON_STOP, 0, 0, 0 );
       }
       if (last_trigger == EVT_EMERGENCY_STOP) {
+        stepper->setSpeed(0);
         _currentStep = stepper->currentPosition();
         _targetStep = _currentStep ;
         stepper->moveTo(_targetStep);
-        stepper->setSpeed(0);
         push( connectors, ON_STOP, 0, 1, 0 );
       }
       return;
     case LP_STOP:
       stepper_update();
-      _currentStep = stepper->currentPosition();
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
+      if(stepper->speed() == 0.) {trigger(EVT_ON_TARGET);}
+      // _currentStep = stepper->currentPosition();
       return;
     case ENT_HOMING_LOW:
       push(connectors, ON_CHANGESTATE, 0,  state(), 0);
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       runMode = 1;
       _isHoming = 1 ;
       stepper->setSpeed(-1*homing_speed);
       return;
     case LP_HOMING_LOW:
       stepper_update();
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       return;
     case EXT_HOMING_LOW:
       runMode = 0;
       _isHoming = 0;
-      trigger(EVT_EMERGENCY_STOP);
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       if(last_trigger == EVT_ON_LIMIT_LOW) {
         stepper->setCurrentPosition(0);
         _currentStep = 0;
+        push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
         Serial.println("homing low done");
       }
       else{Serial.println("homing low failed");}
-      _targetStep = _currentStep;
+      trigger(EVT_EMERGENCY_STOP);
 
       return;
     case ENT_HOMING_HIGH:
       push(connectors, ON_CHANGESTATE, 0,  state(), 0);
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       runMode = 1;
       _isHoming = 2 ;
       stepper->setSpeed(homing_speed);
       return;
     case LP_HOMING_HIGH:
       stepper_update();
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       return;
     case EXT_HOMING_HIGH:
+    push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       runMode = 0;
       _isHoming = 0;
       trigger(EVT_EMERGENCY_STOP);
@@ -207,35 +219,39 @@ void Atm_AccelStepper::action( int id ) {
             the free direction, until a trigger comes with state 0
       */
       push( connectors, ON_ONLIMITLOW, 0, limitLow_State, 0 );
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       if (!limitLow_State){trigger(EVT_MOVE);}
       return;
 
     case LP_LIMIT_LOW:
       //stop motor if going down, allow going up
-      stepper_update();
+
       if(_limitLow_Hard && (_targetStep < _currentStep)) {
           // Serial.println("youpi");
           _currentStep = stepper->currentPosition();
-          //stepper->moveTo(_currentStep);
-          //_targetStep = _currentStep;
+          stepper->moveTo(_currentStep);
+          _targetStep = _currentStep;
           stepper->setSpeed(0);
         }
+        stepper_update();
       //else{} // _isHoming ? trigger(EVT_STOP):
       return;
     case ENT_LIMIT_HIGH:
       push( connectors, ON_ONLIMITHIGH, 0, limitHigh_State, 0 );
+      push(connectors, ON_CHANGEPOSITION, 0,  _currentStep, stepper->speed());
       if (!limitHigh_State){trigger(EVT_MOVE);};
       return;
     case LP_LIMIT_HIGH:
       //stop motor if going down, allow going up
-      stepper_update();
+
       if(_limitHigh_Hard && (_targetStep > _currentStep)) {
           // Serial.println("youpi");
           _currentStep = stepper->currentPosition();
-          //stepper->moveTo(_currentStep);
-          //_targetStep = _currentStep;
+          stepper->moveTo(_currentStep);
+          _targetStep = _currentStep;
           stepper->setSpeed(0);
         }
+        stepper_update();
       // else{}
       return;
   }

+ 2 - 3
HTequi-firmware/lib/Atm_lien/Atm_out.cpp

@@ -1,4 +1,4 @@
-#if not defined(ARDUINO_ARCH_ESP32) 
+#if not defined(ARDUINO_ARCH_ESP32)
 
 #include "Atm_out.h"
 
@@ -248,9 +248,8 @@ Atm_out& Atm_out::onOSC(OSCMessage& msg ){
     if(msg.fullMatch("/toggle", patternOffset)){trigger(EVT_TOGGLE);}
     if(msg.fullMatch("/blink", patternOffset)){trigger(EVT_BLINK);}
     if(msg.fullMatch("/brightness", patternOffset)){brightness(msg.getInt(0));}
-
-    return *this;
   }
+  return *this;
 }
 
 Atm_out& Atm_out::trace( Stream& stream ) {

ファイルの差分が大きいため隠しています
+ 3366 - 0
blob-CN/HTEQUI.noisette


ファイルの差分が大きいため隠しています
+ 3366 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_0.noisette


ファイルの差分が大きいため隠しています
+ 3068 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_1.noisette


ファイルの差分が大きいため隠しています
+ 3205 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_2.noisette


ファイルの差分が大きいため隠しています
+ 3324 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_3.noisette


ファイルの差分が大きいため隠しています
+ 3336 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_4.noisette


ファイルの差分が大きいため隠しています
+ 2927 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_5.noisette


ファイルの差分が大きいため隠しています
+ 2963 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_6.noisette


ファイルの差分が大きいため隠しています
+ 2974 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_7.noisette


ファイルの差分が大きいため隠しています
+ 2974 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_8.noisette


ファイルの差分が大きいため隠しています
+ 2974 - 0
blob-CN/HTEQUI_autosave/HTEQUI_autosave_9.noisette


+ 143 - 0
blob-CN/htequiOSC-TESTS.pd

@@ -0,0 +1,143 @@
+#N canvas 377 193 1183 697 12;
+#X msg 73 121 disconnect;
+#X obj 329 426 tgl 15 0 empty empty connected 20 7 0 8 -24198 -241291
+-1 1 1;
+#X text 25 398 udpsend sends bytes over a udp connection.;
+#X msg 176 224 multicast_interface 192.168.0.88;
+#X msg 151 199 multicast_interface eth1;
+#X text 154 120 <--disconnect before connecting to another address
+;
+#X text 314 150 send to a multicast address;
+#X text 286 175 specify an interface to use with multicast;
+#X msg 128 176 multicast_interface 1;
+#X text 336 198 by index \, name or address;
+#X msg 300 348 multicast_loopback \$1;
+#X obj 300 326 tgl 15 0 empty empty empty 20 7 0 8 -24198 -241291 -1
+0 1;
+#X text 111 324 enable multicast loopback:;
+#X floatatom 1309 84 3 0 0 0 - - -;
+#X floatatom 1336 84 3 0 0 0 - - -;
+#X floatatom 1363 84 3 0 0 0 - - -;
+#X floatatom 1390 84 3 0 0 0 - - -;
+#X floatatom 1417 85 5 0 0 0 - - -;
+#X obj 1309 58 unpack 0 0 0 0 0;
+#X msg 942 13 status;
+#X floatatom 1234 59 9 0 0 0 - - -;
+#X obj 1443 62 tgl 15 0 empty empty empty 17 7 0 10 -4034 -1 -1 0 1
+;
+#X floatatom 1233 84 9 0 0 0 - - -;
+#X text 1099 36 bytes received:;
+#X text 1069 60 total bytes received:;
+#X obj 1007 427 spigot;
+#X obj 1046 407 tgl 15 0 empty empty enable_print: -77 8 0 10 -4034
+-1 -1 0 1;
+#X obj 1007 452 print received;
+#X obj 1235 33 route received total from multicast;
+#X msg 953 52 port 9998;
+#X obj 943 296 route /analog/0;
+#X obj 330 398 mrpeach/udpsend;
+#X obj 942 108 mrpeach/unpackOSC;
+#X obj 512 335 mrpeach/packOSC;
+#X obj 942 86 mrpeach/udpreceive 9977 239.200.200.200;
+#X obj 932 356 vsl 15 128 0 1024 0 0 empty empty empty 0 -9 0 10 -262144
+-1 -1 0 1;
+#X msg 269 252 connect 192.168.1.105 8000;
+#X obj 500 236 r toOSC;
+#X obj 986 162 s fromOSC;
+#X msg 668 469 /brush \$1;
+#X floatatom 689 422 5 0 0 0 - - -;
+#X obj 745 429 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 745 449 * 255;
+#X obj 576 480 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 548 511;
+#X floatatom 612 494 5 0 0 0 - - -;
+#X msg 661 499 0;
+#X msg 581 533 /filling \$1;
+#X obj 618 399 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X msg 804 395 /crusher \$1;
+#X obj 810 376 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
+1;
+#X obj 618 419 * 1;
+#X obj 1160 136 stepper A_low;
+#X obj 1160 340 stepper B_low;
+#X obj 1160 540 stepper TrBr_low;
+#X obj 1161 740 stepper LevBr_low;
+#X obj 698 755 stepper Y_top;
+#X obj 697 555 stepper X_top;
+#X msg 418 476 /pill_trap \$1;
+#X floatatom 425 454 5 0 0 0 - - -;
+#X floatatom 385 551 5 0 0 0 - - -;
+#X msg 385 575 /peristaltic \$1;
+#X obj 139 83 loadbang;
+#X msg 105 151 connect 239.200.200.200 9977 \, multicast_loopback 0
+;
+#X msg 597 244 /feeder1/barrel_home bang;
+#X msg 627 197 /feeder2/barrel_home bang;
+#X msg 634 219 /feeder2/pill bang;
+#X msg 604 266 /feeder1/pill bang;
+#X obj 549 20 r fromOSC;
+#X obj 550 67 print feeder2_barrel;
+#X obj 710 67 print feeder2_pill;
+#X obj 550 42 route /feeder2/barrel/done /feeder2/pill/done;
+#X obj 591 105 route /feeder1/barrel/done /feeder1/barrel/done;
+#X obj 594 150 print feeder1_barrel;
+#X obj 753 150 print feeder1_pill;
+#X connect 0 0 31 0;
+#X connect 3 0 31 0;
+#X connect 4 0 31 0;
+#X connect 8 0 31 0;
+#X connect 10 0 31 0;
+#X connect 11 0 10 0;
+#X connect 18 0 13 0;
+#X connect 18 1 14 0;
+#X connect 18 2 15 0;
+#X connect 18 3 16 0;
+#X connect 18 4 17 0;
+#X connect 19 0 34 0;
+#X connect 25 0 27 0;
+#X connect 26 0 25 1;
+#X connect 28 0 20 0;
+#X connect 28 1 22 0;
+#X connect 28 2 18 0;
+#X connect 28 3 21 0;
+#X connect 29 0 34 0;
+#X connect 30 0 35 0;
+#X connect 30 1 25 0;
+#X connect 31 0 1 0;
+#X connect 32 0 30 0;
+#X connect 32 0 38 0;
+#X connect 33 0 31 0;
+#X connect 34 0 32 0;
+#X connect 34 1 28 0;
+#X connect 37 0 33 0;
+#X connect 39 0 33 0;
+#X connect 40 0 39 0;
+#X connect 41 0 42 0;
+#X connect 42 0 39 0;
+#X connect 43 0 44 0;
+#X connect 45 0 47 0;
+#X connect 46 0 45 0;
+#X connect 47 0 33 0;
+#X connect 48 0 51 0;
+#X connect 49 0 33 0;
+#X connect 50 0 49 0;
+#X connect 51 0 45 0;
+#X connect 58 0 33 0;
+#X connect 59 0 58 0;
+#X connect 60 0 61 0;
+#X connect 61 0 33 0;
+#X connect 62 0 63 0;
+#X connect 63 0 31 0;
+#X connect 64 0 33 0;
+#X connect 65 0 33 0;
+#X connect 66 0 33 0;
+#X connect 67 0 33 0;
+#X connect 68 0 71 0;
+#X connect 71 0 69 0;
+#X connect 71 1 70 0;
+#X connect 71 2 72 0;
+#X connect 72 0 73 0;
+#X connect 72 1 74 0;

+ 23 - 0
blob-CN/rstpSnapshot.sh

@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# TimeLapse snapshot capture script.
+
+# This script should capture any stills in the incoming Stills directory
+
+time=`date '+%Y_%m_%d__%H_%M_%S'`;
+
+# Specific for each camera
+CameraName=snapshots
+CameraIP='192.168.1.189'
+
+CameraUsername='admin'
+CameraPassword='123456'
+
+# Shouldn't need to be changed!
+StorageDirectory=./
+StorageFilename=blob-$time.png
+
+mkdir -p $StorageDirectory/$CameraName;
+
+ffmpeg -rtsp_transport tcp -i rtsp://$CameraUsername:$CameraPassword@$CameraIP/ch01.264 -ss 00:00:01.50 -vframes 1 $StorageDirectory/$CameraName/$StorageFilename -nostats -hide_banner -v 0 -loglevel quiet;
+cp $StorageDirectory/$CameraName/$StorageFilename $StorageDirectory/latest_snapshot.png;

+ 129 - 0
blob-CN/stepper.pd

@@ -0,0 +1,129 @@
+#N canvas 353 306 1246 622 10;
+#X floatatom 234 227 10 0 0 0 step #1_step -;
+#X obj 233 316 bng 15 250 50 0 empty \$1_limitLow limitLow 17 7 0 10
+-262144 -1 -1;
+#X obj 233 333 bng 15 250 50 0 empty \$1_limitHigh limitHigh 17 7 0
+10 -262144 -1 -1;
+#X obj 57 61 r fromOSC;
+#X floatatom 379 228 5 0 0 0 move - #1_move;
+#X floatatom 379 248 5 0 0 0 moveTo - #1_moveTo;
+#X floatatom 379 268 5 0 0 0 rotate - #1_rotate;
+#X obj 737 518 pack s f s;
+#X obj 794 491 symbol \$1;
+#X msg 737 297 move \$1;
+#X obj 737 440 t a b;
+#X obj 737 564 s toOSC;
+#X msg 747 317 moveTo \$1;
+#X msg 757 337 rotate \$1;
+#X obj 55 114 unpack f f;
+#X floatatom 234 248 15 0 0 0 speed #1_speed -;
+#X obj 233 279 bng 25 250 50 0 empty \$1_onTarget onTarget 27 12 0
+10 -262144 -1 -1;
+#X obj 55 137 s \$1_step;
+#X obj 113 157 s \$1_speed;
+#X obj 192 138 s \$1_state;
+#X obj 329 160 s \$1_limitLow;
+#X obj 466 183 s \$1_limitHigh;
+#X obj 602 203 s \$1_onTarget;
+#X obj 102 228 vradio 15 1 0 8 empty \$1_state empty 0 -8 0 10 -262144
+-1 -1 4;
+#X text 119 226 disabled;
+#X text 119 242 enable;
+#X text 119 256 running;
+#X text 119 272 stop;
+#X text 119 286 homingLow;
+#X text 119 302 homingHigh;
+#X text 119 316 limitLow;
+#X text 119 332 limitHigh;
+#X obj 737 229 r \$1_move;
+#X obj 747 249 r \$1_moveTo;
+#X obj 757 269 r \$1_rotate;
+#X obj 379 291 bng 25 250 50 0 \$1_stop empty stop 27 12 0 10 -260097
+-1 -1;
+#X obj 379 321 bng 25 250 50 0 \$1_emergency empty emergency 27 12
+0 10 -258113 -1 -1;
+#X obj 562 348 r \$1_stop;
+#X obj 632 358 r \$1_emergency;
+#X obj 421 228 bng 15 250 50 0 \$1_homingLow empty homingLow 17 7 0
+10 -262144 -1 -1;
+#X obj 421 245 bng 15 250 50 0 \$1_homingHigh empty homingHigh 17 7
+0 10 -262144 -1 -1;
+#X msg 562 380 stop 0;
+#X msg 632 400 emergency_stop 0;
+#X floatatom 314 377 10 0 0 0 maxSpeed - #1_maxSpeed;
+#X floatatom 404 377 10 0 0 0 acc - #1_acc;
+#X floatatom 404 357 10 0 0 0 homingSpeed - #1_homingSpeed;
+#X obj 955 495 symbol \$1;
+#X obj 871 448 t a b;
+#X obj 871 572 s toOSC;
+#X obj 1020 281 r \$1_homingLow;
+#X msg 1020 304 homing 0;
+#X obj 1030 331 r \$1_homingHigh;
+#X msg 1030 354 homing 1;
+#X obj 871 526 pack s f f f s;
+#X obj 1022 448 t a b;
+#X obj 1022 572 s toOSC;
+#X obj 1022 526 pack s f f s;
+#X obj 1089 502 symbol \$1;
+#X msg 737 541 /\$3/\$1 \$2;
+#X msg 871 549 /\$5/\$1 \$2 \$3 \$4;
+#X msg 1022 549 /\$4/\$1 \$2 \$3;
+#X obj 55 91 route /\$1/step;
+#X obj 192 115 route /\$1/state;
+#X obj 329 137 route /\$1/limitLow;
+#X obj 466 160 route /\$1/limitHigh;
+#X obj 602 180 route /\$1/onTarget;
+#X obj 835 227 r \$1_maxSpeed;
+#X obj 854 249 r \$1_acc;
+#X obj 869 273 r \$1_homingSpeed;
+#X msg 837 297 setMaxSpeed \$1;
+#X msg 847 317 setAcceleration \$1;
+#X msg 857 337 setHomingSpeed \$1;
+#X connect 3 0 61 0;
+#X connect 7 0 58 0;
+#X connect 8 0 7 2;
+#X connect 9 0 10 0;
+#X connect 10 0 7 0;
+#X connect 10 1 8 0;
+#X connect 12 0 10 0;
+#X connect 13 0 10 0;
+#X connect 14 0 17 0;
+#X connect 14 1 18 0;
+#X connect 32 0 9 0;
+#X connect 33 0 12 0;
+#X connect 34 0 13 0;
+#X connect 37 0 41 0;
+#X connect 38 0 42 0;
+#X connect 41 0 10 0;
+#X connect 42 0 10 0;
+#X connect 46 0 53 4;
+#X connect 47 0 53 0;
+#X connect 47 1 46 0;
+#X connect 49 0 50 0;
+#X connect 50 0 10 0;
+#X connect 51 0 52 0;
+#X connect 52 0 10 0;
+#X connect 53 0 59 0;
+#X connect 54 0 56 0;
+#X connect 54 1 57 0;
+#X connect 56 0 60 0;
+#X connect 57 0 56 3;
+#X connect 58 0 11 0;
+#X connect 59 0 48 0;
+#X connect 60 0 55 0;
+#X connect 61 0 14 0;
+#X connect 61 1 62 0;
+#X connect 62 0 19 0;
+#X connect 62 1 63 0;
+#X connect 63 0 20 0;
+#X connect 63 1 64 0;
+#X connect 64 0 21 0;
+#X connect 64 1 65 0;
+#X connect 65 0 22 0;
+#X connect 66 0 69 0;
+#X connect 67 0 70 0;
+#X connect 68 0 71 0;
+#X connect 69 0 10 0;
+#X connect 70 0 10 0;
+#X connect 71 0 10 0;
+#X coords 0 -1 1 1 400 200 1 100 200;