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 @tekkydave
      last edited by

      @tekkydave said in DuetLapse available for Alpha testing:

      @Danal said in DuetLapse available for Alpha testing:

      I've just been starting a print, and then pause/canceling it.

      Of course, it can do whatever we all agree to... and can code... and dry run is dead simple. I would note that it really only applies to -seconds. A dry run with any kind of -detect is never going to detect anything.

      It detects layer changes when running a simulation but, as you say, since nothing is physically moving the video is going to be a bit boring. Useful if you are testing options or trying simple code changes though. I know squat about python so I need all the help I can get. I do find your code very easy to follow though 🙂

      Thank you. I try to balance being "python-esq" with being readable. For me if nought else.

      How about having the "detect printing" detect BOTH processing and simulation? Since we control if the script is running, I see very little downside to this.

      Delta / Kossel printer fanatic

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

        @Danal said in DuetLapse available for Alpha testing:

        @tekkydave said in DuetLapse available for Alpha testing:

        @Danal said in DuetLapse available for Alpha testing:

        I've just been starting a print, and then pause/canceling it.

        Of course, it can do whatever we all agree to... and can code... and dry run is dead simple. I would note that it really only applies to -seconds. A dry run with any kind of -detect is never going to detect anything.

        It detects layer changes when running a simulation but, as you say, since nothing is physically moving the video is going to be a bit boring. Useful if you are testing options or trying simple code changes though. I know squat about python so I need all the help I can get. I do find your code very easy to follow though 🙂

        Thank you. I try to balance being "python-esq" with being readable. For me if nought else.

        How about having the "detect printing" detect BOTH processing and simulation? Since we control if the script is running, I see very little downside to this.

        That would be the simplest solution I think.

        ~ 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
        • chas2706undefined
          chas2706
          last edited by

          @Danal said in DuetLapse available for Alpha testing:

          Keep the ideas coming!

          In my customised build of Raspbian with duetpi I created a timelapse.desktop entry so that I can access your program from my start menu.

          By default I set it to take a picture upon Z movement.
          So now, when I start a print and the printer is ready all I have to do is click on the program entry in the start menu.

          timelapse.jpg

          Thank you again danal for giving us this great program.

          1 Reply Last reply Reply Quote 0
          • kingfisherundefined
            kingfisher
            last edited by

            I've set it up and it works 🙂
            I did get an error on a small print doing a quick test though
            The error was "requests.exceptions.ConnectionError:

            ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))"

            My guess (Although I'm not a Python expert) is that the pi couldn't keep up saving the images as the layers were only taking 20sec (And its an old V2 pi)

            kingfisherundefined 1 Reply Last reply Reply Quote 0
            • 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
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA