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

KAP & UAV Exposure Control Intervalometer Script

  • 1068 Replies
  • 318381 Views
Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #370 on: 12 / April / 2015, 14:02:08 »
Advertisements
Debug version of the script :  ku_test.lua

Please run this and post the resulting log here.

TIA

two KAP.LOGs as attachment.

The first I wait "forever"
The second I pressed the Review-button after a while and at last finished with the Menu-key.

I tried a video with this version. This will follow.

Thank you again.

I try to find someone with the same camera, to test it on another equipment.
IXUS 970 IS 100b

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #371 on: 12 / April / 2015, 16:47:16 »
two KAP.LOGs as attachment.
Now we are getting somewhere!   I can see where the script hangs up :

Code: [Select]
dprint("Debug :hook_shoot.set")                 
                press('shoot_full')                -- and finally shoot the image
dprint("Debug : shoot_full")               
                while not hook_shoot.is_ready() do sleep(10) end -- wait until the hook is reached
dprint("Debug : hook_shoot.is_ready done")     
The hook_shoot.is_ready() function never returns true on your older camera.   Either something wrong with the raw hooks or (more likely) something I am doing wrong while trying to use them.  Will likely need some of reyalp's help here.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 13454
Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #372 on: 12 / April / 2015, 17:38:58 »
The hook_shoot.is_ready() function never returns true on your older camera.   Either something wrong with the raw hooks or (more likely) something I am doing wrong while trying to use them.  Will likely need some of reyalp's help here.
This sounds like this is probably a bug in the ixus970_sd980 capt_seq.c, such that there is a code path where wait_until_remote_button_is_released is never called. Further debugging should go in the porting thread: http://chdk.setepontos.com/index.php?topic=3246.130

FWIW, I suggest using a timeout when waiting for hooks to become ready. The hookutil lua library adds a wait_ready function for this, described in http://chdk.wikia.com/wiki/Script_Shooting_Hooks#hookutil_Lua_module

edit:
@exposeIT I think I found the issue, please try the test build posted in the porting thread.
I posted a test build in the porting thread,
« Last Edit: 12 / April / 2015, 17:58:02 by reyalp »
Don't forget what the H stands for.

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #373 on: 13 / April / 2015, 10:59:05 »

@exposeIT I think I found the issue, please try the test build posted in the porting thread.
I posted a test build in the porting thread,

ok, first test works fine now.
a broader test in the evening will follow.

exposeIT

A lot of thanks @reyalp and @ waterwingz
IXUS 970 IS 100b


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #374 on: 17 / April / 2015, 12:43:02 »
Hello Waterwingz,

Thanks for the awesome script! I'm using it successfully with USB Shot Control set to One Shot with a Pixhawk Autopilot. However, I'm unable to retract the lens. I see you've implemented a couple of features that will almost work (PWM and return camera to playback mode). Can the script be set so that I use multiple PWM values to, extend lens, take picture, retract lens?

Thanks!

Brian

Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).

You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #375 on: 17 / April / 2015, 12:59:31 »
Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).
Well,  PWM is an acronym that means Pulse Width Modulation.  With PWM information is conveyed by an  input pulse via the length of the pulse.   CHDK's USB input function can read such "pulse width modulated" signals.  And as such,  calling the CHDK PWM input by that name is correct.   

Quote
You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.
As I understand the issue with the PixHawk output is a question of the Pixhawk only providing a 3.3V PWM signal and the Canon camera USB port expecting 5V.  So a level translator is needed.  Many others have interfaced a Pixhawk directly to a CHDK camera using the PWM capability of both.   I'll dig up the links later if necesary.

Otherwise,  there is a device available from Gentles that will directly connect an RC servo signal to the camera.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #376 on: 17 / April / 2015, 13:58:35 »
Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).
Well,  PWM is an acronym that means Pulse Width Modulation.  With PWM information is conveyed by an  input pulse via the length of the pulse.   CHDK's USB input function can read such "pulse width modulated" signals.  And as such,  calling the CHDK PWM input by that name is correct.   
I don't have any formal knowledge about the subject, so I may be wrong. I believe that to be able to call a pulsed signal "PWM" the signal has to pulse regularly (for example every 20ms), and what you vary is how long you keep the pulse high. I don't know if it can be called PWM when there is no pulse repetition.

Anyway, this is not really important except for one detail: In RC the standard is to use a PWM signal at 5v, with the pulse's length (usually) varying between 900 and 1900us, and the pulse repeating every 20ms. If you have RC background and read 5v PWM, you might believe this script's "PWM" control scheme is compatible with RC's standard PWM, when it is not.

Quote from: waterwingz
Quote from: Naccio
You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.
As I understand the issue with the PixHawk output is a question of the Pixhawk only providing a 3.3V PWM signal and the Canon camera USB port expecting 5V.  So a level translator is needed.  Many others have interfaced a Pixhawk directly to a CHDK camera using the PWM capability of both.   I'll dig up the links later if necesary.

Otherwise,  there is a device available from Gentles that will directly connect an RC servo signal to the camera.
What you are talking about here are not the Pixhawk's main RC PWM outputs (which output a 5v PWM signal), but it's auxiliary outputs, which can be configured as switches, but output a 3.3v signal instead of a 5v signal. These switches could be used to drive your script's "PWM" mode, but in order to do so you need to drive the voltage up to 5v.
The Gentles device reads the Pixhawk's main RC outputs' PWM signal (or any RC receiver's PWM signal) to drive a switch which outputs 5v pulses.

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #377 on: 17 / April / 2015, 17:16:21 »
I don't have any formal knowledge about the subject, so I may be wrong. I believe that to be able to call a pulsed signal "PWM" the signal has to pulse regularly (for example every 20ms), and what you vary is how long you keep the pulse high. I don't know if it can be called PWM when there is no pulse repetition.
While I don't agree with the limitation that a regular pulse series is required, I do understand that it's the most common way PWM is implemented.   

But going back to your earlier post,  CHDK scripts (including the kap_uav.lua script) are quite capable of decoding continuous pulse width modulate signals per your definition.  So the use of the term PWM is not "wrongly named".

Quote
Anyway, this is not really important except for one detail: In RC the standard is to use a PWM signal at 5v, with the pulse's length (usually) varying between 900 and 1900us, and the pulse repeating every 20ms. If you have RC background and read 5v PWM, you might believe this script's "PWM" control scheme is compatible with RC's standard PWM, when it is not.
Using the new high precision timer in CHDK 1.3.0 it is quite possible to read and interpret a PWM sequence generated to this specification.  So it can be quite compatible if setup correctly.

Quote from: Naccio
What you are talking about here are not the Pixhawk's main RC PWM outputs (which output a 5v PWM signal), but it's auxiliary outputs, which can be configured as switches, but output a 3.3v signal instead of a 5v signal. These switches could be used to drive your script's "PWM" mode, but in order to do so you need to drive the voltage up to 5v.
True.  Although as I said, you can also use the PWM output with a few code changes.

Quote
The Gentles device reads the Pixhawk's main RC outputs' PWM signal (or any RC receiver's PWM signal) to drive a switch which outputs 5v pulses.
Hmmm ... well seeing as we are on a terminology kick today,  I think those PWM outputs your are describing are simply the standard RC digital servo signal that had been around forever?
Ported :   A1200    SD940   G10    Powershot N    G16


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #378 on: 17 / April / 2015, 18:19:29 »
Quote
Using the new high precision timer in CHDK 1.3.0 it is quite possible to read and interpret a PWM sequence generated to this specification.  So it can be quite compatible if setup correctly.
Really? This is great news to me! I never thought the hardware might be able to read pulses with sub millisecond resolution! Implementing this would be great, it would enable anyone with a RC radio system to control a canon camera without any extra hardware! As soon as I get my SD1100 back I will try to program a script to do just that.
Quote
Hmmm ... well seeing as we are on a terminology kick today,  I think those PWM outputs your are describing are simply the standard RC digital servo signal that had been around forever?
That is correct. If we can get the camera to read the standard servo signal it would enable a lot of people to do great stuff at almost no extra cost.

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #379 on: 17 / April / 2015, 19:29:25 »
I never thought the hardware might be able to read pulses with sub millisecond resolution! Implementing this would be great, it would enable anyone with a RC radio system to control a canon camera without any extra hardware!
Now comes the disclaimers.   :o   

The standard CHDK release has the fastest timer precision locked at 1 mSec.    This was a somewhat arbitrary limit that the devs felt would be safe to use and not overload the camera.

To change this (i.e. to time pulses shorter that 1 mSec) you need to recompile with the following line in your platform_camera.h file :

Code: [Select]
#define CAM_REMOTE_HIGHSPEED_LIMIT 250This will give fairly course resolution of a standard servo signal.  Lower values may be possible but you are on the bleeding edge at that point - some cameras with better processor may work better than others.  Still, with this setting you should be able to distinguish the servo control pulses (1.0 mSec to 2.0 mSec)  in steps of 250 uSec ( or 5 discrete "positions").



There was some experimentation done in the forum thread for this feature :  Using timing functions.  Here is a more specific reference.

Quote
As soon as I get my SD1100 back I will try to program a script to do just that.
That's pretty much the only way to find out.  The script function you are looking for is set_remote_timing().   I guess the first question is how many discrete commands you want to give?  Shoot, zoom in, zoom out, shutdown ?


Let us know if you need a custom build to try this out.
« Last Edit: 17 / April / 2015, 21:30:15 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics