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.
    • Danalundefined
      Danal
      last edited by

      What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.

      Delta / Kossel printer fanatic

      tekkydaveundefined 1 Reply Last reply Reply Quote 1
      • tekkydaveundefined
        tekkydave @Danal
        last edited by tekkydave

        @Danal said in DuetLapse available for Alpha testing:

        What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.

        That's true, if they need to reflect things changing as the print progresses.

        I'm writing a similar program to yours. I use motioneye to generate my original images from a picam which is then displayed in the DWC Webcam view (or via a browser window).
        Motioneye uses motion which has a http api available.

        e.g. To take snapshots

        http://localhost:7999/1/action/snapshot
        

        will cause motion to take a snapshot from Camera 1 and place it in

        /var/lib/motioneye/Camera1
        

        I'm picking them up from there, creating a movie when the print is complete (ffmpeg) and uploading it to my NAS server.

        I had thought of doing something like this for a while but you have inspired me to get it done. I admit I have "borrowed" a few ideas from your program. 🙂
        Also I'm using Java as it's what I'm more comfortable with. I like Netbeans as an IDE as it's perfect for Java development.

        ~ tekkydave ~
        D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
        FreeCAD, PrusaSlicer

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

          @tekkydave said in DuetLapse available for Alpha testing:

          I admit I have "borrowed" a few ideas from your program

          The great architectural principle of "reuse". Cool!

          Delta / Kossel printer fanatic

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

            Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9

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

              @Adrian52 said in DuetLapse available for Alpha testing:

              Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9

              Can you post your command line that you are using to invoke?

              Delta / Kossel printer fanatic

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

                @Danal I used . /DuetLapse -duet 192.168.1.16 -camera pi -pause yes If I leave out the pause it works fine. Not sure why I said bed.g of course I meant pause.g, which contains a z as well as x and y moves.

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

                  Thanks, I will take a look.

                  Delta / Kossel printer fanatic

                  1 Reply Last reply Reply Quote 0
                  • THPundefined
                    THP
                    last edited by THP

                    @Danal Love what you have done with DuetLapse, thanks for contributing it to the community. Overall works really well except for a couple of issues, some of which I know are on your radar such as error handling if you can't get a status update from the 3d printer (or if you are using a webcam error detecting) (as a side note, I have all hardlines between the printer and raspi 4 and computer running the camera and still randomly get errors).

                    The first issue I noticed was that the layer detection works by looking for z height changes. This is an issue for me as I do a vertical lift on retraction with the printhead. It should also resolve the issues people had with taking pictures during mesh bed scanning.

                    I added a function in the DuetWebAPI:

                    def getLayer(self):
                           URL=(f'{self._base_url}'+'/rr_status?type=3')
                           r = self.requests.get(URL)
                           j = self.json.loads(r.text)
                           s = j['currentLayer']
                           return (s)
                    

                    The type3 return adds the current layer height information.
                    Then in the DuetLapse.py

                    #        zn=printer.getCoords()['Z'] #replace with following line
                            zn=printer.getLayer()
                    

                    along with updating the terminal printing in the oneInterval() function to

                                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))
                    

                    I figured out you might want to include it in your code. I can setup a pull request if you want.
                    Keep up the great work!

                    P.S. I am running RRF3.0, I don't know if the layer output is included in RRF2.

                    Also for everyone else looking to contribute or modify:
                    I assume Danal know where the documentation for the status returns are, but for others like me who didn't know where the documentation on the firmware status returns are located, https://reprap.org/wiki/RepRap_Firmware_Status_responses

                    Custom IDEX with Duet Ethernet & x5, IR probe, Titan Aero w/ PT100s, Heated Bed, and Chamber with Thermocouples.

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

                      Absolutely FANTASTIC, really, really appreciate the thoughts and code.

                      If you wish "attribution", code it up as a pull. Otherwise, I'll just integrate it, and save you some work.

                      Delta / Kossel printer fanatic

                      1 Reply Last reply Reply Quote 0
                      • THPundefined
                        THP
                        last edited by

                        @Danal I don't feel I need attribution, feel free to integrate it yourself. I realized after I posted the message I don't have a good way to push selected lines of code from my raspi at this moment (a bit rusty on my cmd line git commands) and I have other minor changes (such as directory storage) included in the changes of my copy.

                        Custom IDEX with Duet Ethernet & x5, IR probe, Titan Aero w/ PT100s, Heated Bed, and Chamber with Thermocouples.

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

                          Sure! Let me know of any other ideas.

                          Delta / Kossel printer fanatic

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

                            @Adrian52 said in DuetLapse available for Alpha testing:

                            @Danal I used . /DuetLapse -duet 192.168.1.16 -camera pi -pause yes If I leave out the pause it works fine. Not sure why I said bed.g of course I meant pause.g, which contains a z as well as x and y moves.

                            Actually.... that form of pause is not yet coded, not working. Let me make a minor change so that the script itself will issue a message to that effect.

                            And, "coming soon", in terms of when it will work.

                            Sorry for any confusion.

                            Delta / Kossel printer fanatic

                            1 Reply Last reply Reply Quote 0
                            • Damienundefined
                              Damien
                              last edited by

                              Is there a step by step guide for setting this up to work from a PC, rather than Pi?

                              I'm a little confused as to where to put the IP addresses for the printer and Webcam in the Duetlapse.py file, etc.

                              I have a Duet 2 Maestro, BTW.

                              I'm using an old iPhone as an IPCam. I can see the vid on the DWC.

                              I'm a total noob when it comes to this kind of thing.

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

                                It is only supported (by me) on Pi. If you want to adapt to a PC, it will probably run there, maybe even unchanged, but I choose not to get into all the extreme variations of PC stuff. I will answer specific questions.

                                You don't modify the script to specify addresses. Run it with -h and it will tell you usage. The only required parameter is -duet which specifies the IP or name of the printer.

                                ./DuetLapse.py -duet 192.168.7.101
                                

                                or similar. Full usage:

                                ./DuetLapse.py -h
                                usage: DuetLapse.py [-h] -duet DUET [-camera {usb,pi,web,dslr}]
                                                    [-seconds SECONDS] [-detect {layer,pause,none}]
                                                    [-pause {yes,no}] [-movehead MOVEHEAD MOVEHEAD]
                                                    [-weburl WEBURL] [-dontwait]
                                                    {camparms,vidparms} ...
                                
                                Program to create time lapse video from camera pointed at Duet3D based
                                printer.
                                
                                optional arguments:
                                  -h, --help            show this help message and exit
                                  -duet DUET            Name or IP address of Duet printer.
                                  -camera {usb,pi,web,dslr}
                                  -seconds SECONDS
                                  -detect {layer,pause,none}
                                  -pause {yes,no}
                                  -movehead MOVEHEAD MOVEHEAD
                                  -weburl WEBURL
                                  -dontwait             Capture images immediately.
                                
                                subcommands:
                                  {camparms,vidparms}   DuetLapse camparms -h or vidparms -h for more help
                                

                                So if your old phone has a URL that, when fetched, returns a still image, then something like:

                                ./DuetLapse.py -duet 192.168.7.101 -camera web -weburl "http://oldphoneurl"
                                

                                Delta / Kossel printer fanatic

                                1 Reply Last reply Reply Quote 0
                                • Baenwortundefined
                                  Baenwort
                                  last edited by

                                  I moved my old laptop running DuetLapse and a C920 USB cam to Ubuntu 20.04 and I'm having this problem now;

                                  baen@baen-W110ER:~/DuetLapse$ ./DuetLapse.py -camera usb - detect layer -pause no -duet 192.168.1.212 camparms -r 1920x1080
                                  ./DuetLapse.py: line 7: syntax error near unexpected token `newline'
                                  ./DuetLapse.py: line 7: `<!DOCTYPE html>'
                                  

                                  ffmpeg:

                                  baen-W110ER:~/DuetLapse$ ffmpeg -version
                                  ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
                                  built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
                                  configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
                                  libavutil      56. 31.100 / 56. 31.100
                                  libavcodec     58. 54.100 / 58. 54.100
                                  libavformat    58. 29.100 / 58. 29.100
                                  libavdevice    58.  8.100 / 58.  8.100
                                  libavfilter     7. 57.100 /  7. 57.100
                                  libavresample   4.  0.  0 /  4.  0.  0
                                  libswscale      5.  5.100 /  5.  5.100
                                  libswresample   3.  5.100 /  3.  5.100
                                  libpostproc    55.  5.100 / 55.  5.100
                                  

                                  Python3:

                                  baen@baen-W110ER:~/DuetLapse$ python3 --version
                                  Python 3.8.2
                                  

                                  fswebcam is installed but I can't figure out how to pull a version number off it.

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

                                    @THP Done. On Github. Obviously, you have to repull both scripts. Let me know.

                                    Delta / Kossel printer fanatic

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

                                      @Baenwort said in DuetLapse available for Alpha testing:

                                       baen@baen-W110ER:~/DuetLapse$ ./DuetLapse.py -camera usb - detect layer -pause no -duet 192.168.1.212 camparms -r 1920x1080                                                                                                                                                                            ./DuetLapse.py: line 7: syntax error near unexpected token `newline'                                                                                                                                                                            ./DuetLapse.py: line 7: `<!DOCTYPE html>'
                                      

                                      That `<!DOCTYPE html>' tells me that the contents of file "DuetLapse.py" is not the script, it is a webpage. That almost always means somebody right clicked and said "save as" on the filename on Github. That does not work... that link leads to a page that shows the script, not the script itself.

                                      How did you fetch it from github? I just checked the "readme" install instructions, and they are correct.

                                      mkdir DuetLapse
                                      cd DuetLapse
                                      wget https://raw.githubusercontent.com/DanalEstes/DuetLapse/master/DuetLapse.py
                                      chmod 744 DuetLapse.py
                                      wget https://raw.githubusercontent.com/DanalEstes/DuetWebAPI/master/DuetWebAPI.py
                                      

                                      Delta / Kossel printer fanatic

                                      Baenwortundefined 1 Reply Last reply Reply Quote 0
                                      • Baenwortundefined
                                        Baenwort @Danal
                                        last edited by

                                        @Danal You found the problem. 🙂
                                        Used wget this time and it works now. Must have just right clicked in the rush of setting things back up with the new install.

                                        ./DuetLapse.py -camera usb -detect layer -pause no -duet 192.168.1.212 camparms -parms -r 1920x1080
                                        

                                        functions fine

                                        1 Reply Last reply Reply Quote 1
                                        • Damienundefined
                                          Damien
                                          last edited by

                                          Hey guys,

                                          Thanks for the help yesterday!

                                          Ok, so I have installed python (latest) and ran script. I did not get any errors, so I am assuming that it is running (even though I didn't get any text to confirm this...possible addition?).

                                          Now, the only question I have is...where are the images going? Do I have to edit either file to tell it where to save the pics and also where it need to look for the conversion to the time lapse?

                                          I'm on PC btw..not Pi.

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

                                            Duet lapse is very verbose. If you are getting no output, it is not working. If you are not seeing lots of output, it hung attempting something; press Ctrl-C to terminate it. Here's an example of the first part of a run:

                                            Command issued:

                                            ./DuetLapse.py -camera web -weburl http://192.168.7.96/cgi-bin/currentpic.cgi -duet localhost
                                            

                                            Output:

                                            Attempting to connect to printer at localhost
                                            Connected to a Duet V3 printer at http://localhost
                                            
                                            ##################################
                                            # Options in force for this run: #
                                            # camera   = web                 #
                                            # printer  = localhost           #
                                            # seconds  = 0                   #
                                            # detect   = layer               #
                                            # pause    = no                  #
                                            # camparms =                     #
                                            # vidparms =                     #
                                            # movehead =   0.00   0.00       #
                                            # dontwait = False               #
                                            ##################################
                                            
                                            Waiting for print to start on printer localhost
                                            Will take pictures when printing starts,
                                              and make video when printing ends.
                                            Or, press Ctrl+C one time to move directly to conversion step.
                                            
                                            Print start sensed.
                                            End of print will be sensed, and frames will be converted into video.
                                            Or, press Ctrl+C one time to move directly to conversion step.
                                            
                                            Capturing frame     0 at X-3.87 Y375.83 Z9.80 Layer 0
                                            2020-04-26 18:04:28 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [182012/182012] -> "/tmp/DuetLapse/IMG00000001.jpeg" [1]
                                            Capturing frame     1 at X136.41 Y107.90 Z0.30 Layer 1
                                            2020-04-26 18:06:11 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [184934/184934] -> "/tmp/DuetLapse/IMG00000002.jpeg" [1]
                                            Capturing frame     2 at X151.73 Y184.54 Z0.45 Layer 2
                                            2020-04-26 18:17:43 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [186458/186458] -> "/tmp/DuetLapse/IMG00000003.jpeg" [1]
                                            Capturing frame     3 at X99.61 Y178.44 Z0.60 Layer 3
                                            2020-04-26 18:31:45 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [190931/190931] -> "/tmp/DuetLapse/IMG00000004.jpeg" [1]
                                            Capturing frame     4 at X166.89 Y184.79 Z0.75 Layer 4
                                            2020-04-26 18:33:08 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [186529/186529] -> "/tmp/DuetLapse/IMG00000005.jpeg" [1]
                                            Capturing frame     5 at X178.56 Y131.07 Z0.90 Layer 5
                                            2020-04-26 18:34:32 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [185255/185255] -> "/tmp/DuetLapse/IMG00000006.jpeg" [1]
                                            Capturing frame     6 at X164.44 Y179.88 Z1.05 Layer 6
                                            2020-04-26 18:35:57 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [187514/187514] -> "/tmp/DuetLapse/IMG00000007.jpeg" [1]
                                            Capturing frame     7 at X119.43 Y124.66 Z1.20 Layer 7
                                            2020-04-26 18:37:26 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [185951/185951] -> "/tmp/DuetLapse/IMG00000008.jpeg" [1]
                                            Capturing frame     8 at X143.62 Y172.98 Z1.35 Layer 8
                                            2020-04-26 18:38:55 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [189934/189934] -> "/tmp/DuetLapse/IMG00000009.jpeg" [1]
                                            Capturing frame     9 at X160.05 Y182.59 Z1.50 Layer 9
                                            2020-04-26 18:40:26 URL:http://192.168.7.96/cgi-bin/currentpic.cgi [184134/184134] -> "/tmp/DuetLapse/IMG00000010.jpeg" [1]```

                                            Delta / Kossel printer fanatic

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