Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    DuetLapse available for Alpha testing

    Scheduled Pinned Locked Moved
    Third-party software
    26
    239
    21.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • arhiundefined
      arhi
      last edited by arhi

      @Danal you tested this with 3.01RC12? and DWC 2.1.7?

      root@octopi:~/DuetLapse/DuetLapse# cd ../DuetWebAPI/
      root@octopi:~/DuetLapse/DuetWebAPI# git pull
      Already up to date.
      root@octopi:~/DuetLapse/DuetWebAPI# cd -
      /root/DuetLapse/DuetLapse
      root@octopi:~/DuetLapse/DuetLapse# python3 DuetLapse.py -duet ender5.local.lan -camera usb -detect layer -pause no
      Attempting to connect to printer at ender5.local.lan
      http://ender5.local.lan  does not appear to be a RRF2 or RRF3 printer
      Device at ender5.local.lan either did not respond or is not a Duet V2 or V3 printer.
      root@octopi:~/DuetLapse/DuetLapse# fping ender5.local.lan
      ender5.local.lan is alive
      root@octopi:~/DuetLapse/DuetLapse#
      
      root@octopi:~/DuetLapse/DuetLapse# telnet ender5.local.lan
      Trying 192.168.89.246...
      Connected to ender5.local.lan.
      Escape character is '^]'.
      M122
      === Diagnostics ===
      RepRapFirmware for Duet 2 WiFi/Ethernet version 3.01-RC12 running on Duet Ethernet 1.02 or later
      ...
      telnet> c
      Connection closed.
      root@octopi:~/DuetLapse/DuetLapse#
      
      1 Reply Last reply Reply Quote 0
      • arhiundefined
        arhi
        last edited by

        this last part was on me - works ok now 🙂

        1 Reply Last reply Reply Quote 0
        • arhiundefined
          arhi
          last edited by

          @Danal I don't know python so this should probbly be done better by somehow defining parameter to onePhoto() not mandatory, or if there's already a global with this info but this works awesome for me so if you like you integrate 😄

          root@octopi:~/DuetLapse/DuetLapse# git diff
          diff --git a/DuetLapse.py b/DuetLapse.py
          old mode 100755
          new mode 100644
          index eee4a51..1539257
          --- a/DuetLapse.py
          +++ b/DuetLapse.py
          @@ -17,6 +17,9 @@ import subprocess
           import sys
           import argparse
           import time
          +
          +sys.path.insert(1, "../DuetWebAPI/");
          +
           try:
               import DuetWebAPI as DWA
           except ImportError:
          @@ -204,11 +207,15 @@ def unPause():
                   printer.gCode('M24')
                   alreadyPaused = False
          
          -def onePhoto():
          +def onePhoto(zl):
               global frame
               frame += 1
               s="{0:08d}".format(int(np.around(frame)))
          -    fn = '/tmp/DuetLapse/IMG'+s+'.jpeg'
          +    if (zl > -1):
          +      zlayer="{0:8d}".format(int(zl))
          +      fn = '--title "Layer '+zlayer+'" /tmp/DuetLapse/IMG'+s+'.jpeg'
          +    else:
          +      fn = ' /tmp/DuetLapse/IMG'+s+'.jpeg'
          
               if ('usb' in camera):
                   if (camparms == ''):
          @@ -226,6 +233,7 @@ def onePhoto():
                   else:
                       cmd = 'wget '+camparms+' -O '+fn+' "'+weburl+'" '
          
          +    print(cmd)
               subprocess.call(cmd, shell=True)
               global timePriorPhoto
               timePriorPhoto = time.time()
          @@ -240,20 +248,20 @@ def oneInterval():
                       # Z changed, take a picture.
                       checkForcePause()
                       print('Capturing frame {0:5d} at X{1:4.2f} Y{2:4.2f} Z{3:4.2f} Layer {4:d}'.format(int(np.around(frame)),printer.getCoords()['X'],printer.getCoords()['Y'],printer.getCoords()['Z'],zn))
          -            onePhoto()
          +            onePhoto(zn)
                   zo = zn
               global timePriorPhoto
               elap = (time.time() - timePriorPhoto)
               if ((seconds) and (seconds < elap)):
                   checkForcePause()
                   print('Capturing frame {0:5d} after {1:4.2f} seconds elapsed.'.format(int(np.around(frame)),elap))
          -        onePhoto()
          +        onePhoto( -1 )
               if ('pause' in detect):
                   if ('paused' in printer.getStatus()):
                       global alreadyPaused
                       alreadyPaused = True
                       print('Pause Detected, capturing frame {0:5d}'.format(int(np.around(frame)),elap))
          -            onePhoto()
          +            onePhoto( -1)
                   unPause()
          
           def postProcess():
          root@octopi:~/DuetLapse/DuetLapse#
          

          (print(cmd) was just me debuging, that's not needed)

          1 Reply Last reply Reply Quote 0
          • Danalundefined
            Danal
            last edited by Danal

            Python honors symlinks, that is exactly how I'm keeping one central copy of DuetWebAPI and not copying it around to each DuetLapse, TAMV, etc, etc. as I develop this stuff. If you want it not in the current directory, and/or don't want to use symlinks, then properly put it in Python's path please.

            By the way, git clone will NOT update things, 'wget' has all kinds of edge cases, I haven't found a really bullet proof way to distribute scripts from github (besides set up a package server. Which I am reluctant to do, and even that requires entries in /etc directories on user endpoints).

            Anyway, symlinks work fine, I'm curious why yours don't.

            ln -s ../DuetWebAPI/DuetWebAPI.py DuetWebAPI.py right?

            Screenshot to get colors:

            0196fb3f-3106-4ea8-a315-26c851c585bd-image.png

            Delta / Kossel printer fanatic

            arhiundefined 1 Reply Last reply Reply Quote 1
            • arhiundefined
              arhi @Danal
              last edited by

              @Danal said in DuetLapse available for Alpha testing:

              Python honors symlinks, that is exactly how I'm keeping one central copy of DuetWebAPI and not copying it around to each DuetLapse, TAMV, etc, etc. as I develop this stuff. If you want it not in the current directory,

              kill me if I know why but it didn't work .. I'll try again later but this work as is now so ...

              and/or don't want to use symlinks, then properly put it in Python's path please.

              Need to try that again, when I did with PYTHONPATH=/root/DuetLapse/DuetWebAPI python3 DuetLapse.py it was finding api ok but failed something else, but maybe now that I fixed the other thing that will work, will try 🙂

              By the way, git clone will NOT update things

              of course, git pull does ( git checkout or stash first if files are modified 😄 like they are now)

              'wget' has all kinds of edge cases, I haven't found a really bullet proof way to distribute scripts from github (besides set up a package server. Which I am reluctant to do, and even that requires entries in /etc directories on user endpoints).

              git clone
              git pull
              git checkout/stash

              works awesome, the only issue I need to handle is this path for libs so it knows how to find api, will retest this but even as is it's not a biggy

              hahaha retested the symthing now, it works, the %^$#*&^#

              PYTHONPATH=/root/DuetLapse/DuetWebAPI python3 DuetLapse.py -h works too, I'll use this way .. the problem was obviously the numpy or whatever is that thing called...

              anyhow, these are irrelevant parts of that diff 🙂 .. what about that change in the onePhoto() ? makes sense?

              Danalundefined 1 Reply Last reply Reply Quote 0
              • arhiundefined
                arhi
                last edited by

                IMG00000001.jpeg

                1 Reply Last reply Reply Quote 0
                • Danalundefined
                  Danal @arhi
                  last edited by

                  @arhi said in DuetLapse available for Alpha testing:

                  hahaha retested the symthing now, it works, the %^$#*&^#

                  Don't you just love things like that!

                  @arhi said in DuetLapse available for Alpha testing:

                  anyhow, these are irrelevant parts of that diff .. what about that change in the onePhoto() ? makes sense?

                  Makes perfect sense, I just need time to look at it... probably next day or two.

                  Delta / Kossel printer fanatic

                  arhiundefined 1 Reply Last reply Reply Quote 0
                  • arhiundefined
                    arhi @Danal
                    last edited by

                    @Danal said in DuetLapse available for Alpha testing:

                    Don't you just love things like that!

                    I'm not 40 any more, doing things between 3 and 5am obviously need to be doublechecked 😄 😄 😄

                    1 Reply Last reply Reply Quote 0
                    • Danalundefined
                      Danal @Adrian52
                      last edited by

                      @Adrian52 said in DuetLapse available for Alpha testing:

                      Great program, but I still have not got it quite right. I am currently using. /DuetLapse - duet 192.168.1.16 -camera pi -detect pause, with M25 and M400 added to each layer in gcode (easy to do in kisslicer). The problem is that two frames are taken, one when the head is moved away by pause.g, the second a bit later, when the print has resumed. I also get an error message on the console 'm24: cannot print because no file is selected'. It looks as though the m24 is being sent twice.
                      I have edited my pause.g so that there is no z shift.

                      Just pushed changes to the detect pause logic that should eliminate this. It has been tested to ensure no syntax errors, but has not been run through a print.

                      Delta / Kossel printer fanatic

                      Adrian52undefined 1 Reply Last reply Reply Quote 0
                      • Adrian52undefined
                        Adrian52 @Danal
                        last edited by

                        @Danal here is my first go

                        https://vimeo.com/415969620
                        Worked fine with M226 in the gcode file. Excellent. Will try detecting layer changes later. Great work.

                        1 Reply Last reply Reply Quote 1
                        • phdrumlinekaundefined
                          phdrumlineka
                          last edited by

                          I was attempting to run this on the same PI as my OctoPrint setup. I kept getting errors saying numpy wasn't installed. After attempting the suggested command to get numpy installed, it claimed that pip wasn't installed for python3. After a lot of googling I got pip and numpy installed, but I was still getting the same error saying numpy was required.

                          I finally added some additional output to DuetLapse.py file and found that I was getting the following error:
                          Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
                          It looks like the answer to that error was to run
                          sudo apt-get install libatlas-base-dev

                          I just thought I would post this here in case anyone else runs into this issue, or if anyone has a better way to solve it. I am novice with Linux and Python, so this may not be the best way to handle things. 🙂

                          I am using the following versions of OctoPrint/OctoPi:
                          OctoPrint version: 1.4.0
                          OctoPi version: 0.17.0

                          1 Reply Last reply Reply Quote 1
                          • Danalundefined
                            Danal
                            last edited by Danal

                            Interesting.

                            I developed the script on the "Duet" provided image for a Pi, and I'm sure that has things installed that were transparent to me. I've tried to have the script produce meaningful errors when something is missing, and I will need to do that for Numpy. Also, I will look into the libatals-base-dev.

                            pip is not needed by the script at runtime; it is needed to install things the script needs. As you say, python3 does not install pip by default.

                            A lot of instructions show how to "bootstrap" pip install via python itself. The actual proper way to install pip on a Python3 (or mixed) system is sudo apt install python-pip. This would (should?) get the libatlas dependence automatically.

                            I've updated the script to show the required commands, if numpy is not found.

                            Thank you.

                            Delta / Kossel printer fanatic

                            phdrumlinekaundefined 1 Reply Last reply Reply Quote 1
                            • phdrumlinekaundefined
                              phdrumlineka @Danal
                              last edited by

                              @Danal
                              I am pretty sure that is not how I did it 😞 . Good to know. Thanks for looking into that. Hopefully it will help others in the future.

                              I would also like to mention that it is working now, happily taking pictures of my current print. 🙂 Good work. I appreciate it.

                              Danalundefined 1 Reply Last reply Reply Quote 0
                              • Danalundefined
                                Danal @phdrumlineka
                                last edited by

                                @phdrumlineka said in DuetLapse available for Alpha testing:

                                I am pretty sure that is not how I did it

                                No worries. Most of the instructions and tips that turn up in a search are for older versions.

                                Delta / Kossel printer fanatic

                                1 Reply Last reply Reply Quote 0
                                • arhiundefined
                                  arhi
                                  last edited by

                                  just figured out fswebcam will fetch image from rpi camera too 🙂 .. and its "title" works better than "annotate" with raspistill 🙂 for adding txt on the image 🙂

                                  1 Reply Last reply Reply Quote 0
                                  • arhiundefined
                                    arhi
                                    last edited by

                                    I managed to make the "dual channel video"
                                    sample

                                    now don't know how to properly view it. In potplayer you can switch between the channel using ALT+V but I'd like some picture in picture or something similar more .. will experiment more with the result.. I forked the original repo so I can keep track of changes and so it's safe to play with it as I'm not a python dev so I'm probbly doing things wrong 😄

                                    1 Reply Last reply Reply Quote 0
                                    • Danalundefined
                                      Danal
                                      last edited by

                                      Python is pretty easy in some ways.

                                      A pic-n-pic video "editor" would make a very cool result.

                                      Delta / Kossel printer fanatic

                                      arhiundefined 1 Reply Last reply Reply Quote 0
                                      • arhiundefined
                                        arhi @Danal
                                        last edited by

                                        @Danal I managed to get used to "no ;" somehow with go but this whitespace structuring is really annoying 😞 ... irrelevant ... enough ppl bitching about it online on programming forums no need to spill it here, I just mentioned 'cause probably things I did can/should be done differently (properly - in the spirit of language).

                                        A pic-n-pic video "editor" would make a very cool result.

                                        I actually expected that I'll easily find a video player that will do just that, allow 2 tracks to be played pip style or one next to another or something like that, but most players don't even support multi track video and best I could find is "easy switching" with ALT+V on the potplayer. I generate first both videos as mk4 and then use ffmpeg to copy them into single mkv with two tracks. Will investigate further, maybe there is better way. So far I like that I don't have to use raspistill and that the fs.. can do both rpi camera and usb camera, and I want to be able to capture both and that works somehow ok. Now I need to see how to make a best output from the two sets of images 🙂

                                        Danalundefined 2 Replies Last reply Reply Quote 0
                                        • Danalundefined
                                          Danal @arhi
                                          last edited by

                                          @arhi said in DuetLapse available for Alpha testing:

                                          @Danal I managed to get used to "no ;" somehow with go but this whitespace structuring is really annoying ... irrelevant ... enough ppl bitching about it online on programming forums no need to spill it here, I just mentioned 'cause probably things I did can/should be done differently (properly - in the spirit of language).

                                          I am doing a BUNCH of Python, regular old C, C++, and C# right now (different projects). Subtleties of syntax difference are driving me crazy. (As well as C string/pointer stuff, which I'd forgotten how bad that really is/was).

                                          It is really funny how your mind works. I am really good about no ";" in Python, and yes ";" in the various C flavors... except... on printf statements. The syntax checking editor gets me every time. I just can't make my mind do it.

                                          And, I really, really, really, like the indentation based structure of Python. It is 1/2 the reason I use it instead of PERL. To each his own... 🙂

                                          Delta / Kossel printer fanatic

                                          arhiundefined 1 Reply Last reply Reply Quote 0
                                          • Danalundefined
                                            Danal @arhi
                                            last edited by

                                            @arhi said in DuetLapse available for Alpha testing:

                                            I actually expected that I'll easily find a video player that will do just that, allow 2 tracks to be played pip style or one next to another or something like that, but most players don't even support multi track video and best I could find is "easy switching" with ALT+V on the potplayer. I generate first both videos as mk4 and then use ffmpeg to copy them into single mkv with two tracks. Will investigate further, maybe there is better way. So far I like that I don't have to use raspistill and that the fs.. can do both rpi camera and usb camera, and I want to be able to capture both and that works somehow ok. Now I need to see how to make a best output from the two sets of images

                                            I was thinking more of an editor, so there is nothing at "my end". Just a regular vid, with side-by-side or p-n-p.

                                            Speaking of which, I don't have any players installed on this machine, and I haven't been able to look at that mkv quite yet.

                                            Delta / Kossel printer fanatic

                                            arhiundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA