supplierdeeply

focus in multilapse.lua (was Re: Setting focus from scripts or menus)

  • 26 Replies
  • 6305 Views
*

Offline Sdack

  • ***
  • 191
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #10 on: 14 / August / 2018, 01:55:07 »
Advertisements
I was trying do do exactly what you suggest

Use cron to start Multilapse once every half hour (during a specified period of daytime)
Then use cron to kill the process after one shot has been taken (I made the interval in Multilapse very long, so as to not take a second shot before shutdown.

Reyalp suggested this was a poor approach so I've been trying to alter the multilapse, multilapse-config.lua and multilapse.lua so that I achieve my aims wihout the use of cron

However I have failed thus far, partly because the instructions to add breaks before the end of the main loop in multilapse.lua and also in the bash script, multilapse, didn't work quite as I expected and I lack the logic to understand why.

While attempting my coding I found an error in my cron script which may be the cause of my earlier problem so I'm going to see if I can get back onto solid ground (in my understanding), rather than the mud I'm currently sinking in.

I know I should probably spend some time getting to know lua better, so I can use the relatively simple loop statements and such but I have so many other things to learn at the moment I can't spare the time.

In my defence I wasn't asking for anyone to fix this for me.. I wanted to understand what was going on and suspected I'd come across an anomaly, or perhaps new area of learning related to timing events.  However it now seems I've just learned again that I'm [admin: avoid swearing please] at scripting (cron error).
Thanks for trying

Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #11 on: 14 / August / 2018, 07:09:50 »
In my defence I wasn't asking for anyone to fix this for me.. I wanted to understand what was going on and suspected I'd come across an anomaly, or perhaps new area of learning related to timing events.  However it now seems I've just learned again that I'm [admin: avoid swearing please] at scripting (cron error).
No need to be defensive - your project sounds interesting and we are quite happy to help.

I'm curious about why you changed design direction?  Last I heard, you were going to have a low power Arduino activate the camera via a relay when you wanted a shot taken, and activate both the camera and a Raspberry Pi occasionally to transfer pictures from the camera and store them offline.  A very power conservative design. 

Did you give up on that idea?  I sounded like a very good approach to me.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 191
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #12 on: 14 / August / 2018, 07:33:42 »
Hi WW,
Sorry I was rather defensive.. I really appreciate the generosity and help you guys provide and don't like to appear unwilling to try coding for myself.  However I am really not confident to alter multilapse, with it's related scripts.  I only have a few more days before I install this current rig, so I need to get it working.

I am still very keen to pursue the ultra low power option, for off grid deployment but this current rig will be mains powered, so it's not necessary.

Thanks again
Sdack


Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #13 on: 14 / August / 2018, 07:42:46 »
Hi WW,
Sorry I was rather defensive.. I really appreciate the generosity and help you guys provide and don't like to appear unwilling to try coding for myself.  However I am really not confident to alter multilapse, with it's related scripts.  I only have a few more days before I install this current rig, so I need to get it working.
While attempting my coding I found an error in my cron script which may be the cause of my earlier problem so I'm going to see if I can get back onto solid ground (in my understanding), rather than the mud I'm currently sinking in.
Understood. There is an old engineering saying : "When in doubt, make it stout, out of things you know about."

However I have failed thus far, partly because the instructions to add breaks before the end of the main loop in multilapse.lua and also in the bash script, multilapse, didn't work quite as I expected and I lack the logic to understand why.
If you want, you could post your modified script as an attachment with a brief description of what you saw versus what you expected to see?  I'm sure @reyalp (or myself) could shed some light there is you are still interested.

Quote
I am still very keen to pursue the ultra low power option, for off grid deployment ....
I'll be here.
« Last Edit: 14 / August / 2018, 07:44:53 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 11591
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #14 on: 14 / August / 2018, 13:28:04 »
I was trying do do exactly what you suggest
My confusion was specifically about
Quote
I'm hacking into this Multilapse now and hoping to find a way to switch to record mode inbetween shots as you suggested.
The camera must already be in record when shooting, so I don't understand what "between shots" is about. If you mean switching to playback mode, then that should be as simple as sending the 'play' command when you are done shooting.

FWIW, if you just want to run single shots from cron, there's not a whole lot of reason to involve multilapse. Your cron script could just invoke chdkptp to do one remote shoot.

The main reason I'd recommend against killing multilapse is that you have the potential leave things in a confused state if it ever gets killed while it's doing something with the camera (shooting, downloading etc)

That said, if it's working and you only have a day to finish it off, it's entirely reasonable to stick with the what you have  :D
Don't forget what the H stands for.

Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #15 on: 14 / August / 2018, 13:53:01 »
FWIW, if you just want to run single shots from cron, there's not a whole lot of reason to involve multilapse. Your cron script could just invoke chdkptp to do one remote shoot.
I did a quick bash script to demonstrate this (attached).  Works on my system.

Edit the path information in the second command and you should be able to just invoke the script directly from cron.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 191
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #16 on: 14 / August / 2018, 20:16:01 »
Hey guys,
Thank you, thank you, thank you. For the encouragement, the understanding and, of course, the scripts.
I am constantly overwhelmed at your support.
I will try your script WW as soon as I've downed this coffee.

Sorry Reyalp, I did mean 'switch to playback' mode instead of record mode. 

On this, mains-powered, rig I'm want to mitigate heat build up because the enclosure will be in full Sun and it's nearly Spring here in Australia, so the temperatures are rising.  I suspect that sensor heat build up was the cause of my camera shutdowns (at 80 degrees C) last summer and I don't know if Multilapse, as it currently stands, switches off the sensor between shots.  I'm assuming that switching to play mode will definitely shut down the sensor.
Will report back how the cron ptp script works out

*

Offline Sdack

  • ***
  • 191
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #17 on: 14 / August / 2018, 21:06:55 »
Ok, before I even run it, I can see why the script wouldn't run on my system...
Code: [Select]
#!/bin/bash
/home/build/chdkptp/trunk/run -c -e"rec"
/home/build/chdkptp/trunk/run -c -e"rs /home/a/Pictures"
I don't have a directory called trunk
In my chdkptp directory I have the following files and folders:
Code: [Select]
lrwxrwxrwx 1 root root     12 Aug 16  2017 chdkptp -> chdkptp.r745
-rwxrwxrwx 1 root root 216388 Mar  6  2017 chdkptp_gui
-rwxrwxrwx 1 root root    364 Mar  6  2017 chdkptp_gui.sh
-rwxrwxrwx 1 root root 212128 Aug 16  2017 chdkptp.r735
-rwxrwxrwx 1 root root 400332 Aug 16  2017 chdkptp.r745
-rwxrwxrwx 1 root root    270 Aug 16  2017 chdkptp.sh
-rwxrwxrwx 1 root root  15127 Mar  6  2017 COPYING
drwxrwxrwx 2 root root   4096 Mar  6  2017 lib
drwxrwxrwx 3 root root   4096 Mar  6  2017 lua
-rwxrwxrwx 1 root root   2642 Mar  6  2017 README-LINUX-BINARIES.TXT
-rwxrwxrwx 1 root root   1321 Mar  6  2017 README-OSX.TXT
-rwxrwxrwx 1 root root   4415 Mar  6  2017 README-RASPI-LIBS.TXT
-rwxrwxrwx 1 root root   7423 Mar  6  2017 README.TXT
-rwxrwxrwx 1 root root  11140 Aug 16  2017 signal.so
-rwxrwxrwx 1 root root   1641 Mar  6  2017 THANKS.TXT
-rwxrwxrwx 1 root root  32557 Mar  6  2017 USAGE.TXT
Perhaps my installation differs from yours?
Perhaps because it's the Rasbian version?

Also, because the script doesn't switch back to play mode, am I right in assuming the sensor will be on constantly?

I woke up with an insight into Reyalp's loop break suggestion which I will try out now.


Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #18 on: 14 / August / 2018, 21:25:33 »
I don't have a directory called trunk
Perhaps my installation differs from yours?
Perhaps because it's the Rasbian version?
Sorry - didn't test it on a Pi. And my Fedora system is so hacked from years of CHDK stuff that I'm never quite sure what comes in a standard install anymore.  :'(

Quote
Also, because the script doesn't switch back to play mode, am I right in assuming the sensor will be on constantly?
I can make the script one line longer to cover that case.  I didn't spend a lot of time on this because I was not sure if you were stuck on the CRON only mode due to your timeline.

Give me a minute to figure out what a standard chdkptp config looks like.

Edit :
The ancient run script I tried to execute from my demo script sets up some environment variable for chdkptp and then runs the chdkptp executable.  I think reyalp now calls it chdkptp.sh so you can just substitute chdkptp.sh for run in the little script I posted.  Assuming you've edited chdkptp.sh to match your system setup.

Update attached - you still need to check the paths.

And I also added a line to switch the camera back into playback.  Don't forget to go into the Canon menu and set the lens retract delay to 0 sec.
« Last Edit: 14 / August / 2018, 21:46:31 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline Sdack

  • ***
  • 191
Re: focus in multilapse.lua (was Re: Setting focus from scripts or menus)
« Reply #19 on: 14 / August / 2018, 21:55:12 »
Thanks for the update..

Trying it now

 

Related Topics