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

Noob question, how to run multicam.lua on chdkptp

  • 32 Replies
  • 26170 Views
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #10 on: 11 / May / 2015, 23:26:37 »
Advertisements
Hi,

I am using the multicam.lua that was there in the lua folder of chdkptp.

I am using CLI. Through terminal on ubuntu 14.04.

All other commands are running well on the chdkptp.

I have used this link for instructions to install chdkptp:

http://chdk.wikia.com/index.php?title=Chdkptp_in_headless_linux_Dockstar_-_remote_control&s=wl

Thanks,
Gaurav


*

Offline reyalp

  • ******
  • 14126
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #11 on: 11 / May / 2015, 23:40:48 »
Can you post the output from

ver -p -l

Also, please try
!mc:list_all()

after you do mc:connect()
Don't forget what the H stands for.

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #12 on: 12 / May / 2015, 00:54:21 »

here is the output:-


root@gaurav-HP-15-Notebook-PC:/home/gaurav# cd /usr/src/chdkptp/luaroot@gaurav-HP-15-Notebook-PC:/usr/src/chdkptp/lua# /usr/src/chdkptp/chdkptp -i -c
WARNING: Lua 5.1 is deprecated
connected: Canon PowerShot ELPH 130 IS, max packet size 512
con> !mc=require('multicam')
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:list_all()
* id=1 Canon PowerShot ELPH 130 IS b=003 d=002 s=22EBBC5ACABF457A939CBF37E218903C
* id=2 Canon PowerShot ELPH 130 IS b=002 d=002 s=83745C6938A74E68B3EA78159879D816
con> ver -p -l
chdkptp 0.5.0-alpha built Apr 30 2015 14:55:13
host:2.6 cam:2.6
Lua 5.1
con>

*

Offline reyalp

  • ******
  • 14126
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #13 on: 12 / May / 2015, 02:29:35 »
Thanks. It appears this is an issue when using Lua 5.1, the code used xpcall in a way that is only valid under Lua 5.2.

I checked in a fix in revision 666. You can just get the latest multicam.lua from svn, you don't need to rebuild.

However, I would suggest building with Lua 5.2 if you can, because I don't test much with 5.1 and other things may be broken. I will remove 5.1 support completely in the future.
Don't forget what the H stands for.

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #14 on: 12 / May / 2015, 03:15:19 »
Hi,

Thanks for the reply.

Can you please give the link for the exact svn?

And also, how to build in lua 5.2?

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #15 on: 12 / May / 2015, 15:36:19 »
Hi reyalp,

I managed to build in lua5.2 and was able to run multicam.lua for 2 cameras in sync.

Thanks a lot for all your help :-)

Gaurav

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #16 on: 10 / August / 2015, 11:56:41 »
Is there a possibility to run those commands from windows command?
How would you do that?
Because chdkptp -e"!me=require('multicam')" etc. does not work for me. Also not with the -i toggle.

*

Offline reyalp

  • ******
  • 14126
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #17 on: 10 / August / 2015, 23:20:03 »
Is there a possibility to run those commands from windows command?
How would you do that?
Because chdkptp -e"!me=require('multicam')" etc. does not work for me. Also not with the -i toggle.
If you want help, you'll need to be more specific about what you are trying to do, and exactly happens when it "does not work"

In general, you can run any chdkptp command with -e, but if you want to do a lot of stuff it's probably better to put it in a file and run that. You can either run lua files (with require of dofile) or chdkptp command files (with source or -r). Which one makes more sense will depend on what you are trying to do.

You should be aware that multicam is a code library you can use in your own scripts, not a complete system. You will need some scripting ability to do much with it.
Don't forget what the H stands for.

Re: Noob question, how to run multicam.lua on chdkptp
« Reply #18 on: 11 / August / 2015, 03:28:04 »
If you want help, you'll need to be more specific about what you are trying to do, and exactly happens when it "does not work"
I want to get 8 cameras taking pictures at the same time (Within about 500 milliseconds). Entering the commands manually (First running chdkptp -i) works just fine...

In general, you can run any chdkptp command with -e, but if you want to do a lot of stuff it's probably better to put it in a file and run that. You can either run lua files (with require of dofile) or chdkptp command files (with source or -r). Which one makes more sense will depend on what you are trying to do.
Ok thanks alot! This helps alot! Do the files need to have a special extension for the -r parameter to work? Can I just put all the commands into the file like this?
!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')
« Last Edit: 11 / August / 2015, 03:50:52 by r0xx »

*

Offline reyalp

  • ******
  • 14126
Re: Noob question, how to run multicam.lua on chdkptp
« Reply #19 on: 11 / August / 2015, 17:22:50 »
Ok thanks alot! This helps alot! Do the files need to have a special extension for the -r parameter to work?
Nope, any name should be fine
Quote
Can I just put all the commands into the file like this?
!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')
Yes, doing it that way should be fine (in principle, I haven't checked that all those commands are correct)

All that is local Lua code, so you could also put the calls in a lua file (without the !), and execute it with something like -e"exec dofile('myfile.lua')"
("exec" is the same as !, but some unix-ish shells might do funny things to it, so "exec" is safer on the command line).  You'd need to remove or replace the "return" statements.

This would give you give you more flexibility if you need any actual logic in your script, or want to display the return output in a more user friendly manner. If the quoted code is all you need, then a chdkptp -r file should be fine.

Quote
I want to get 8 cameras taking pictures at the same time (Within about 500 milliseconds). Entering the commands manually (First running chdkptp -i) works just fine...
Note that the way you are doing things now, each camera will just execute the shoot command as soon as it arrives. multicam sends the commands sequentially, so there will be a gap between the first and last. If you want better sync, you should use init_sync and then shoot with a sync time, like
Code: [Select]
!mc:cmdwait('shoot',{syncat=100})

Off the top of my head, I'd expect you can get 8 cameras within 500ms without using init_sync. The "minimum sync delay" will give you an approximation of the amount of time it takes to send to all cameras.

Another note:
You may find you need some delay between things like rec and preshoot or shoot and play. You can insert a delay on the chdkptp side using sys.sleep(milliseconds)
Don't forget what the H stands for.

 

Related Topics


SimplePortal © 2008-2014, SimplePortal