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.
    • kingfisherundefined
      kingfisher @kingfisher
      last edited by

      @kingfisher
      I actually think it might be my Duet wifi board causing an error. I've also got a duet maestro and running the same python settings on the maestro IP address hasn't resulted in the "('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))" error

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

        Updates based on feedback:

        • Added -dontwait flag. This causes the script to not wait for a print to start; it captures images immediately. Of course, it will only capture things that happen... Example: If told only to capture on layer changes, well, that won't happen prior to a print...

        • Added 'camparms -parms' subsection to command line flags. Anything in that subsection is passed to the camera command (whichever for the appropriate camera type, fswebcam, raspistill, or wget)

        • Removed pallet from fswebcam (USB attached cameras, despite its name). It will automatically attempt to find the best, or you can specify one, example:
          ./DuetLapse.py -duet 192.168.7.101 -dontwait -seconds 3 camparms -parms -p YUYV

        • Removed -q from fswebcam. Default is 35. You can override, same as above.

        • Slightly changed the loop timer, to beat on the printer a little less often.

        *** IMPORTANT *** Found a bug in DuetWebAPI and fixed it, you must download this as well. Therefore, pull these two things into the same directory. One way to do this would be:

        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

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

          Also, added quotes around the wget URL.

          Delta / Kossel printer fanatic

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

            Still thinking about overlay of Z, print time, etc.

            Delta / Kossel printer fanatic

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

              @Danal said in DuetLapse available for Alpha testing:

              Also, added quotes around the wget URL.

              👍 😀

              ~ 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
              • tekkydaveundefined
                tekkydave
                last edited by

                @Danal what ide / dev tools do you use for python development. I'm using Eclipse for c/c++ and Netbeans for Java. Is there a tool for python that will allow local (Ubuntu) testing and remote deployment to the pi?

                ~ 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

                  For Python, I edit with Sublime on a PC. It could be any editor or IDE that you like that has syntax highlighting or whatever. I interface to the Pi by doing this on the Pi:

                  # If you want to be able to edit files on the Pi from windows, via a netshare (not a mapped drive):
                  sudo apt-get install samba
                  sudo smbpasswd -a pi
                  sudo nano /etc/samba/smb.conf   # and change 'read only = yes' to no. 
                  # Then use a UNC like '\\192.168.7.101\pi' in a file open in your favorite editor.
                  # Quite often, you may have to start with just the "\\192.168.7.101" and no subdirectory to get
                  # it to prompt you for userid and password.  Use 'pi' and the password you set above.
                  # You may have to try and retry several times to get connected.  It's worth it. 
                  # BE SURE that your editor HONORS UNIX LINE ENDS and that you turn them on in any new files. 
                  # For windows users, I suggest notepad++ or atom or Sublime Text (that last one costs money. Worth every penny)
                  

                  The big key is the UNC on Windows. \192.168.7.101\pi This is NOT a drive share... and doesn't behave like SMB shares behave. In sublime, if I do an "open folder" on that UNC, I can then click into \192.168.7.101\pi\DuetLapse (or whatever) and see all the files.

                  Note: This WILL cause your editor to hang if it has files/folders open and the Pi goes away. In sublime, I set it to NOT re-open whatever it had at close...

                  Testing? For python there is no "make" or "build" phase, so I just test directly on the Pi. Either VNC if I need graphics, or Winterm and ssh if not.

                  You can, in theory, test on your desktop distro, by building enough "context" around the thing you are testing. Directories, etc. However, many of the things that I'm testing (not necessarily the stuff you are seeing for Duet) is so tightly related to interfaces or other structures in Raspbian and/or the actual Pi hardware, it is just easier to test there.

                  For cross compile, like binaries for ESP32, or the Atmel chips, or similar, I still edit in Sublime, with the PlatformIO plugin. This makes it a cross-platform IDE. I've come to really like PlatformIO (as vs. the more 'Arduino' like environments). It runs a mini-RTOS and is very well documented and very flexible.

                  If I'm working with stuff developed by others for Atmel, then it is Atmel studio all the way.

                  That covers pretty much everything that fits a pattern. There are, of course, one-off environments for exceptional cases.

                  Delta / Kossel printer fanatic

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

                    @Danal thanks - very interesting.

                    ~ 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

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

                      @tekkydave said in DuetLapse available for Alpha testing:

                      @Danal thanks - very interesting.

                      Just noticed the text handling, OUTSIDE the code block, make double backslashes into single. Use the double, as shown in the code block

                      Delta / Kossel printer fanatic

                      1 Reply Last reply Reply Quote 0
                      • gtj0undefined
                        gtj0
                        last edited by

                        Just FYI if you need streaming as well as time lapse. I set up ustreamer as the "owner" of the camera and pointed DuetLapse at its "/snapshot" URL. That way I have both a live stream and the time lapse at the same time.

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

                          "camparams" error
                          dunno if this helps

                          [root@localdev LAPSE]# ./DuetLapse.py -duet http://ender5.local.lan
                          Traceback (most recent call last):
                            File "./DuetLapse.py", line 257, in <module>
                              init()
                            File "./DuetLapse.py", line 74, in init
                              camparms = args['camparms']
                          KeyError: 'camparms'
                          [root@localdev LAPSE]# ./DuetLapse.py -duet ender5.local.lan
                          Traceback (most recent call last):
                            File "./DuetLapse.py", line 257, in <module>
                              init()
                            File "./DuetLapse.py", line 74, in init
                              camparms = args['camparms']
                          KeyError: 'camparms'
                          [root@localdev LAPSE]# host ender5.local.lan
                          ender5.local.lan has address 192.168.89.246
                          [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246
                          Traceback (most recent call last):
                            File "./DuetLapse.py", line 257, in <module>
                              init()
                            File "./DuetLapse.py", line 74, in init
                              camparms = args['camparms']
                          KeyError: 'camparms'
                          [root@localdev LAPSE]# python --version
                          Python 3.7.6
                          [root@localdev LAPSE]#
                          [root@localdev LAPSE]# fswebcam -d /dev/video0 -F 1 kkk
                          --- Opening /dev/video0...
                          Trying source module v4l2...
                          /dev/video0 opened.
                          No input was specified, using the first.
                          Adjusting resolution from 384x288 to 352x288.
                          --- Capturing frame...
                          Captured frame in 0.00 seconds.
                          --- Processing captured image...
                          Unable to load font 'sans': Problem doing text layout
                          Disabling the the banner.
                          Writing JPEG image to 'kkk'.
                          
                          

                          and here you can see how non python developer try to follow up before giving up 😞

                          [root@localdev LAPSE]# ./DuetLapse.py camparms -h
                          usage: DuetLapse.py camparms [-h] [-- ...]
                          
                          camparm -parms xxx where xxx is passed to fswebcam, raspistill, or wget.
                          
                          optional arguments:
                            -h, --help          show this help message and exit
                            -- ..., -parms ...  Extra parms to pass to fswebcam, raspistill, or wget.
                          [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb -parms -d /dev/video0
                          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} ...
                          DuetLapse.py: error: invalid choice: '/dev/video0' (choose from 'camparms')
                          [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb -parms "-d /dev/video0"
                          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} ...
                          DuetLapse.py: error: invalid choice: '-d /dev/video0' (choose from 'camparms')
                          [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb "-d /dev/video0"
                          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} ...
                          DuetLapse.py: error: invalid choice: '-d /dev/video0' (choose from 'camparms')
                          [root@localdev LAPSE]#
                          
                          1 Reply Last reply Reply Quote 0
                          • Danalundefined
                            Danal
                            last edited by

                            Well, drat, I obviously have gaps in my test cases.

                            Will be fixed and upload in 20 min or so.

                            Delta / Kossel printer fanatic

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

                              OK, now fixed.

                              While I was there, I added the ability to press Ctrl+C one time, while waiting for pre-start or print running, and it will move directly to making a video. In other words, if you wish to end it before the print ends, and still want the vid, press Ctrl-C once.

                              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:

                                Well, drat, I obviously have gaps in my test cases.

                                😄

                                I edited the code and removed the whole camparms thing and hardcoded the call to fswebcam to test it. Having some issues now of other kind (that's a fedora vm with usb camera connected trough vm-terminal as the camera with good view of the printer is on usb on my desktop so I can monitor during testing phase 😄 ) so don't have the test video yet but so far it seems to be working. Anyhow the device and resolution are hardcoded? Why? fswebcam will use -d /dev/video0 as default anyways so I don't see reason for you to hardcode it and if user want to use other one like i420:/dev/video1 you can't pass that parametar to fswebcam as you already hardcoded video0, also resolution, what if I want 1280x960 as that's native to C270, you hardcoded 800x600 ?

                                Maybe let fswebcam use default values (low res, video0 ..) and show in help example how to get some decent values (higher res etc..)

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

                                  @Danal that's a nice feature (ctrlc once) 🙂
                                  I'll test the new code asap 🙂

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

                                    @arhi said in DuetLapse available for Alpha testing:

                                    @Danal said in DuetLapse available for Alpha testing:

                                    Well, drat, I obviously have gaps in my test cases.

                                    😄

                                    I edited the code and removed the whole camparms thing and hardcoded the call to fswebcam to test it. Having some issues now of other kind (that's a fedora vm with usb camera connected trough vm-terminal as the camera with good view of the printer is on usb on my desktop so I can monitor during testing phase 😄 ) so don't have the test video yet but so far it seems to be working. Anyhow the device and resolution are hardcoded? Why? fswebcam will use -d /dev/video0 as default anyways so I don't see reason for you to hardcode it and if user want to use other one like i420:/dev/video1 you can't pass that parametar to fswebcam as you already hardcoded video0, also resolution, what if I want 1280x960 as that's native to C270, you hardcoded 800x600 ?

                                    Maybe let fswebcam use default values (low res, video0 ..) and show in help example how to get some decent values (higher res etc..)

                                    Yeah, you have very valid points. I THOUGHT I did the minimum to get a usable image... but it really looks like I should have let more things default.

                                    I can do it two ways:

                                    1. Remove everything I can and risk the auto stuff not working for a true "newbie" for some reason or another

                                    (Probably going to do this... low risk...)

                                    1. Have camparms replace EVERYTHING, except the file name.

                                    Delta / Kossel printer fanatic

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

                                      OK, I did a little of both. Removed quite a bit from the 'defaults', AND changed it so that if you specified 'camparms -parms' the only thing that is added is the filename.

                                      And, introduced "vidparms -parms '. Works the exact same way, except it is passed to ffmpeg.

                                      Ready for test right now.

                                      Delta / Kossel printer fanatic

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

                                        pi@duet3:~/DuetLapse $ ./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
                                        
                                        pi@duet3:~/DuetLapse $ ./DuetLapse.py camparms -h
                                        usage: DuetLapse.py camparms [-h] [-- ...]
                                        
                                        camparm -parms xxx where xxx is passed to fswebcam, raspistill, or wget.
                                        
                                        pi@duet3:~/DuetLapse $ ./DuetLapse.py vidparms -h
                                        usage: DuetLapse.py vidparms [-h] [-- ...]
                                        
                                        vidparms -parms xxx where xxx is passed to ffmpeg.
                                        
                                        pi@duet3:~/DuetLapse $
                                        

                                        Delta / Kossel printer fanatic

                                        1 Reply Last reply Reply Quote 0
                                        • PaulHewundefined
                                          PaulHew
                                          last edited by

                                          @Danal I have been using your tool for a week now and there is one thing which would be nice.
                                          I have to log into the Pi to send the DuetLapse.py -camera pi - detect layer -duet 192.168.0.7
                                          All this Pi does is run the TimeLapse software.

                                          When it has finished I have to log back in again and do it all again.

                                          Is there a way that it can run all of the time as a service and maybe send a telnet command from the Duet to say,
                                          I am about to print, get ready!!
                                          i.e. M118 P4 S"Print Starting"

                                          Which in turn enables DuetLapse with the users setting.

                                          Just a thought

                                          Regards,
                                          Paul.

                                          RailCore II - Duet Mini + 1LC, Voron V0.1 - Duet Mini
                                          Voron 2.4 disassembled..... Waiting for the RailCore Mini....

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

                                            I will think about a way to do this... while minimally banging on the printer between prints.

                                            Delta / Kossel printer fanatic

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