KAP & UAV Exposure Control Intervalometer Script - page 58 - Completed and Working Scripts - CHDK Forum

KAP & UAV Exposure Control Intervalometer Script

  • 1068 Replies
  • 343585 Views
Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #570 on: 09 / July / 2015, 20:48:08 »
Advertisements
there are also a few bugs in B9:
  • Log was not updated
  • Screen was not updated
  • Menu button did not finish the script running
  • Shoot button did not interrupt the script running
This is not really a bug.  In beta9,  once you start shooting continuously the script stays locked waiting for a pulse to start the next shot.  There is a timeout after 10 seconds of waiting without receiving a pulse so if you press MENU and just wait it should eventually exit the script and save the log.   Once we get the basics working I'll see if I can improve on this.

I have altered the code a little and ran a short test :
Code: [Select]

function pwm4(pwidth)
     repeat_check("shut down",pwidth)
     shut_down()
end
This is a pretty bad idea.  If you just shut the camera down like this,  you will lose everything not yet saved from the log file and the next time CHDK starts the USB remote will be enabled. I'd suggest calling the restore( ) function before issuing the shut_down( ).


What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.
Here's a improved version of your PWM test script that will tell you how long the pulse & spaces are :
Code: [Select]
--[[
@title PWM Tester
@chdk_version 1.3
--]]
print_screen(123)
set_console_layout(1, 1, 44, 10)
set_remote_timing(1000)
print("USB pwm test started")
set_config_value(121,1) -- make sure USB remote is enabled
count=0
repeat until get_usb_power(2) == 0
repeat
    x=get_usb_power(2)
    if ( x > 0 ) then
        count=count+1
        print(count..") pulse="..x.." mSec")
    elseif (x < 0 ) then
        x=0-x
        print(count..") space="..x.." mSec")   
    end
until is_pressed("menu")
set_config_value(121,0) -- make sure USB remote is disabled
Note that this test script creates a log file of its output.  You can find it on the SD card as A/CHDK/LOGS/LOG0123.TXT   Please post the log here when you get some testing done?
« Last Edit: 09 / July / 2015, 22:27:51 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #571 on: 10 / July / 2015, 00:47:23 »
Thanks for the script!
Log attached.
It looks like the total signal is constant at 19ms, pulse+space.
My gut-feeling is that it is actually set to 20ms somewhere.

I continuously learn new things  from you! Many-many thanks!
 added  before shut_down()
Code: [Select]
restore( )
sleep(2000)

Sorry, but I am not sure I understand.  Is there or is there no pile-up risk?
« Last Edit: 10 / July / 2015, 00:51:18 by netptl39 »
S110, SX200is,

KAP & UAV Exposure Control Intervalometer Script
« Reply #572 on: 10 / July / 2015, 07:14:55 »
20 mSec is the standard period for an RC servo so that makes sense.  I did not see any pulses longer than 18 mSec in the log file.  Can you try the 32 mSec setting that you reported earlier?

Pixhawk generates output continuously so Camera continuously gets PWM input.
I'm afraid that this could be a problem  if the pixhawk cannot generate a few distinguishable PWM pulses at each waypoint / distance travelled over the ground so that the next shot can be trigggered. 
« Last Edit: 10 / July / 2015, 12:53:07 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #573 on: 10 / July / 2015, 23:00:29 »
What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.
I think I found this answer.   From :

http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-camera-shutter-with-servo/



The duration value shown is 10 (or one second).  Changing that to some value below 5 and then changing the Pushed : 1800 to 25000 and the the  Not Pushed : 1100 to 12000 (for example) should allow direct connection to the script? 
Ported :   A1200    SD940   G10    Powershot N    G16


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #574 on: 11 / July / 2015, 02:34:08 »
Mine is set to 1 with the following ranges
Code: [Select]
    elseif pw < 5  then pwm1(pw)
            elseif pw < 10  then pwm2(pw)
            elseif pw < 15 then pwm3(pw)
            elseif pw < 20 then pwm4(pw)
S110, SX200is,

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #575 on: 11 / July / 2015, 03:26:31 »
Dear Waterwingz,

Mission settings: DO_SET_CAM_TRIGG_DIST=17meter (like @ ~80m altitude)

Timing  works like a charm!

I reached the mission start point at picture 31.
I was going 50-60Km/h till I exited the village, that is picture 95.
I accelerated to 90Km/h held it there for a while and then accelerated to 110Km/h.

Then mission finished.
The pause between the pictures can be can be seen by the     mode=1 repeated xx

There is only one modification that is absolutely needed : please take out the 10s interval picture taking, as first picture (the one that sets the focus and other things ) needs to be taken at mission operation start, above the target area.

I used the slightly modified version with the altered PWM ranges.
It is like :xmas for me!!!

Oh, Question: Should I use ND filter or not? I need crisp crystal clear images.

S110, SX200is,

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #576 on: 11 / July / 2015, 08:48:22 »
Mission settings: DO_SET_CAM_TRIGG_DIST=17meter (like @ ~80m altitude)
I'm going to do a wikia "how to" write-up about this once the next script revision is released.  So I'm trying to keep track of the necessary setup steps for the pixhawk (ardupilot). I'll also add some code to allow picking either a gentwire-USB2 or an Ardupilot from the script parameters and using good default values / code for each.

Should I assume your setup is all done with the Mission Planner software?  And that you only need to setup the "Optional Hardware -> Camera Gimbal"  and then use DO_SET_CAM_TRIGG_DIST in the Flight Plan section?

Quote
Timing  works like a charm!  I reached the mission start point at picture 31. I was going 50-60Km/h till I exited the village, that is picture 95.  I accelerated to 90Km/h held it there for a while and then accelerated to 110Km/h. Then mission finished. The pause between the pictures can be can be seen by the mode=1 repeated xx
Good!

Quote
There is only one modification that is absolutely needed : please take out the 10s interval picture taking, as first picture (the one that sets the focus and other things ) needs to be taken at mission operation start, above the target area.
I don't really want to do that because if the flight controller stops sending pulses once continuous shooting starts, the script will appear to hang.  That is going to confuse a lot of people trying to use the script.

What is supposed to happen is for the flight controller not to start sending pulses to the camera until it is over the target area and ready to shoot.   This will leave the lens retracted and the camera idling in a low power standby mode  (i.e. playback) prior to the first shot.

Also, when a timeout occurs,  the camera should refocus & reset the exposure on the next shot.   That appears to not be working so I will fix that.

Does that sound better than simply disabling the timeout?

Quote
I used the slightly modified version with the altered PWM ranges.
Pushed : 7500 and Not Pushed : 3500  ?

Quote
Oh, Question: Should I use ND filter or not? I need crisp crystal clear images.
The ND filter can be left as Yes.  The script will only use it if the Maximum Tv and minimum ISO setting that you allow in your other settings will result in an overexposed picture.  Which is not likely given your settings.
« Last Edit: 11 / July / 2015, 08:56:56 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #577 on: 11 / July / 2015, 10:33:22 »
I used the Mission Planner, but on the "Optional Hardware -> Camera Gimbal" screen you will not be able to set these values.
For Pixhawk:
You need to go to Config/Tuning -> Param Tree -> Cam
CAM_DURATION - 1
CAM_SERVO_OFF - 8000
CAM_SERVO_ON - 3000
CAM_TRIGG_DIST - 0
CAM_TRIGG_TYPE - 0

THEN

Pick an RC channel you would like to control the shutter (I used RC7):
RC7_FUNCTION - 10
RC7_TRIM - 8000
RC7_MAX - 32767 (you will get a warning signal saying that you are above the 2000 max. You have to confirm that you want to change the value)

That is about it.

Correct: DO_SET_CAM_TRIGG_DIST you set when you plan the mission in Flight Plan

I don't really want to do that because if the flight controller stops sending pulses once continuous shooting starts, the script will appear to hang.  That is going to confuse a lot of people trying to use the script.

What is supposed to happen is for the flight controller not to start sending pulses to the camera until it is over the target area and ready to shoot.   This will leave the lens retracted and the camera idling in a low power standby mode  (i.e. playback) prior to the first shot.

Also, when a timeout occurs,  the camera should refocus & reset the exposure on the next shot.   That appears to not be working so I will fix that.

Does that sound better than simply disabling the timeout?

Once the Pixhawk PWM is activated it will only send the CAM_SERVO_OFF = RC7_TRIM value until otherwise needed. For the camera that means mode=1 right now.
If flight controller stops sending the signals that will most probably render the whole set useless anyway so the flight must be repeated. There is no point in having a picture every 10 seconds when you need a picture every 0.55s.
First thing after touch-down and disarm is check the picture count.
Anyway, when the controller stops sending pulses the pictures are the smallest problem, because then the plane goes down. Period.

If you ever find and get that plane together again that can only be flown after extensive debugging.

Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
S110, SX200is,


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #578 on: 11 / July / 2015, 11:08:51 »
Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
Getting rid of the 10 second timeout will not make this happen.   

However, resetting the focus & exposure on a timeout will (should you happen to accidentally start shooting in continuous mode prior to reaching the target area).
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #579 on: 11 / July / 2015, 12:10:06 »
Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
Getting rid of the 10 second timeout will not make this happen.   

However, resetting the focus & exposure on a timeout will (should you happen to accidentally start shooting in continuous mode prior to reaching the target area).
I will do a test flight on Monday.
let's wait and see how that tuns out with the script as is.
I am flying @25m/s so the worst case scenario is that the setting is done 250m before reaching the op.area. Conditions should be similar in any case. I will check and delete the pictures taken in time-out before processing.

Can you fix the reset by then? 
« Last Edit: 11 / July / 2015, 12:11:42 by netptl39 »
S110, SX200is,

 

Related Topics