Noob question, how to run multicam.lua on chdkptp - General Help and Assistance on using CHDK stable releases - CHDK Forum

Noob question, how to run multicam.lua on chdkptp

  • 32 Replies
  • 25702 Views
Noob question, how to run multicam.lua on chdkptp
« on: 06 / May / 2014, 22:53:31 »
Advertisements
Hello,

I am having a complete noob moment, and I am unable to find the docs to help me through this.

I am trying to get the multicam.lua script to run using the command line interface of chdkptp. Could somebody please post the syntax or snippet to run this script?

I have tried "source lua/multicam.lua"

Thank you so much!

*

Offline reyalp

  • ******
  • 14117
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #1 on: 06 / May / 2014, 23:11:28 »
There is an examples in the top of the multicam.lua source file
Code: [Select]
experimental code for shooting with multiple cameras
not optimized for best sync, lots of loose ends
usage:
!mc=require('multicam')
!mc:connect()
!mc:start()
!return mc:cmdwait('rec')
!return mc:cmdwait('preshoot')
!return mc:cmdwait('shoot')
!return mc:cmdwait('play')
!mc:cmd('exit')
As noted in the comment, this is something I threw together as an experiment, not a fully developed user friendly solution.
Don't forget what the H stands for.

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #2 on: 06 / May / 2014, 23:13:18 »
Thank you so much. I just learned a super valuable lesson. I will make sure I read and understand the header.

Much obliged

*

Offline reyalp

  • ******
  • 14117
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #3 on: 07 / May / 2014, 16:01:03 »
Thank you so much. I just learned a super valuable lesson. I will make sure I read and understand the header.
A little more explanation.
! means run Lua code inside chdkptp (as opposed to running it on the camera)

!mc=require('multicam')
loads the module called multicam.lua and makes it available through a variable named mc
!mc:connect()
Connects to all the available cameras.
!mc:start()
Starts the camera side Lua script on each camera. You must do this before using any other mc functions.
!return mc:cmdwait('rec')
Switches all cameras to record (picture taking) mode. The cmdwait function waits for the operation to complete, and the return causes the results to be printed.
!return mc:cmdwait('preshoot')
Works as if you had pressed the shutter button half way and waited for focus etc on each camera, and returns when they are ready.
!return mc:cmdwait('shoot')
Tells all the cameras to shoot, and waits for the shot to complete.
!return mc:cmdwait('play')
Switches the cameras back to playback (review) mode
!mc:cmd('exit')
Ends the camera side script. You must do this before using normal chdkptp commands  (like download or ls) with the cameras. To use the mc functions again again, you will need to call mc:start() again.

If you want to do synchronized shooting, you will need to use mc:init_sync() once sometime after mc:start(). For best results, it should probably be after entering rec mode. To shoot synchronized shots, you will need to use the mc:testshots function (or use it as a basis to write your own), which handles the shoot and preshoot commands for you. There are comments on some of these functions in the source that explain how they work.

testshots takes a table of which aren't documented:
nshots: number of shots to take
tv: shutter speed, in APEX96 units
sv: ISO, in APEX96 "real" units
synctime: time (in milliseconds after all cameras are ready) when the shot should be taken. Default is the minimum value calculated by init_sync + 50 ms.

So
!mc:testshots{tv=96,sv=411,nshots=2}
would take 2 shots with a 1/2 second exposure at about ISO 100.

If you want to download and delete files from the cameras, see this thread:
http://chdk.setepontos.com/index.php?topic=11478.0
Don't forget what the H stands for.


Re: Noob question, how to run multicam.lua on chdkptp
« Reply #4 on: 11 / May / 2015, 05:08:26 »
Hi,
I am trying to execute multicam.lua from linux terminal . I am using ubuntu 14.04
I have connected 2 cameras ( Canon Powershot ELPH130IS).
I want to shoot photos from both cameras in sync.

when I enter :mc:start(), I get the following error.

"con> !mc:start()
WARNING: 1: failed ./multicam.lua:338: attempt to index local 'lcon' (a nil value)
stack traceback:
   ./multicam.lua:338: in function <./multicam.lua:336>
   [C]: in function 'xpcall'
   ./multicam.lua:418: in function 'start'
   [string "mc:start()"]:1: in main chunk
   [C]: in function 'xpcall'
   ./cli.lua:700: in function <./cli.lua:691>
   (tail call): ?
   [C]: in function 'xpcall'
   ./cli.lua:272: in function 'execute'
   ./cli.lua:379: in function <./cli.lua:370>
   (tail call): ?
   ./main.lua:274: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk
WARNING: 2: failed ./multicam.lua:338: attempt to index local 'lcon' (a nil value)
stack traceback:
   ./multicam.lua:338: in function <./multicam.lua:336>
   [C]: in function 'xpcall'
   ./multicam.lua:418: in function 'start'
   [string "mc:start()"]:1: in main chunk
   [C]: in function 'xpcall'
   ./cli.lua:700: in function <./cli.lua:691>
   (tail call): ?
   [C]: in function 'xpcall'
   ./cli.lua:272: in function 'execute'
   ./cli.lua:379: in function <./cli.lua:370>
   (tail call): ?
   ./main.lua:274: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk


How do I solve this problem?
Btw, great work overall.. Amazing :-)

Waiting for ur reply,

Gaurav

*

Offline adong

  • **
  • 66
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #5 on: 11 / May / 2015, 14:43:15 »
Did you type in mc:connect() before mc:start() ? doesn't look like the multicam is connected to any device...

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #6 on: 11 / May / 2015, 14:55:25 »
Hi,

Yes !mc:connect() was executed before the !mc:start() command.

Sorry for reposting. I will remove the new post !!!



Re: Noob question, how to run multicam.lua on chdkptp
« Reply #8 on: 11 / May / 2015, 23:11:44 »
can you do http://chdk.setepontos.com/index.php?topic=10664.msg115401#msg115401 and retry ?

I tried the above steps,

1)ls /lib/udev/rules.d/*gphoto*.rules
2)sudo cp /lib/udev/rules.d/40-libgphoto2-6.rules /etc/udev/rules.d/
3)gedit /lib/udev/rules.d/40-libgphoto2-6.rules /etc/udev/rules.d/
4) Added ATTR{idVendor}!="04a9", ATTR{idProduct}!="3271",  to begining of 4th line

Still I am getting the same error..

Also on !mc:connect() it is showing 2 cameras connected..

con> !mc:connect()
+ 1:Canon PowerShot ELPH 130 IS b=003 d=002 s=22EBBC5ACABF457A939CBF37E218903C
+ 2:Canon PowerShot ELPH 130 IS b=002 d=002 s=83745C6938A74E68B3EA78159879D816
con> !mc:start()
WARNING: 3: failed ./multicam.lua:338: attempt to index local 'lcon' (a nil value)
stack traceback:
   ./multicam.lua:338: in function <./multicam.lua:336>
   [C]: in function 'xpcall'
   ./multicam.lua:418: in function 'start'
   [string "mc:start()"]:1: in main chunk
   [C]: in function 'xpcall'
   ./cli.lua:700: in function <./cli.lua:691>
   (tail call): ?
   [C]: in function 'xpcall'
   ./cli.lua:272: in function 'execute'
   ./cli.lua:379: in function <./cli.lua:370>
   (tail call): ?
   ./main.lua:274: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk
WARNING: 4: failed ./multicam.lua:338: attempt to index local 'lcon' (a nil value)
stack traceback:
   ./multicam.lua:338: in function <./multicam.lua:336>
   [C]: in function 'xpcall'
   ./multicam.lua:418: in function 'start'
   [string "mc:start()"]:1: in main chunk
   [C]: in function 'xpcall'
   ./cli.lua:700: in function <./cli.lua:691>
   (tail call): ?
   [C]: in function 'xpcall'
   ./cli.lua:272: in function 'execute'
   ./cli.lua:379: in function <./cli.lua:370>
   (tail call): ?
   ./main.lua:274: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk



*

Offline reyalp

  • ******
  • 14117
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #9 on: 11 / May / 2015, 23:20:39 »
I tried the above steps,
FWIW, I don't think this problem would be caused by the gphoto issues, generally that only prevents switching to rec mode.

What version of chdkptp are you using? Are you sure you are using the multicam.lua that was included with it?

are you using the CLI or the GUI?

edit:
try
!mc:list_all()

after connect()
« Last Edit: 11 / May / 2015, 23:26:03 by reyalp »
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal