DuetLapse3
-
@JohnOCFII said in DuetLapse3:
Basic test went fine. Now on to setting up and testing
startDuetLapse3
.Great to hear !
Note that there are a couple of small differences between DuetLapse3 and the original. Mainly in the more exotic settings. The defaults Omitted options) should result in more-or-less the same behavior.
I think you will like startDuetLapse3. You can then do most everything from a browser without "gymnastics".
Appreciate any and all feedback.
-
@stuartofmt So far, so good. About 8 short prints so far today.
One interesting observation. I use multiple subdirectories for my GCODE files on my printer. Up until this last print, all the DuetLapse tests I've done were from one directory. I just did a small test from another directory (at the same level in the printer GCODE files hierarchy), yet it appears DuetLapse created a separate subdirectory for this job, and created and kept all the JPEGs for this last movie.
Here is the directory tree:
pi@octocore:/opt/DuetLapse $ tree . ├── DuetLapse3.py └── octocore └── railcore-localdomain ├── 4974_Camera1_Sun-10-51.mp4 ├── 5343_Camera1_Sun-12-18.mp4 ├── 5868_Camera1_Sun-14-59.mp4 ├── 6261_21-03-21T18˸12˸26.log ├── 6261_Calibration │ └── HoseSideRingTest-v3_0.2mm_PETG_RC │ ├── Camera1_00000001.jpeg │ ├── Camera1_00000002.jpeg │ ├── Camera1_00000003.jpeg │ ├── Camera1_00000004.jpeg │ ├── Camera1_00000005.jpeg │ ├── Camera1_00000006.jpeg │ ├── Camera1_00000007.jpeg │ ├── Camera1_00000008.jpeg │ ├── Camera1_00000009.jpeg │ ├── Camera1_00000010.jpeg │ ├── Camera1_00000011.jpeg │ ├── Camera1_00000012.jpeg │ ├── Camera1_00000013.jpeg │ ├── Camera1_00000014.jpeg │ ├── Camera1_00000015.jpeg │ ├── Camera1_00000016.jpeg │ ├── Camera1_00000017.jpeg │ ├── Camera1_00000018.jpeg │ ├── Camera1_00000019.jpeg │ ├── Camera1_00000020.jpeg │ ├── Camera1_00000021.jpeg │ └── Camera1_00000022.jpeg ├── 6261_Camera1_Sun-18-23.mp4 └── 812_Camera1_Sat-21-57.mp4 4 directories, 29 files pi@octocore:/opt/DuetLapse $
-
@JohnOCFII said in DuetLapse3:
@stuartofmt So far, so good. About 8 short prints so far today.
One interesting observation. I use multiple subdirectories for my GCODE files on my printer. Up until this last print, all the DuetLapse tests I've done were from one directory.
So it looks like the print job was named /Calibration/HoseSideRingTest-v3_0.2mm_PETG_RC Does this seem right given your situation ? Code-wise, the print job name is appended to the process id and a directory created accordingly.
If this is not the case then I'd need more info to make sense of it - specifically
(1) The options used to start DuetLapse3
(2) The hostname of the computer running DuetLapse3 (looks to be octocore)
(2) the duet printer name (looks to be railcore-localdomain)
(3) the full printjobname and the gcode directory in which it was placed.Are the directories cleaned up when you start a new (only one running) instance of DuetLapse3?
Take a look at the documentation and see if its clear. If not - let me know and I will fix.
EDIT: I can probably (and likely will) suppress the possibility of higher level directory names - but in any case understanding your situation will be helpful.
-
@stuartofmt said in DuetLapse3:
So it looks like the print job was named /Calibration/HoseSideRingTest-v3_0.2mm_PETG_RC Does this seem right given your situation ? Code-wise, the print job name is appended to the process id and a directory created accordingly.
This is correct.
Are the directories cleaned up when you start a new (only one running) instance of DuetLapse3?
Yes -- I think what confused me is that at the time I created that tree, the directory and JPEGs were still around -- I was thinking they got cleaned up at the end of the current job, and not the start of the next job.
I actually prefer your current design.
Also - I am really glad of your current design for another reason -- I love the log file! I ran a 7.5 hour print yesterday evening, and my Pi lost network connectivity 5 times during the print. All the successfully captured images are still available for me to re-run through FFMPEG! Separately I need to try to use the wired Ethernet instead of WiFi to see if the WiFi on this particular Pi is the issue.
-
@JohnOCFII said in DuetLapse3:
I ran a 7.5 hour print yesterday evening, and my Pi lost network connectivity 5 times during the print. All the successfully captured images are still available for me to re-run through FFMPEG! Separately I need to try to use the wired Ethernet instead of WiFi to see if the WiFi on this particular Pi is the issue.
I mostly use a Pi with my Duet2 Wifi. Both are fairly close to the router - so good connectivity. Nonetheless - DuetLapse3 should (provided the connectivity issues do not last too long) work through them. I tested the code by deliberately turning off the Duet , performing multiple emergency restarts etc. In short - with a bit of luck - DuetLapse3 should create the video provided it saw the transition to "idle" at the end of the print job. Note that today I discovered a possible "transient status" that may prevent a video being created at the end of the print job. It's possibly related to my custom ending gcode - but I have a fix
In any case - "yes", that's a good reason for leaving the captured images in place at the end of the job. Also - if you have not noticed - you can use startDuetLapse3 to zip up the directory (after the DuetLapse3 instances has terminated) then download the resultant zipfile, all from a browser.
I'm thinking about adding a "create video" button to simplify the recovery - but at some point - I've go to stop adding in "stuff".
-
@stuartofmt It is great to see how your mind works on this stuff!
FYI -- I did disable WiFi, and switch to wired Ethernet. I am no longer seeing connectivity issues, but Duetlapse is still seeing "something" network related. I will gladly 100% blame this on the weak networking code in the firmware on the Duet2 -- whatever library is used in this hardware (not from dc42 -- but whatever the vendor provides) seems to act as if it hasn't seen changes to networking code since the 1990's.
This is what I see a few times an hour:
railcore.localdomain !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! railcore.localdomain There was a network failure: HTTPConnectionPool(host='railcore.localdomain', port=80): Max retries exceeded with url: /rr_model?key=state.status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x764ad170>: Failed to establish a new connection: [Errno 111] Connection refused')) railcore.localdomain !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! railcore.localdomain
or
railcore.localdomain !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! railcore.localdomain There was a network failure: HTTPConnectionPool(host='railcore.localdomain', port=80): Max retries exceeded with url: /rr_model?key=state.status (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7664cdf0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')) railcore.localdomain !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! railcore.localdomain railcore.localdomain getDuetStatus failed to get data. Code: 9999 Reason: Connection Error railcore.localdomain Printer is disconnected - Trying to reconnect railcore.localdomain ****** Duet status changed to: processing ***** railcore.localdomain ****** Print State changed to: Capturing *****
As you suggested, DuetLapse seems to work past it without issue.
John
-
The problem is that DuetLapse3 is asking for the current status and not getting a reply. It dutifully retries after a brief pause but will eventually give up. For the most part - it can work through and it does not matter if it misses capturing an image.
It may be pure network related or it mat be that DWC is "overloaded" servicing too many requests per unit time. If you have other applications getting status frequently (lets say every second) then that might be an issue - but other than that - 1990s network code seems as good a guess as any.
-
I'd guess that running DWC on two other devices in addition to DuetLapse might have had the Duet2 board confused...
Today, after a fresh start on the printer and after quitting DWC after the first layer completed, I didn't see any disconnect errors.
Here's a nice example DuetLapse3 timelapse. This was a 3 hour 20 minute print in a 53 second timelapse.
-
Still figuring stuff out for my setup, but this is getting fun
-
@GoremanX said in DuetLapse3:
Still figuring stuff out for my setup, but this is getting fun
Really raising the bar with music... I'll have to see what I can find!
-
@JohnOCFII said in DuetLapse3:
Really raising the bar with music... I'll have to see what I can find!
Hah! "Stock" previews from Adobe Premiere Pro. Not even the fully licensed track, just the so-called low quality preview version. If enough people view the video, YouTube will flag it, but it's fine to use for a limited expected audience
-
@stuartofmt I'd like some guidance before I head off in the wrong direction.
I've set up (but not yet started):
/etc/systemd/system/StartDuetLapse3.service
which calls:
/opt/DuetLapse/StartDuetLapse3.py
which calls:
/opt/DuetLapse/DuetLapse3.py
Now -- when I've been testing this over the last few days manually (without the systemd service, and without using StartDuetLapse3) I've used the following command line:
python3 /opt/DuetLapse/DuetLapse3.py -duet railcore.localdomain -camera1 web -weburl1 http://octocore.localdomain:8081/snapshot -detect layer -extratime 4
So switching to this service-initiated launch, do I put all the arguments in the systemd service file like this?
ExecStart=python3 /opt/DuetLapse/StartDuetLapse3.py -port 8082 -args="-duet railcore.localdomain -camera1 web -weburl1 http://octocore.localdomain:8081/snapshot -detect layer -extratime 4"
Thanks for your review!
John
-
@JohnOCFII said in DuetLapse3:
So switching to this service-initiated launch, do I put all the arguments in the systemd service file like this?
ExecStart=python3 /opt/DuetLapse/StartDuetLapse3.py -port 8082 -args="-duet railcore.localdomain -camera1 web -weburl1 http://octocore.localdomain:8081/snapshot -detect layer -extratime 4"
Essentially - yes but note:
(1) it looks like you have capitalized startDuetLapse3.py
(2) startDuetLapse3 does not directly call DuetLapse3. Its a browser accessed service that provides various controls. The "args=" option sets a default string (that you can edit) in the browser interface. For example my startDuetLapse3.service file looks like this:[Unit] Description=duetLapse3 Service After=multi-user.target [Service] WorkingDirectory=/home/pi/Lapse User=pi Type=idle ExecStart=python3 /home/pi/Lapse/startDuetLapse3.py -port 8082 -topdir /home/pi/Lapse/Captures -args=" -duet 192.168.86.235 -port 8083 -basedir /home/pi/Lapse/Captures -dontwait -seconds 15 -detect none -weburl1 http://192.168.86.230:8081/stream.mjpg -camera1 other -camparam1="'ffmpeg' +ffmpegquiet + ' -y -i ' +weburl+ ' -vframes 1 ' +fn+debug"" Restart=always [Install] WantedBy=multi-user.target
and results in the browser showing this (when start is pressed).
The text above the second start is what is extracted from args=. It's editable (or you could leave out args= and type / copy / paste into that field.
The important thing is its not until the second "start" is pressed that DUetLapse3 is started. In this manner you can easily manage multiple instances if you wish.
Hope this helps.
P.S. I've made a few tweaks. likely out in a day or two. Mainly the ability to create video from startDuetLapse3 (if the dir still exists).
-
@stuartofmt Thanks for the review.
Checking status now, I get the following message:
pi@octocore:/etc/systemd/system $ sudo systemctl status startDuetLapse3.service ● startDuetLapse3.service - DuetLapse3 timelapse launch script Loaded: loaded (/etc/systemd/system/startDuetLapse3.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2021-03-25 19:51:17 CDT; 13h ago Main PID: 471 (python3) Tasks: 2 (limit: 2062) CGroup: /system.slice/startDuetLapse3.service └─471 /usr/bin/python3 /opt/DuetLapse/startDuetLapse3.py -port 8082 Mar 26 04:10:03 octocore python3[471]: method() Mar 26 04:10:03 octocore python3[471]: File "/opt/DuetLapse/startDuetLapse3.py", line 198, in do_GET Mar 26 04:10:03 octocore python3[471]: split_referer = referer.split(":", 1) Mar 26 04:10:03 octocore python3[471]: AttributeError: 'NoneType' object has no attribute 'split' Mar 26 04:10:03 octocore python3[471]: ---------------------------------------- Mar 26 04:10:03 octocore python3[471]: Exception happened during processing of request from ('192.168.88.1', 40405) Mar 26 04:10:03 octocore python3[471]: Traceback (most recent call last): Mar 26 04:10:03 octocore python3[471]: File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread Mar 26 04:10:03 octocore python3[471]: self.finish_request(request, client_address) Mar 26 09:38:44 octocore systemd[1]: startDuetLapse3.service: Current command vanished from the unit file, execution of the command list won't be resumed. pi@octocore:/etc/systemd/system $
Looking at that line 198 in startDuetLapse3.py it looks like it has something to do with parsing the URL.
Here is the ExecStart line from the service file:
ExecStart=python3 /opt/DuetLapse/startDuetLapse3.py -port 8082 -args="-duet railcore.localdomain -camera1 web -weburl1 http://octocore.localdomain:8081/snapshot -detect layer -extratime 4"
Thoughts?
John
-
Feature suggestion: add an option to create a symbolic link that always points to the second-most-recent photo for a currently-running timelapse. For example, the current directory for captured images on one of my printers is: /mnt/remote/KosselXT/duet/21439_CFFFP_Riser_191x25_links
An option to have a symbolic link at /mnt/remote/KosselXT/current.jpg that always points to the second-most-recent image would allow us to add it to the DWC interface as a webcam image by serving that file over http. The symbolic link would have to be updated every frame. The reason I'm specifically referring to the second-most-recent image is that sometimes the current image isn't complete yet when DWC tries to display it. Pointing the link to the second-most-recent image would always display a complete image, at the expense of being a few seconds behind. -
@johnocfii said in DuetLapse3:
I’ve found that it’s important / helpful to prove the command independently of systemctl first. What do you get from the log file when you use the same command with -verbose ?
-
@goremanx
Not sure what this has to do with DWC and Duet Lapse3. Why not just point DWC to the same camera source as DuetLapse3? -
@stuartofmt Because DWC's "webcam" feature only supports a url pointing to a specific image over http. I used to generate that image with my pi camera, but now the camera is monopolized by the timelapse. Since the image I want to see has already been taken for the timelapse, it seems like a good way to kill two birds with one stone. That image could also be used to show the most recent frame on the timelapse status page.
-
@goremanx said in DuetLapse3:
but now the camera is monopolized by the timelapse.
What software are you using to serve up the images from the pi camera ? If its raspistill - yes, it (and some others) only accept a single connection?
Here is what I use - simple and effective: I often have multiple DuetLapse3's, a separate browser and DWC (be sure to enable webcam image in an iframe) - all connected to the one instance.
line 75 can be edited for the port number, line 70 for rotation.
-
@johnocfii said in DuetLapse3:
referer = self.headers['Host'] split_referer = referer.split(":", 1)
What this is saying is that the request (from the browser) did not contain a well formed header url (what you would normally see in the first part of the address bar) E.g. localhost:port ..... or ipaddress:port ......
Just why I cannot say.Does it generally work ? Was this a transient ? Is it repeatable in any way ?
I'm about to release a small upgrade and might be able to include some checks / mitigation but don't really know what to do if it fails. Any verbose logs or other info would be especially helpful.