get_shooting - Script Writing - CHDK Forum supplierdeeply

get_shooting

  • 9 Replies
  • 1694 Views
get_shooting
« on: 06 / August / 2018, 13:39:52 »
Advertisements
I am trying to determine when the camera is ready to shoot after having completed a (longer) shot. For most of the shooting get_shooting returns 1, but it starts to return 0 before the camera is ready to shoot again. Is there another method?
Best, Lee

*

Offline reyalp

  • ******
  • 12078
Re: get_shooting
« Reply #1 on: 06 / August / 2018, 17:42:47 »
I am trying to determine when the camera is ready to shoot after having completed a (longer) shot. For most of the shooting get_shooting returns 1, but it starts to return 0 before the camera is ready to shoot again. Is there another method?
Unfortunately, there isn't a good way to know exactly when the camera is ready to shoot again.

If you describe a little more what you are trying to do, we might be able go give additional advice.
Don't forget what the H stands for.

Re: get_shooting
« Reply #2 on: 07 / August / 2018, 11:46:08 »
Hi,
I was trying to count shots in the attached interval script.
As it stands the script can be useful for counting a series of continuous bursts, because it sleeps for the period of the burst, and then counts the number of bursts. So the sequence works well: focus, adjust exposure, continuous burst for y seconds, repeat c times.
However when taking longer, single shots it will continue to enter the subroutines "active" and "lightright", pressing and releasing shoot_full and incrementing the counter C all the time.
I suppose I could increase the shooting interval to track with the exposure time (60 seconds!), but there appears to be a "dead zone" after each shot where the camera is saving to the card, and this can vary depending on whether the raw shots are being saved.
Cheers, Lee

Re: get_shooting
« Reply #3 on: 08 / August / 2018, 00:28:51 »
I was trying to count shots in the attached interval script.
Sorry, no time to study your script.

But reading your description I can't help wondering if you are aware that there is a propcase value you can use to monitor what shot number the camera thinks it has just saved?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 12078
Re: get_shooting
« Reply #4 on: 10 / August / 2018, 02:01:39 »
But reading your description I can't help wondering if you are aware that there is a propcase value you can use to monitor what shot number the camera thinks it has just saved?
Yeah, if what SkepticaLee is looking for is just to know how many shots have been taken,  get_exp_count should do.

If the aim is to know when the camera is ready to shoot again, that would be more difficult. get_exp_count generally increments around the time the raw would start saving.
Don't forget what the H stands for.

Re: get_shooting
« Reply #5 on: 16 / August / 2018, 14:27:15 »
Hi all, The only problem I see is that get_exp_count returns the index of the last picture taken. So if you took 10 pictures yesterday and are using a new folder daily, then get_exp_count would be 10. After today's first shot get_exp_count returns 1. So my intervalometer would run correctly with the following code:

rem initialise values
x=get_exp_count
rem counter c
c=0
rem loop until c reaches the value C, the maximum number of shots
rem update value?
if (x<>get_exp_count) then
  x=get_exp_count
  c=c+1
endif

This will not, however work as intended if only one shot was taken in the previous folder, because x will start as 1 and after the first shot it will be updated to 1, i.e. the first shot will be taken twice. So you would always end up with one more shot than the value C allows.

Don't suppose much can be done about it, except to take one fresh shot at the beginning of each day.

Cheers, Lee
« Last Edit: 16 / August / 2018, 14:43:10 by SkepticaLee »

*

Offline reyalp

  • ******
  • 12078
Re: get_shooting
« Reply #6 on: 16 / August / 2018, 16:46:50 »
This will not, however work as intended if only one shot was taken in the previous folder, because x will start as 1 and after the first shot it will be updated to 1, i.e. the first shot will be taken twice. So you would always end up with one more shot than the value C allows.
Yeah, I was going to suggest that approach, but hadn't thought of the daily folder thing. The image counter behavior is also somewhat camera and setting specific.

Quote
Don't suppose much can be done about it, except to take one fresh shot at the beginning of each day.
If you use lua, you can can use one of the shooting hook counters (https://chdk.wikia.com/wiki/Script_Shooting_Hooks) to take the actual number of shots taken taken by a script. You don't have to use the rest of the functionality, you can just check hook_shoot.count() or hook_raw.count(). These are guaranteed to start at 0 when your script starts, and (barring bugs in the port) increment once each the the corresponding stage of shooting is reached.

I suppose the counters could be made available in ubasic.

The image counter flash param includes both the folder and shot number, but is also only available in lua.

I realize switching to lua might be more than you want to get into, but it does give you a lot more options.
Don't forget what the H stands for.

Re: get_shooting
« Reply #7 on: 08 / January / 2019, 12:48:45 »
Thanks for the comment, reyalp.
I've visited this problem again, because I wanted to design a one-size-fits-all intervalometer, i.e. one that would do shots at fixed intervals (although I'm convinced that rawopint is the best for this kind of shooting), but also bracketed series ("superbrackets") as well as long continuous sequences.
What has occurred to me in the last couple of days is the difference in behaviour between
shoot
and
press/release/click "shoot_full"
which as far as I can see is not clearly documented.
If you set a camera to take a custom-timed series of, say, 10 shots after 0 s wait, then shoot halts the execution of the program until the 10 shots have been taken. However, if press/release/click shoot_full is used, the program immediately moves forward to the next line. This can be demonstrated by using the attached script.
In the case of shoot, the script prints one line to the output file, starts and finishes shooting, and only then enters the loop at the end.
In the case of press/release/click shoot_full, the script moves onto the loop before shooting is completed. In this way the internal workings of updating get_exp_count and get_free_disk_space can be revealed. E.g. on an SX160 get_exp_count is updated about 550 ms before the disk space changes.
For me this means that my intervalometer wsill have to use shoot when taking multiple brackets, so that the loop in my program can count the number of brackets correctly, otherwise it should use press shoot_full/sleep x/release shoot_full for longer continuous shooting, because shoot and continuous shoot on their own will only lead to a single shot being taken.
Took some time to get my head around this.


Re: get_shooting
« Reply #8 on: 08 / January / 2019, 13:00:03 »
press/release/click shootfull does exactly the same thing as mashing down the shutter button and releasing it mechanically. You don't wait for focus or exposure to be read and set, and if you do it fast enough you might not even get an image. Missing the half press step can cause problems.

That's because those functions just fake the electrical contact closures associated with physically pressing the shutter button.

The CHDK shoot functions go through the full half press / full press sequence and they wait for the camera to be ready at each step. Much different processes that should be handled differently in your script.

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 12078
Re: get_shooting
« Reply #9 on: 08 / January / 2019, 17:17:15 »
so that the loop in my program can count the number of brackets correctly, otherwise it should use press shoot_full/sleep x/release shoot_full for longer continuous shooting, because shoot and continuous shoot on their own will only lead to a single shot being taken.
Took some time to get my head around this.
In Lua, you can use the shoot hooks I mentioned in the previous post to count the number of shots or wait for a particular stage of shooting to complete.

You can't detect exactly when the jpeg is done saving, but shoot doesn't either.
Don't forget what the H stands for.