Script for photomapping - page 2 - Script Writing - CHDK Forum supplierdeeply

Script for photomapping

  • 21 Replies
  • 6475 Views
*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #10 on: 15 / November / 2011, 13:28:46 »
Advertisements
Hi All,

Thanks for your input.
I just ran the Lua script and it was able to take a photo every 1.9 seconds. This will be fast enough for now :-)

Indeed, instead of sending a trigger every 1.9 or 2 seconds, I could as well enable continuous trigger. The end result will probably be more or less the same.

One last question: you seem to be in favor of Lua. Are some thing in ubasic not possible, which are possible in Lua?

Thanks

Re: Script for photomapping
« Reply #11 on: 15 / November / 2011, 13:49:48 »
Are some thing in ubasic not possible, which are possible in Lua?

In this forum, the more experienced the developer the more likely they are to be keen Lua advocates.

I prefer uBasic  :)    especially my own special commands.

I have been able to deal with any required photo situation.

To you, it is of zero practical significance.

Re: Script for photomapping
« Reply #12 on: 15 / November / 2011, 14:29:06 »
One last question: you seem to be in favor of Lua. Are some thing in ubasic not possible, which are possible in Lua?
Yes.   Lua currently has string handling,  multicharacter variable names, runs faster and supports file i/o.   

There are some other things related to program structure too, I'm sure, like include files / libraries.

In general,  the resulting code is more elegant.   Which appeals to the professional software people in the group.

« Last Edit: 15 / November / 2011, 14:33:09 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #13 on: 15 / November / 2011, 14:32:36 »
And another question:
My latest Idea is:
 - I enable the USB_POWER signal from my autopilot. My autopilot knows exactly when this occured.
 - The script enables continous trigger (as in the file) and stores the difference in ms between every shot
 - Using post-processing of this file (print_screen), I can more accurately determine on what moment the photo was taken. Instead of second-resolution, I should get millisecond resolution :-)

This is my script:
Code: [Select]
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false

set_aflock(1)

repeat until get_usb_power() > 6
a = get_tick_count()
b = 1
print_screen(true)
repeat
     sleep(100)
     if get_usb_power() > 6 then
            press("shoot_full")
            repeat sleep(100) until get_shooting() == true
    print("#:", b, " -> ", get_tick_count()-1)
    b = b+1
    a = get_tick_count()
     end
until false

Result:

Code: [Select]
#: 1  ->  24259
#: 2  ->  26129
#: 3  ->  29179
#: 4  ->  31289
#: 5  ->  33389
#: 6  ->  36459
#: 7  ->  37479
#: 8  ->  38499
#: 9  ->  40609
#: 10  ->  41629
#: 11  ->  42619
#: 12  ->  44599
#: 13  ->  45619
#: 14  ->  46699
#: 15  ->  48679
#: 16  ->  49699
#: 17  ->  50719
#: 18  ->  52699
#: 19  ->  53719
#: 20  ->  54739
#: 21  ->  56849
#: 22  ->  58929
#: 23  ->  60909
*** INTERRUPTED ***

Unfortunately I get some weird results. In reality 21 photos were taken (or stored on my SD card). My script says there are 23 photos taken: 5 only a second(!) after the previous ones, while my camera can only shoot one picture every 2 seconds (or so I measured).
What could be wrong in my script? Is the script doing a full_shoot before my camera is ready?


Re: Script for photomapping
« Reply #14 on: 15 / November / 2011, 15:09:47 »
How about this (not tested - sorry). _ think get)_shooting() works this way.

Code: [Select]
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false
set_aflock(1)

b = 1
print_screen(true)
           
press("shoot_full")
a=get_tick_count()
repeat
     repeat sleep(20) until get_shooting() == true
    print("#:", b, " -> ", get_tick_count()-a)
    b = b+1
     repeat sleep(20) until get_shooting() == false
until false
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #15 on: 15 / November / 2011, 15:47:24 »
Very strange!
I updated the script to:
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)

repeat until get_usb_power() > 6
a = get_tick_count()
b = 1
print_screen(true)
repeat
     sleep(100)
     if get_usb_power() > 6 then
            press("shoot_full")
            repeat sleep(100) until get_shooting() == true
    print("#:", b, " -> ", get_tick_count()-a)
    b = b+1
    a = get_tick_count()
    repeat sleep(100) until get_shooting() == false
     end
until false

And the result of the logfile (after tens of photos) was:
Code: [Select]
#: 1  ->  1370
*** INTERRUPTED ***
Something went wrong here...

Re: Script for photomapping
« Reply #16 on: 15 / November / 2011, 16:51:43 »
It looks like get_shooting() never becomes false in the line near the bottom as long as  press("shoot_full") is still pressed. 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #17 on: 15 / November / 2011, 17:15:47 »
Hmm... Maybe because i had continuous shooting enabled. i'll try again tomorrow without this option.


Re: Script for photomapping
« Reply #18 on: 15 / November / 2011, 17:31:21 »
Hmm... Maybe because i had continuous shooting enabled.

I thought that was the point - to use continuous shooting ? 

You just want a log of exactly when it takes each shot, right ?  This will do that - tested on my SD940. It even logs the actual image name rather than the sequential shot number !

Code: [Select]
--[[
@title Time Stamper Lua Script
--]]

repeat sleep(100) until get_usb_power() > 6

press("shoot_half")
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false
set_aflock(1)

print_screen(true)

start_time=get_tick_count()
shot_count = get_exp_count()

press("shoot_full")

repeat
    repeat
        sleep(50)
        new_count = get_exp_count()
    until new_count > shot_count
    print("IMG_", new_count, ".JPG -> ", get_tick_count()-start_time)
    shot_count = new_count
until false


« Last Edit: 15 / November / 2011, 21:05:53 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #19 on: 16 / November / 2011, 12:29:08 »
Alright! Thanks a lot!
This is my latest script (usb replaced by right key for testing):
Code: [Select]
--[[
@title Time Stamper Lua Script
--]]



i = 1
print_screen(true)

while true do
repeat until is_pressed "right"
start_time=get_tick_count()
print("received trigger", i)
i = i + 1
press("shoot_half")
repeat sleep(100) until get_shooting() == true
release("shoot_half")
repeat sleep(100) until get_shooting() == false
set_aflock(1)

shot_count = get_exp_count()

press("shoot_full")

while is_pressed "right" do
    repeat
        sleep(50)
        new_count = get_exp_count()
    until new_count > shot_count
    print("IMG_", new_count, ".JPG -> ", get_tick_count()-start_time)
    shot_count = new_count
end
release("shoot_full")
end

Works perfectly:
Code: [Select]
received trigger 1
IMG_ 791 .JPG ->  2610
IMG_ 792 .JPG ->  4440
IMG_ 793 .JPG ->  6250
IMG_ 794 .JPG ->  8020
IMG_ 795 .JPG ->  9790
IMG_ 796 .JPG ->  11590
IMG_ 797 .JPG ->  13370
IMG_ 798 .JPG ->  15200
IMG_ 799 .JPG ->  16970
received trigger 2
IMG_ 800 .JPG ->  2020
IMG_ 801 .JPG ->  3790
IMG_ 802 .JPG ->  5530
IMG_ 803 .JPG ->  7360
IMG_ 804 .JPG ->  9140

So all I will need to do is apply 5V to the USB when I wish to start triggerering! GPS localization of these photos will be very precise.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal