Multi-camera setup project. - Creative Uses of CHDK - CHDK Forum  

Multi-camera setup project.

  • 462 Replies
  • 209457 Views
*

Offline mphx

  • ***
  • 210
Multi-camera setup project.
« on: 10 / July / 2014, 16:25:30 »
Advertisements
Hello all ,

I registered today at forum just to share my project and exchange info and tips with you all.
First of all i need to say that everything i did so far is by gathering info from this forum and other places , so nothing is actually *my* creation , i just put them together to serve my purpose.

The Project : Me and a friend of mine will setup a multi camera studio ,lets say, for some 3d modelling/producing 3d miniature purposes.We will use ~64x canon A2500 for the project.

Stuff so far ... : 8x A2500 (running chdk 1.3), 1-2 powered usb hubs , and the necessary cables.All these as a start to do some testing.


Shooting Method : I read a lot about this phase.What to use and what not to use.We started experimenting with multicam.lua (credits to reyalp :) )and its commands.Syncing was working good with 2 cameras.With 8 cameras connected we had some hicups .Some cameras were losing sync by a little bit.Not more than 40-50msecs.
But then again , when we will have 64 cameras connected..i cant and i dont want to imagine what the sync would be like.

So i abandoned that method for now and i am testing "usb remote" method using an on/off switch attached to the usb cable that connects main usb hub to pc.Method works great with 2 cameras.Tesing with 8 cameras is pending.
**Thats why cameras run chdk with patched kbd.c (Credits go to waterwingz :) )**

Transferring Method :That's an easy step.I am using a bat script for downloading the pictures from the cameras.Nothing fancy.

Manual Focus : I played a bit with set_aflock and set_focus commands and they seem to work as supposed.I will play more with focus when we will set up all cameras at the studio.

Things i'd like to do or do with some other way.

1.Is there a way to reboot or disconnect multiple cameras? I have found the command for mass-shutdown.Is something like

Code: [Select]
mc:cmd('call reboot()')
gonna work?I tried it and somehow cameras stucked/crashed.About disconnecting multiple cameras , is a new function needed in multicam.lua i imagine?

2.I saw a thread somewhere in the forum discussing how to be possible to "name" each camera so u know that upper left is camera1 , bottom right camera2 , etc etc.Also if something like this is possible it's easy to see if some camera malfunctioned , didn't take the shot or anything anyway.So , is it possible to"name" the cameras?
If something like this is possible , that would be helpful with transferring the images from cameras.
My batch script creates a parent folder (lets say shooting1) and then takes the increasing usb bus number of the currently connected cameras and uses it to create sub-folders (shooting1/0001 , shooting1/0002 , etc).In each of these subfolders go the photos of each camera.Its a good solution but i would like something like this.

e.g. shooting1/cam1-photo , shooting1/cam2-photo , etc etc etc

So i need a way to "name" each camera with a steady name (maybe "read" the serial numbers and put a name on them or something like this) and then use this name to rename pictures when downloading.
So here comes another question.Is it possible to rename a photo when chdkptp downloads it from cli ?

3.When i press shoot and cameras are standing by for usb voltage change (for me to click the switch in other words) i noticed that shooting happens after ~10 secs if i dont click the switch.Can i change this 10secs behavior?


Sorry for my long post , i had so many things stacked up to say !

Thanks .




Re: Multi-camera setup project.
« Reply #1 on: 10 / July / 2014, 17:36:58 »
I registered today at forum just to share my project and exchange info and tips with you all.
First of all i need to say that everything i did so far is by gathering info from this forum and other places , so nothing is actually *my* creation , i just put them together to serve my purpose.
Welcome!  I started this a couple of days ago for people just like you :

Shooting with Multiple Cameras using CHDK

It's a wiki page so edits and improvements are very welcome.


Quote
**Thats why cameras run chdk with patched kbd.c (Credits go to waterwingz :) )**
.. and a few other people.

Quote
1.Is there a way to reboot or disconnect multiple cameras? I have found the command for mass-shutdown.Is something like
Code: [Select]
mc:cmd('call reboot()')gonna work?I tried it and somehow cameras stucked/crashed.About disconnecting multiple cameras , is a new function needed in multicam.lua i imagine?
I've been working on a customized version of multicam.lua (seperate camera & PC versions of the script) and it has commands to do what you want. 
link >bcam.zip
It's also fairly easy to add more.

The usual cautions about this being a "work in progress" - I'm working on making in tolerant to cameras going on & offline without bailing out with a cryptic error message.



Quote
2.I saw a thread somewhere in the forum discussing how to be possible to "name" each camera so u know that upper left is camera1 , bottom right camera2 , etc etc.
Yea .. I started that here :
Building a mult-camera rig
and continued it here:
Unique Camera ID Numbers needed for multi-camera rigs ?
I was not exactly overwhelmed with comments about the idea.


Quote
Is it possible to rename a photo when chdkptp downloads it from cli ?
My next versions of bcamHost.lua & bcamRem.lua use the unique camera ID and the shot number to create unique  file names and place the same shot from multiple cams in the same folder.

Quote
3.When i press shoot and cameras are standing by for usb voltage change (for me to click the switch in other words) i noticed that shooting happens after ~10 secs if i dont click the switch.Can i change this 10secs behavior?
This one goes way back.  The idea here is that when you get to this stage in the sync process,  the shooting task is in a tight loop waiting for the USB 5V signal to go away.   Many other camera functions are essentially suspended as a result and at some point the camera will do a "watchdog reset".  So 10 seconds was picked as a "safe" value.  It's likely this varies a bit with different camera models and also possible that 60 seconds would work as well.  I can make you a custom build if you want to play a bit and find the limit for the A2500.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #2 on: 10 / July / 2014, 18:33:54 »
Thanks for answering waterwingz ,

Let's see..

1.I have read the wiki link that you ... linked many times and all the multicamera project/threads .It's where i got info and ideas for our project :)

2.I tested a bit your files .To be honest the bcamHost.lua file only , as i prefer to run scripts from pc to the camera . I am not programming expert , or lua for that matter. But  i have some common sense and i try to figure things out by comparing and analyzing them.
So , i tried some commands of that file and after connect() , everything else fails.Script cannot "send" them to camera and the error is the classic "no script running".
I noticed that there is no start() function on the .lua file .Shouldn't be one there to start the camera-part code execution and allow the other commands to function ?Just an observation , i might be talking nonsense here.

3.i have read the threads about unique id numbers and stuff. I will try to see if i can come up with something at the direction reyalp suggested e.g. set some numbers/names at the serial numbers in a script and handle the camera through them.For many cameras setup , that would be a boring job to do , but i believe its a one-time job.To match up some variables to ALL serial numbers.

4.About "i will take the photo in 10 secs" annoying thing. I understand the concept you are describing.My friend was thinking something like.. shooting task in loop forever and we walk around with the switch in our hands and take the shot in whatever moment we feel like .As i understand this won't happen.So the best thing that can be done is to raise that "safe limit".
I will keep it in mind and think it over and let you know..no need to make something for me at this point..not yet atleast.
I was also thinking of some kind of countdown timer in chdkptp gui when i press shoot to inform of the remaining time and some sound alarms too .Probably easy task with some lua programming ...


And a last thing that came up my mind right now.When i click the switch to take the shot , cameras naturally disconnect from pc.
When i click it again to connect them back and do the file transferring i noticed that batch script fails to connect to one of the cameras...i need to run it twice to connect to both and get the images right.
I thought to insert a mass-connect and exit() before the actual transferring , just to "wake" them up and it seems to be working but i consider it a "dirty" solution.Consider 64 connections just to wake cameras up and then 64 connections for the transferring..It's not looking good.

I am trying to see things and how they will work in the big scale in every step.

Is there something else that i can do ?

Thanks.
« Last Edit: 10 / July / 2014, 18:38:02 by mphx »

Re: Multi-camera setup project.
« Reply #3 on: 10 / July / 2014, 19:29:12 »
2.I tested a bit your files .To be honest the bcamHost.lua file only , as i prefer to run scripts from pc to the camera . I am not programming expert , or lua for that matter. But  i have some common sense and i try to figure things out by comparing and analyzing them.
So , i tried some commands of that file and after connect() , everything else fails.Script cannot "send" them to camera and the error is the classic "no script running".
I noticed that there is no start() function on the .lua file .Shouldn't be one there to start the camera-part code execution and allow the other commands to function ?Just an observation , i might be talking nonsense here.
Thanks.
My version of the host script (bcamHost.lua) depends on having the related camera script (bcamRem.lua) running.  They work as a pair.  I needed to do that in order to have the script on the camera side have a unique ID number like you see in the linked image.  So you can't just run the host side alone - it needs the script on the camera side to communicate with.

If you enable the script to run at camera startup, it makes the whole process very automatic.

At some point, I'll add a "mass download" function that allows you to update each camera with a new camera side script ( bcamRem.lua )

Quote
3.i have read the threads about unique id numbers and stuff. I will try to see if i can come up with something at the direction reyalp suggested e.g. set some numbers/names at the serial numbers in a script and handle the camera through them.For many cameras setup , that would be a boring job to do , but i believe its a one-time job.To match up some variables to ALL serial numbers.
See my comment above.

Quote
4.About "i will take the photo in 10 secs" annoying thing. I understand the concept you are describing.  My friend was thinking something like.. shooting task in loop forever and we walk around with the switch in our hands and take the shot in whatever moment we feel like .As i understand this won't happen.So the best thing that can be done is to raise that "safe limit". I will keep it in mind and think it over and let you know..no need to make something for me at this point..not yet at least. I was also thinking of some kind of countdown timer in chdkptp gui when i press shoot to inform of the remaining time and some sound alarms too .Probably easy task with some lua programming ...
If you can figure out how to read that remote switch from your PC then the rest is easy. Some sort of Arduino clone board acting as a USB slave would be simple to rig up.   Search eBay for "wireless remote control" - there a lots of $5 key fob transmitter/receivers you could use as the remote part of the equation.

Quote
And a last thing that came up my mind right now.When i click the switch to take the shot , cameras naturally disconnect from pc...
... Is there something else that i can do ?
Ah, I think you miss the point of the trick you mentioned in your first post.
http://chdk.setepontos.com/index.php?topic=8769.msg105488#msg105488
The hack mentioned there tricks the camera's PTP code into not noticing that the USB power goes away when you "shoot".  That solves all the issues you have mentioned here.  But you do currently need a custom built version of CHDK with the hack included. At some point I guess I'll post a patched version to add to the trunk - possibly enabled and disabled by a script function I think.
« Last Edit: 10 / July / 2014, 20:42:25 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 14121
Re: Multi-camera setup project.
« Reply #4 on: 10 / July / 2014, 23:59:34 »
Shooting Method : I read a lot about this phase.What to use and what not to use.We started experimenting with multicam.lua (credits to reyalp :) )and its commands.Syncing was working good with 2 cameras.With 8 cameras connected we had some hicups .Some cameras were losing sync by a little bit.Not more than 40-50msecs.
Out of curiosity, what version of chdkptp was this using? In chdkptp r602, I added shoot_hook_sync which should have substantially better sync than the previous method.

USB remote (or battery temp terminal) is still probably a much better option for your project, but if you were using shoot before, I'd be interested to know how it compares to the new method.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #5 on: 11 / July / 2014, 04:52:12 »
Thanks all for answering.

Let's see now..

1.@waterwingz : I suspected that your script might work that way (one script on the pc and the other on the camera).But the whole situation process raises a conflict in my eyes.
When i mass-connect to the cameras and they go into "rec mode" , ready to shoot , they kinda start "default" script running.I mean i see the "Default Script <ALT>" at the lower left side.
This goes off when either cameras get disconnected (i suppose , because when they shoot , viewfinder goes black...some bug? but everything is working despite of that and view comes back when i connect cameras back and switch them back to play mode) or  i issue a "mass exit" command from chdkptp.
Won't this whole process fail if some other script (yours lets say) is running already on the camera?

2. when i said , take the switch and walk around , i didnt think about "remote" switch , but a wired one.When i say walk around we are talking a distance of 2-3 meters from pc to the "cameras setup" and back..Not big distances.I dont mind to carry a cable with me lets say...but i'd like to have the shooting task in loop forever , go over to the cameras , give instructions to the customer where to stand , what to do , what not to do and when he/she is ready . i  press the switch .

3.I see that you quoted two lines i wrote but you left out some others that was the whole point.
I said that i press shoot at chdkptp....shoot task goes into loop...i press switch...cameras diconnect and at the same time shooting occures.All good so far.
When i press switch again , cameras connect to pc again...obviously and then i run my script to download the images from the cameras.chkdptp command tries to connect to each camera and download the images to some predefined folders.
What i said was that at the first running of the script , chdkptp fails to connect to one of the two cameras...the same every time?different?i dont care , i didnt look into it.Its meaningless.Fact is that iof one of the two cameras doesnt connect and images dont get downloaded.
If i run the script a second time..ALL IS GOOD.So i wonder if this a usb-related thing..cameras dont get available fast or something.
As i said i include a "mass connect , mass exit" command  in the script prior the download command..just to "wake" cameras up...to make them available...my thoughts..maybe its nonsense.
It works everytime..but as i said...its 2 cameras and the connections and disconnections are fast.I wonder how much time the script will need when it has 64 cameras to handle.
Its obvious that i used a custom build with the hack included. (chdk-shell , downloaded the source , edit kbd.c for my camera model , compile it , "stick" it to the cameras :) )

4. @reyalp : Cameras are using chdk 1.3 r599 .That the version STICK chose for my camera and i dont see a reason not to believe it :)

First of all all my sync-tests where using an online meter (with milliseconds) and all cameras where focusing on it.I dont have a CRT monitor for some more accurate tests..
With the first method (shooting via chdkptp) as i said 1-2 cameras out of 8 were losing "some" msecs.Not much.Nothing tragic.And if you think that the "objects" getting shot will be mostly static, that wouldn't be a problem.
But i fear that when 64 cameras will be connected , maybe sync will go off for more millisecs.
I have to add at this point that i used syncat parameter for shooting to make shooting a bit more accurate but with not a significant changes at the result.
If there is something else i could tweak/use for this "method" , feel free to enlight me :)

The second method (usb hacked cable , switch on/off , hacked kbd.c etc) is rumored to be more accurate.With 2 cameras is working very good.I need to test it with 8 cameras now.

In few words...what shooting method is "known" to have good sync with multiple cameras?

Thanks.
« Last Edit: 11 / July / 2014, 05:14:45 by mphx »

Re: Multi-camera setup project.
« Reply #6 on: 11 / July / 2014, 05:04:57 »
what shooting method is "known" to have good sync with multiple cameras?

None.
It is a statistical problem.
With two cameras I have found that 70% of the time the sync error is less than one msec.
For 30% of the time it is tens of msec, presumably because the Canon firmware is busy with an 'important task'.

So, does that mean for any shoot 19 of your cameras will have a sync error of tens of msec ?

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #7 on: 11 / July / 2014, 05:22:59 »


None.
It is a statistical problem.
With two cameras I have found that 70% of the time the sync error is less than one msec.
For 30% of the time it is tens of msec, presumably because the Canon firmware is busy with an 'important task'.

So, does that mean for any shoot 19 of your cameras will have a sync error of tens of msec ?

I think the real question is : What's the margin of lost sync that is acceptable for a given project.
As i said in my previous post , my "objects" getting shot will be more or less static.People standing on a platform posing .It will be little or near to none movement .
So losing some tens of msecs it wont be much of a problem.3d modelling and processing will correct any hicups.
Thing is i need to find the most efficient method now so i can keep working on it .I can't have 64 cameras at this point.I can test methods with 2 or 8 and make conclusions for the 64x.
So yes it is a statistical problem.And we are trying to find the most accurate (for less cameras) and most reliable method and then we BELIEVE that this method will work well with more cameras.


Re: Multi-camera setup project.
« Reply #8 on: 11 / July / 2014, 05:38:10 »
I need three more cameras for a 24-camera rig that will be used outdoors.
I do not have a laptop (for PTP)) so will just use a simple USB switch connected to all cameras.
I will download from the cards at home.

With that in mind, can you post your BAT file for me to try ?


*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #9 on: 11 / July / 2014, 05:57:12 »
@microfunguy

the BAT file i am using is a bit weird hybrid file :)

It does the following things.
1.it uses an external vbs script that creates a parent folder (lets say shooting0001 , shooting0002 , etc) every time BAT file is executed.It checks if some of these folders exist , it uses the next available number for the naming.It can be done with bat commands too.
2.Creates a file (id.txt) with the id of all connected cameras.
3.Uses the increasing-unique bus id number to create a sub-folder into the parent folder of STEP 1 .
4.Download every image of every camera in the respective sub-folder.

Extra features

1.an empty mass-connect/mass-exit for reasons i have mentioned to previous posts.
2.a check if all subfolders are populated with files.If a subfolder is empty , that means that images were not downloaded or the specific camera didnt shoot.
It creates a text file reporting which subfolder is empty.

If by "i will download from cards" u mean u will get the cards out of the cameras in some card reader , then this script wont do you any good.
If not , then gladly to post it.
« Last Edit: 11 / July / 2014, 06:08:57 by mphx »

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal