Script for photomapping - Script Writing - CHDK Forum supplierdeeply

Script for photomapping

  • 21 Replies
  • 6485 Views
*

Offline TomP

  • *
  • 11
Script for photomapping
« on: 12 / November / 2011, 16:22:24 »
Advertisements
Hi all,

A found about CHDK several month ago, and now I just finished writing my first scripts. I don't know who to thank, but still: thank you :-)

Now, here is my application: I have a UAV (radio controlled plane with a gluonpilot.com autopilot on-board). I can send remote triggers to my Ixus120 from this autopilot. So I want to make photos (about 2seconds between every photo to make sure they overlap) in a way that I can later assign correct GPS coordinates to it. Currently, this is how I plan to do it:
 - Send a trigger from the autopilot to CHDK
 - Save the GPS-coordinates at each trigger in a logfile on the autopilot
 - After the flight, post-processing can be done

Now the questions:
 1) How can I make sure my camera can trigger every 2 seconds (or less)? Right now I manage to send a trigger about every 4 seconds. Focus is always infinity, ISO value and shutter time will be more or less constant over the flight. Right now the script is as follows (obvious parts skipped):
Code: [Select]
shoot:
press full_shutter
sleep(200)
release full_shutter
press half_shutter
How can I increase the trigger speed here? I tried setting focus at infinity, but the speed remains more or less the same. When I manually do the triggering (never completely releasing the shutter), I can trigger about every 2 seconds or even faster.

 2) If you guys (with all your experience) have a better idea about how to do this, please let me know :-)

Thanks!
« Last Edit: 12 / November / 2011, 16:26:04 by TomP »

Re: Script for photomapping
« Reply #1 on: 12 / November / 2011, 17:59:10 »
As you are using my favorite camera, here's a simple Lua script that should do what you describe.  Save it as remote.lua in your SD card chdk/scripts directory.  It locks the focus early so make sure the camera is pointed at the horizon when you start the script.

Code: [Select]
--[[
@title Remote Shoot
--]]

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

set_aflock(1)

repeat
     wait_click(100)
     if is_pressed("remote") then
            press("shoot_full")
            repeat sleep(100) until get_shooting() == true
     end
until false

Remember use the Canon menu to set the Review period to "Off" and be sure you do not have CHDK RAW enabled!  Let us know what kind of speeds you get ?
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script for photomapping
« Reply #2 on: 12 / November / 2011, 17:59:58 »
Why not set the camera to continuous-shooting drive mode and keep the shutter pressed ?

An SDM user in New Zealand is doing exactly your application.

Shooting is started and stopped with a signal on the USB.


David

Re: Script for photomapping
« Reply #3 on: 12 / November / 2011, 18:05:57 »
Why not set the camera to continuous-shooting drive mode and keep the shutter pressed ?
Probably because then he does not get what he asked for :
So I want to make photos (about 2seconds between every photo to make sure they overlap) in a way that I can later assign correct GPS coordinates to it.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline TomP

  • *
  • 11
Re: Script for photomapping
« Reply #4 on: 12 / November / 2011, 18:10:44 »
@waterwingz Thanks, I'll give it a try!


@Microfunguy Indeed I was thinking to do something similar. But in this case it would be hard to assign gps coordinates to every photo. The highest precision would be 1 second which is about 10 meter at my flyingspeed. Once I have my first results I can verify if this is good enough. I would expect the trigger to have a better precision. As I am new to CHDK: how can I see whether the USB-line is high? I only found documentation on the get_usb_power() function, which returns milliseconds once it receives a pulse.

Re: Script for photomapping
« Reply #5 on: 12 / November / 2011, 18:19:27 »
As I am new to CHDK: how can I see whether the USB-line is high?

In the script I posted, see:
Code: [Select]
     wait_click(100)
     if is_pressed("remote") then

Heres a simple uBASIC script that does much the same thing :
Code: [Select]
@title Remote shutter
:loop
wait_click 1
is_key k "remote"
if k=1 then shoot
goto "loop"
end
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script for photomapping
« Reply #6 on: 12 / November / 2011, 18:36:21 »
One other thing to remember,  you need the USB remote to be enabled. This can be an easy thing to forget to do when you are getting ready for a launch.   Here's another Lua code snippet that can help with that.

Code: [Select]
if (get_config_value(121) == 0 ) then
    set_config_value(121, 1)
    print("turning remote on")
end
« Last Edit: 12 / November / 2011, 18:45:16 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script for photomapping
« Reply #7 on: 12 / November / 2011, 19:40:12 »

In the script I posted, see:
Code: [Select]
     wait_click(100)
     if is_pressed("remote") then

I think he means how can you literally SEE the USB is high and the camera has presumably started taking photos.

One way would be to flash the auto-focus led and trigger a small slave flash.



Re: Script for photomapping
« Reply #8 on: 12 / November / 2011, 19:45:43 »
I think he means how can you literally SEE the USB is high and the camera has presumably started taking photos.
One way would be to flash the auto-focus led and trigger a small slave flash.
That would work.  Although his question seemed to be about detecting the USB power state from a script : "I only found documentation on the get_usb_power() function, which returns milliseconds once it receives a pulse.".  Using is_pressed("remote") gives you USB status from a script.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Script for photomapping
« Reply #9 on: 12 / November / 2011, 19:52:11 »
Guess he will need to do both .. unless he is feeling lucky.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal