Lua command examples for CHDKPTP CLI? - page 2 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Lua command examples for CHDKPTP CLI?

  • 16 Replies
  • 13316 Views
*

Offline Sdack

  • ***
  • 195
Re: Lua command examples for CHDKPTP CLI?
« Reply #10 on: 14 / October / 2017, 22:04:49 »
Advertisements
Sorry for not being clear.. I'm a bit out of my depth here.

Quote
the pasting the same sequence of commands into the console as a single = line should fail in the same way.

Ahh, now I understand what you meant.  Didn't quite get that it might return useful errors this way.

I'll try doing this and add commands incrementally.

Thanks for your patience and yours and everybody else who contributed to the development CHDKPTP, it's amazing.. I considered the whole range of image capture options from webcams to RaspberryPi cam to DSLR and concluded that CHDK is conclusively the way to go.

N

*

Offline Sdack

  • ***
  • 195
Re: Lua command examples for CHDKPTP CLI?
« Reply #11 on: 16 / October / 2017, 02:10:04 »
I seem to have the syntax figured out.. at least for setting the zoom and focus distance:

sudo sh /usr/local/bin/chdkptp-r735/chdkptp.sh -c -e "delete DCIM" -e"luar sleep(2000)" -e"rec" -e"luar set_zoom(70)" -e"luar sleep(3000)" -e"luar set_mf(1) set_focus(1300) set_raw(1) shoot() sleep(2000)" -e"play" -e"sleep(2000)" -e"mdl DCIM /media/pi/PiStore/tmp" -e"luar sys.sleep(2000)" -e"delete DCIM" -e"luar status,msg=post_levent_to_ui('PressPowerButton')"

However I'm a bit stumped on how to set the exposure mode.  I'm preparing for a daytime time lapse sequence of a three month construction project, with images at five or ten minute intervals.  To avoid flickering, should I go with a set, reasonable daytime exposure, or trust to the automatic exposure in the camera?

Any suggestions are welcome...
Thanks for your support
Nigel

*

Offline reyalp

  • ******
  • 14125
Re: Lua command examples for CHDKPTP CLI?
« Reply #12 on: 17 / October / 2017, 22:55:29 »
I seem to have the syntax figured out.. at least for setting the zoom and focus distance:

sudo sh /usr/local/bin/chdkptp-r735/chdkptp.sh -c -e "delete DCIM" -e"luar sleep(2000)" -e"rec" -e"luar set_zoom(70)" -e"luar sleep(3000)" -e"luar set_mf(1) set_focus(1300) set_raw(1) shoot() sleep(2000)" -e"play" -e"sleep(2000)" -e"mdl DCIM /media/pi/PiStore/tmp" -e"luar sys.sleep(2000)" -e"delete DCIM" -e"luar status,msg=post_levent_to_ui('PressPowerButton')"
FWIW, you should mostly only need sleeps after like moving the zoom or shooting. chdkptp functions like mdl, delete etc will only return when they are done.

You can use the imdl command with -rm to download and delete images in one step. It also gives better control of the downloaded file name. You can also use chdkptp 'shoot' or 'remoteshoot' to shoot and download.

For the last command, you probably don't want to use luar with a command that shuts down the camera, because it will get a USB error trying to read status. Instead, I'd suggest something like

-e"lua sleep(1000) post_levent_to_ui('PressPowerButton')" -e"dis"

to send the command without waiting for it to finish and disconnect before the camera shuts down.


Quote
However I'm a bit stumped on how to set the exposure mode.  I'm preparing for a daytime time lapse sequence of a three month construction project, with images at five or ten minute intervals.  To avoid flickering, should I go with a set, reasonable daytime exposure, or trust to the automatic exposure in the camera?
Camera autoexposure should give you fairly reasonable results if you are only shooting in daytime. I'd suggest P mode rather than the "auto" mode, because auto tends to enable a lot of other "smart" automatic features you might not want.

With a five minute interval, there's likely to be significant lighting changes between frames. For example, if a cloud blocks the sun in one frame and not in the next, the highlights and shadows will jump even if the overall exposure is the same.

Don't forget what the H stands for.

*

Offline Sdack

  • ***
  • 195
Re: Lua command examples for CHDKPTP CLI?
« Reply #13 on: 18 / October / 2017, 16:08:41 »
Thanks again.
I will try to streamline my script now that it's working.
As a professional video shooter I normally avoid auto mode but I don't usually shoot for a whole day or weeks on end as is required for time-lapse so I guess this is a new paradigm shift.
I will do some tests in P mode and see what I get.
Nigel

*

Offline Sdack

  • ***
  • 195
Re: Lua command examples for CHDKPTP CLI?
« Reply #14 on: 18 / October / 2017, 16:32:04 »
Couple more things..

I see reference to 'propcase' here and there and get the impression that it's an alternate method of setting values but one which may vary from camera model to model.  Am I right and, if so, is there a guide to extracting the property set for my Ixus/Elph160?

I note the 160, despite being a relatively new, 20 mega pixel model, is considered an 'entry level' camera.  I like the affordability and small form factor and don't need the extraordinary zoom ability of the Super Zoom SX models and, considering I am only doing time lapse with CHDK, I have no need of image stabilisation or weatherproofing (will use a box), but am I missing out on other qualities in the more expensive models?  Do they have better glass for instance? 

If I I'm bitten by this time-lapse bug.. what's the golden unicorn camera I should seek?

Thanks again
Nigel
« Last Edit: 18 / October / 2017, 16:39:05 by Sdack »

*

Offline reyalp

  • ******
  • 14125
Re: Lua command examples for CHDKPTP CLI?
« Reply #15 on: 18 / October / 2017, 18:04:36 »
As a professional video shooter I normally avoid auto mode but I don't usually shoot for a whole day or weeks on end as is required for time-lapse so I guess this is a new paradigm shift.
There are certainly other approaches you could take, but they would probably take a significant amount of development / testing to get good results. I wrote a script that attempts to do very smooth timelapses (http://chdk.wikia.com/wiki/Lua/Scripts:_Raw_Meter_Intervalometer, some examples at https://chdk.setepontos.com/index.php?topic=12761.0) but the technique it uses only good for short intervals. It's also a completely camera side script, so not directly applicable to your pi controlled approach.

FWIW, http://escursionisticivatesi.it/webcam/ is CHDK / chkdptp / pi based and uses auto-exposure during the day, with a 10 minute interval. You can look at the "archive" links (e.g. http://escursionisticivatesi.it/webcam/archive.php?camera=B&tsArchive=1508320800) to see how it looks

Note the "time lapse of the week" feature isn't currently hooked up, so those links go to old videos, some from a different camera system.

Quote
I see reference to 'propcase' here and there and get the impression that it's an alternate method of setting values but one which may vary from camera model to model.  Am I right and, if so, is there a guide to extracting the property set for my Ixus/Elph160?
Many cameras features are controlled by the "propcase" API. Each value that can be queried or set has a number which we call a propcase ID. The number for a particular value (for example shutter speed) depends on the "propset" of the camera. Propcases are a pretty low level interface in the Canon firmware, so I would recommend against using them where CHDK provides another interface. E.g. to set the shutter speed, you should use set_tv96_direct() rather than trying to set the TV propcase.

In CHDK Lua, you can use the propcase module to refer to propcase IDs by name, without worrying about the camera specific numbers:

For example, in chkdptp, the following will return the shutter speed set for the last half press (in APEX*96 units)

=props=require'propcase' return get_prop(props.TV)

You can get the propset number of a camera using
=return get_propset()

Known propcases are listed in the propset<number>.h files found at https://app.assembla.com/spaces/chdk/subversion/source/HEAD/trunk/include

Quote
Do they have better glass for instance? 
Some of the more expensive models certainly have better glass and better sensors. They also often support faster shooting rates, have adjustable apertures and so on. Whether this matters depends on your particular requirements.

Quote
If I I'm bitten by this time-lapse bug.. what's the golden unicorn camera I should seek?
I'd honestly start with something cheep and expendable like your elph160, and only consider upgrading if you decide it falls short in some way.
Don't forget what the H stands for.

*

Offline Sdack

  • ***
  • 195
Re: Lua command examples for CHDKPTP CLI?
« Reply #16 on: 18 / October / 2017, 18:29:18 »
Thanks a million,

I really appreciate your time and support in this.  I'm gradually finding the right reference pages to return to and the fog of confusion is clearing a little.

The time lapse examples of Rawopint are stunning!

I will certainly give it a try when I'm not attempting extended, FTP upload enabled shoots.


 

Related Topics


SimplePortal © 2008-2014, SimplePortal