Focus bracketing scripts sometimes stops at "shoot" command - page 4 - Script Writing - CHDK Forum

Focus bracketing scripts sometimes stops at "shoot" command

  • 76 Replies
  • 20210 Views
*

Offline lapser

  • *****
  • 1093
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #30 on: 31 / December / 2012, 13:07:06 »
Advertisements
I believe there may be one scenario where 'shoot' can hang; but I think it is very rare, although using flash seems to increase the likelihood. The attached version should fix it - if the issue is what I think it is then the script should not hang; but it may skip shots.
If anyone could figure it out, you could Phil! Can you tell me what you changed, and what the problem was?
Thanks.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #31 on: 31 / December / 2012, 16:21:26 »
@philmoz

I´m impressed ! You are spot on.

I used your version with my first script (with shoot) to make a 276 shot stack (with flash).
It never stopped , but skipped ca 5 shots as you suspected.

Great work !
Whats the solution ?

/Leif K

Great, thanks for testing.

As I thought, there are some cases where the 'shoot' command doesn't trigger an actual shot in the firmware (possibly some timeout with the flash recharging). This causes the code to hang waiting for the shot that never happened to finish.

I'll post the update to the current release and trunk versions shortly - this will avoid the hang at the expense of missed shots.

I am currently testing a change in my philmoz-reorg branch that allows the 'shoot' command to return whether or not the shot actually happened. This way you can test the return value and if the shot was missed you can try again (without altering the focus distance).

I've attached a test build with this code if you want to try it. Be sure to replace all the files on your SD card from the .ZIP file (the modules in my branch are not compatible with release 1.1).

The script code would look like this:
Code: [Select]
sleep 2000

  for s=1 to n
   shoot v
   if v=1 then
     get_focus f
     get_dof d
     g=f+d*2/3
     set_focus g
     print f,d,g
     if g>500000 then s=n
     if d<0 then s=n
   else
     print "Missed shot"
     sleep 500
   endif
  next s

end

Also when the camera crashes it helps to get the crash dump and attach it to a post here.
You can dump the ROMLOG in the Miscellaneous stuff / Debug parameters / Save ROM crash log menu.
This saves the dump from the last crash to ROMLOG.LOG on the SD card - so you can run this now and get the dump from the last crash that happened.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #32 on: 31 / December / 2012, 16:25:25 »
I believe there may be one scenario where 'shoot' can hang; but I think it is very rare, although using flash seems to increase the likelihood. The attached version should fix it - if the issue is what I think it is then the script should not hang; but it may skip shots.
If anyone could figure it out, you could Phil! Can you tell me what you changed, and what the problem was?
Thanks.

It appears that even though the camera goes through all the motions of shooting it doesn't actually take the shot. This means raw_savefile doesn't get called so state_shooting_progress is never set to SHOOTING_PROGRESS_PROCESSING. The action stack then hangs on the AS_WAIT_SAVE step.

The change is to wait for !shooting_in_progress() in AS_WAIT_SAVE instead.

Using the flash seems to make this happen more often.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline lapser

  • *****
  • 1093
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #33 on: 31 / December / 2012, 21:57:20 »
It appears that even though the camera goes through all the motions of shooting it doesn't actually take the shot. This means raw_savefile doesn't get called so state_shooting_progress is never set to SHOOTING_PROGRESS_PROCESSING. The action stack then hangs on the AS_WAIT_SAVE step.

The change is to wait for !shooting_in_progress() in AS_WAIT_SAVE instead.

Using the flash seems to make this happen more often.
Yes, it looked to me like waiting for get_shooting() to go back to 0 was enough. I even changed the name of AS_WAIT_SAVE to AS_WAIT_NOT_SHOOTING_IN_PROGRESS, although I had to resist the urge to give it an American style name, and call it "AWNSIP", or just "JOE".

There's also an AS_WAIT_FLASH in there that doesn't seem to be necessary on my sx260. get_shooting() stays 0 until the flash is charged, it appears.

Do you know why the camera misses shots? My theory is that the press/release shoot_full happens before the camera can recognize it. Maybe the flash makes that more likely?

Anyway, just got my new press/release/click routines finished, after tracking down a bug all day. They wait for shutter_open_tick_count to change with shoot_full or shoot_full_only, which means the camera really did take a shot. I just press the key and wait for the shutter. There's no need to bother with get_shooting(). shoot() can be replace by click("shoot_full"), except for the flash_ready wait. I should have something ready to test sometime next year, which is a few hours away still for me. It's time to have an AWNSIP or a ZWEISIP of champagne. Happy New Year. _ Joe
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos


*

Offline philmoz

  • *****
  • 3445
    • Photos
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #34 on: 31 / December / 2012, 22:31:38 »
There's also an AS_WAIT_FLASH in there that doesn't seem to be necessary on my sx260. get_shooting() stays 0 until the flash is charged, it appears.

That's not the case on the G12 and G1X. The get_shooting() / shooting_in_progress() value goes to one shortly after the shutter half press even if the flash is not re-charged. The AS_WAIT_FLASH ensures that the shot is taken with flash when the KEY_SHOOT_FULL is done - on some cameras I suspect it will take the shot without flash if AS_WAIT_FLASH is removed.

Quote
Do you know why the camera misses shots? My theory is that the press/release shoot_full happens before the camera can recognize it. Maybe the flash makes that more likely?

There's at least 50 - 60 msec between the KEY_SHOOT_FULL press and release so it's unlikely the camera would miss it. I suspect the firmware decides the shot can't be taken for some reason so it ignores the full shutter press.

Happy New Year all.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #35 on: 01 / January / 2013, 09:03:46 »
Happy New Year all.

Happy New Year Phil !

As a matter of interest, if it is sunny there, pointing your camera slightly downwards towards an 'average' brightness scene, what Bv96 value do you get ?

(I assume brightness in ft-candles = 2 ^ (Bv96/96) ?)


David

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #36 on: 01 / January / 2013, 09:23:38 »
@philmoz
I have tested your test-version 1.2.0 with this script:
Code: [Select]
rem Leif Karlsson
@title Focus bracketing
@param n Max number of steps
@default n 300

sleep 2000

  for s=1 to n
   shoot v
   if v=1 then
     get_focus f
     get_dof d
     g=f+d*2/3
     set_focus g
     print f,d,g
     if g>500000 then s=n
     if d<0 then s=n
   else
     print "Missed shot"
     sleep 500
   endif
  next s

end

It works perfectly ! When it skips a shot, it takes a new one without altering the focus distance.

I also attach the crash-log from yesterdays test...

Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #37 on: 01 / January / 2013, 09:27:45 »
First test stack with 56 shots.
The script skipped once.

Powershot S2 IS + Raynox MSN-202 + CHDK + This script + CombineZP
No tripod or macrorail  ;)

Attached stack and single shot in stack ...



Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #38 on: 01 / January / 2013, 09:31:12 »
Second test stack with 57 shots.
The script skipped twice.

Powershot S2 IS + Raynox MSN-202 + CHDK + This script + CombineZP
No tripod or macrorail  ;)

Attached stack and single shot in stack ...

This one is really pushed to the limit with max optical and digital zoom (12 x 4)

A great thanks and a happy new year to you all !!!

*

Offline lapser

  • *****
  • 1093
Re: Focus bracketing scripts sometimes stops at "shoot" command
« Reply #39 on: 01 / January / 2013, 12:30:39 »
Great pictures. I love dead bugs. I assume he's dead isn't he?

I think I know how to do it so it won't miss shots. I'll have something to test out soon, I hope.

Is there any way you could do it without the flash, i.e. get some bright lights?  In the main CHDK menu/Enhanced Photo/Bracketing in Continuous/Distance bracketing, you can do this very rapidly by holding the shutter down. You probably need your hands off the camera, though, to keep from moving it between shots, so what you've got sounds great.

Many thanks for the help in testing.
EOS-M3_120f / SX50_100b / SX260_101a / G1X_100g / D20_100b
https://www.youtube.com/user/DrLapser/videos

 

Related Topics