script hangs...sometimes - Script Writing - CHDK Forum

script hangs...sometimes

  • 5 Replies
  • 3860 Views
script hangs...sometimes
« on: 16 / October / 2011, 16:21:44 »
Advertisements
Hello,

Excuse my poor english, please.
I am using chdk with IXUS 100 IS on small aircraft model.
Small lua script shoots often how it can by simulating half and full pres pressed buttons. (need to override ndfilter and manualy set time, but it look like it is not the problem. only simulating pressing shoot button hangs... not tested it too much, shots are taken with long times and are too shaked)
Script runs without error on the ground (has not seen problem), but in air it hangs on "half_press" and "normally" green rectangle is yellow (so, it failed to measure exposition?). There is possible problem with vibrations or with propeller, which runs trough screen (about 80% of image) and disturbs focusing algorithm.
Problem ocures always with motor running. After some hundred meters of running up, motor is stopped, propeller folds and is no longer visible. (and does not produce vibrations).

When i found it hanged (after landig), pressing shoot button is sufficient to stop script and run it again, but there was many unrepeateable moments missed.  :-/

So, camera is not dead, but script hangs in function which I cannot control. Is there way to restart it automaticaly? (used to know watchdog on small microcontrollers)

Today is shoots 47 shots and halted, yesterday 250 shots (steam engine runs around next 2 minutes later :-(  But sometimes I have run couple of flights and camera runs whole time. It is hard to test something ocuring only sometimes.

I have found similar problem on this forum, but they identified it as a auto-flash problem.
( http://chdk.setepontos.com/index.php?topic=1498.0 ) I have flash disabled all the time, so not my case.

Video never stoped, but it is not usable for my purpose.

Have seen or solved this problem anybody?
Or sugestion what to try? (days are short, so there is not much time to fly)

Re: script hangs...sometimes
« Reply #1 on: 16 / October / 2011, 16:50:04 »
Can you post your script ?  If you are doing something like this then maybe you can add a counter to the loop and "time out" if it repeats too many times ?  That way if it fails to focus you can do a "shoot_full" and take your chances.  Then loop around and try again.

Code: [Select]
press("shoot_half")
repeat sleep(50) until get_shooting() == true
Ported :   A1200    SD940   G10    Powershot N    G16

Re: script hangs...sometimes
« Reply #2 on: 16 / October / 2011, 17:20:22 »
Thank you for reply.

Whole script is here: http://mti.frystacko.cz/ruzne/cvak_neiso.lua. (i have not found correct button here).
(it is mixture of some other scripts...really disgusting one (not expected to publish so early) ... sorry :-) In case of emergency, I swear to clean it a bit. :-D )

I have suspected infinite cycle some time ago, so I have counters already there....
Next thing I have tried was "poor programmers debugger" ... i have printed numbers after every step of script and it printed last number before entering "half_press", so I expect it does not exit it.

by the way... I have 2 cameras, ISUS 100 IS both. Second one does the same thing once, so i have not tested it any more... it is a spare piece for "not so safe" landing...  and there was some in past :-/

Re: script hangs...sometimes
« Reply #3 on: 16 / October / 2011, 17:50:22 »
I have suspected infinite cycle some time ago, so I have counters already there....
Next thing I have tried was "poor programmers debugger" ... i have printed numbers after every step of script and it printed last number before entering "half_press", so I expect it does not exit it.
The statement got stuck on was line 45 in your script ?


Code: [Select]
--[[
rem 26-Oct-2008 by msl
@title MujCVAK Tv,Ne-ISO
@param a integer value  [Tv]
@default a 0
@param b key delay [ms]
@default b 80
@param c shoot delay [s]
@default c 0
]]
 
function print_Tv()
tv_output = {"64s","50s","40s","32s","25s","20s","15s","13s","10s","8s","6s",
"5s","4s","3.2s","2.5s","2s","1.6s","1.3s","1s","0.8s","0.6s","0.5s","0.4s",
"0.3s","1/4s","1/5s","1/6s","1/8s","1/10s","1/13s","1/15s","1/20s","1/25s",
"1/30s","1/40s","1/50s","1/60s","1/80s","1/100s","1/125s","1/160s","1/200s",
"1/250s","1/320s","1/400s","1/500s","1/640s","1/800s","1/1000s","1/1250s",
"1/1600s","1/2000s","1/2500s","1/3200s","1/4000s","1/5000s","1/6400s",
"1/8000s","1/10000s"}
print_tv = "Tv  : "..tv_output[tv_input+19]
end
 
--script start
 
if a < -18 then a = -18 end
if a > 40 then a = 40 end
if b < 50 then b = 50 end
if c < 0 then c = 0 end
tv_input = a
key_delay = b
shoot_delay = c
mujav=0
mujtv=0
mujtmp=0
max_zoom = get_zoom_steps()
zoom = get_zoom()
mujiso_orig=get_iso_real()
if mujiso == 0 then
print("Nastav ISO na pevne")
else
print("Iso_start:",mujiso)
end
 
repeat
press "shoot_half"
cykl=500
repeat
sleep(10)
  if (cykl>0) then
     cykl = cykl -1
     else
     break
  end
 
  until get_shooting() == true
sleep(20)
TV = get_prop(262)
tv_input= TV/32
print("TV: "..TV.." ")
mujtmp=get_propset()
muj1=get_prop(23)
muj2=get_prop(296)
if muj1>450 then
  posun=10
  else
  posun=0
end
TV = (tv_input+posun) * 32
if get_propset() == 2 then
set_prop(262,TV)
else
set_prop(69,TV)
end
sleep(10)
press "shoot_full"
release "shoot_full"
release "shoot_half"
cykl=500
repeat
sleep(10);
if (cykl>0) then
cykl = cykl -1
else
break
end
until get_shooting() == true
until false


(also - probably not an issue but a sleep statement between the press "shoot_full" and release "shoot_full" on line 75 might make sense ?)
« Last Edit: 16 / October / 2011, 18:12:59 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline fe50

  • ******
  • 3152
  • IXUS50 & 860, SX10 Star WARs-Star RAWs
    • fe50
Re: script hangs...sometimes
« Reply #4 on: 16 / October / 2011, 18:18:51 »
For this application i suggest to set the camera to a fixed focus (e.g. to infinite).
Also don't use commands like shoot or shoot_half since the camera always re-focuses (and will fail due to the vibrations).
Since the Ixus series don't have a MF mode, try setting the camera to INF manually or to set a fix focus with the camera's AF lock feature...

Re: script hangs...sometimes
« Reply #5 on: 16 / October / 2011, 18:39:21 »
Since the Ixus series don't have a MF mode, try setting the camera to INF manually or to set a fix focus with the camera's AF lock feature...
Something like this when the script first starts ( with the camera / plane pointrd into the distance and the motor off) :
Code: [Select]
press("shoot_half")
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false

set_aflock(1)
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal