Multi-camera setup project. - page 9 - Creative Uses of CHDK - CHDK Forum
supplierdeeply

Multi-camera setup project.

  • 462 Replies
  • 205014 Views
*

Offline reyalp

  • ******
  • 14110
Re: Multi-camera setup project.
« Reply #80 on: 20 / July / 2014, 23:44:01 »
Advertisements
I started adding support for persistent ids based on serial number (through r619). This isn't really finished, but it may be enough to be useful. Be warned though that I may make incompatible changes as I continue to work on it.

To create the mapping:
1) connect to your cameras normally using mc:connect()
2) use mc:save_list('path/to/listfile') to save the mapping

The next time you want to connect to the same cams, use mc:connect({list='path/to/listfile'})

I also added support for working on a subset of cameras. multicam now has a list of "selected" cameras. When you connect, all cameras are selected. You can change it with mc:sel()
mc:sel('all') selects all cameras
mc:sel(number) selects a single camera by id number
mc:sel({number, number...}) selects all the specified ids.
After using mc:sel(), any function that would normally operate on all cameras (like mc:cmd() or mc:download_last) operates on the selected cameras instead.

Some other notes
* There is currently no support for old cams that do not return a serial number. This shouldn't affect you.
* The numbers listed in connect no longer correspond to the camera IDs. To see the camera IDs, you can use !mc:list_all() or !mc:list_sel()
* There is no support yet for controlling which id is associated with which serial number, they are just set by the original connect order.
Don't forget what the H stands for.

Re: Multi-camera setup project.
« Reply #81 on: 20 / July / 2014, 23:50:35 »
* There is no support yet for controlling which id is associated with which serial number, they are just set by the original connect order.
Do you have any thoughts on how to number cameras sequentially by physical position (i.e. left to right) on the rig?

Maybe something to pop the index number in the saved list onto the camera's LCD ?

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14110
Re: Multi-camera setup project.
« Reply #82 on: 21 / July / 2014, 00:34:12 »
Do you have any thoughts on how to number cameras sequentially by physical position (i.e. left to right) on the rig?

Maybe something to pop the index number in the saved list onto the camera's LCD ?
Yes, that plus a function to re-assign the id is the plan, just haven't got there yet.

On windows, I think if you connect (or power on) with enough delay for each one to actually be recognized by the OS, they will appear in the same order to chdkptp. I haven't tried this on linux, or tested very thoroughly on windows for that matter.

I also added some options to mc:connect I didn't discuss in the previous post. If you use mc:connect({add=true}) it leaves existing connections alone and just add new ones. So if you connect one camera, run that, connect the next etc, you would end up with sequential IDs in the order you connected them.

edit:
as of r620, mc:cmd('id') will now toggle an id display (loosely borrowed from bcam).
« Last Edit: 21 / July / 2014, 02:13:02 by reyalp »
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #83 on: 21 / July / 2014, 06:03:44 »
@reyalp

Very good additions and improvements... i did some testing.
First of all , just to let you know , probably you know it already , there is an error everytime mc:connect() is issued.Nothing to do with latest changes , this happens from day 1.This error doesn't affect the connect() or anything else after that , so i just ignore it..but i thought to let you know.

"ERROR: D:\Downloads\project3d\chdkptp-r599-win32\lua\gui.lua:138: attempt to index field 'apiver' (a nil value)"

Anyways , things i discovered while testing.

1.first of all , svn update didn't go smoothly :) Had 2 "conflicts" , i had to manually copy/paste the new files just to be sure.But this process , i can't use it for gui.lua , since i have added things , to make my own tab.
So every time i just believe that svn update works for this file (it always has a red "!" on it even now as we speak :P )
2.After i did svn update , two of my "buttons" in my new tab didn't work.Every other button worked and only two popped an error.All things have the exact same syntax , except the commands they run.I had to commented out those two buttons in order gui to start.Anyways i will look into this matter later.Lets hope my lua folder is not screwed up alot :)
3.New commands worked fine.I also liked the id display toggling.
4.Let's say i turn on cameras one by one , with some delay , the way i want them to be physically numbered.
And then i connect() to them and issue an mc:save_list().IDs in the file will be as i want them (physically) to be.
Is there a way to put a parameter in mc:connect() to take as an input this file and connect to cameras per id order?This way every time camera with id=1 (id=1 in the file that is) will be connected first , camera with id=2 connected second , etc etc.Regardless in what way and order will be powered on in the future.Just a thought.


EDIT : ignore the problem with buttons , nothing to do with the latest changes...found the problem :)
I used some mc:cmdwait command , and worked perfectly , then i remembered that the syntax is return mc:cmdwait blabla and correct it , and error occured... it assumes that "return" is  closing some function..nice mess...pfff

EDIT no #2 : To add something to the idea on no #4 above. If such thing is possible then someone can create groups of cameras.Lets say i will have 8 poles of 8 cameras each.I can , let's say , connect the cameras of one pole (create the file of ids of these cameras) and do some testing.Do the same thing for every pole.
Then if i want to "work" with a specific set of cameras (of specific pole) , i can just connect using the apoppriate id file.
« Last Edit: 21 / July / 2014, 10:23:31 by mphx »


*

Offline reyalp

  • ******
  • 14110
Re: Multi-camera setup project.
« Reply #84 on: 21 / July / 2014, 16:06:12 »
First of all , just to let you know , probably you know it already , there is an error everytime mc:connect() is issued.Nothing to do with latest changes , this happens from day 1.This error doesn't affect the connect() or anything else after that , so i just ignore it..but i thought to let you know.

"ERROR: D:\Downloads\project3d\chdkptp-r599-win32\lua\gui.lua:138: attempt to index field 'apiver' (a nil value)"
I think I fixed this in recent versions (607, 614). I can start the gui and run !mc=require'multicam';mc:connect() without any errors. But as I mentioned, I don't test much with the gui.
 
Quote
1.first of all , svn update didn't go smoothly :) Had 2 "conflicts" , i had to manually copy/paste the new files just to be sure.But this process , i can't use it for gui.lua , since i have added things , to make my own tab.
So every time i just believe that svn update works for this file (it always has a red "!" on it even now as we speak :P )
Tortoise have a pretty good interface for editing the conflicts, see http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-conflicts.html. You can reduce the chance of conflicts by putting most of your code in it's own file and just calling functions a few points.

Quote
4.Let's say i turn on cameras one by one , with some delay , the way i want them to be physically numbered.
And then i connect() to them and issue an mc:save_list().IDs in the file will be as i want them (physically) to be.
Is there a way to put a parameter in mc:connect() to take as an input this file and connect to cameras per id order?This way every time camera with id=1 (id=1 in the file that is) will be connected first , camera with id=2 connected second , etc etc.Regardless in what way and order will be powered on in the future.Just a thought.
This is what mc:connect{list=...} option does. The initial connections don't happen in order, but the ID numbers are preserved, and any operations on the cameras happen in the same order.

A detail I didn't explain the last post: if you use mc:save_list() without a path, saves in a file called mccams.txt in a directory specified by CHDKPTP_HOME or (if that isn't set) HOME

If you use list=true on connect, it uses this default file.

Quote
EDIT : ignore the problem with buttons , nothing to do with the latest changes...found the problem :)
I used some mc:cmdwait command , and worked perfectly , then i remembered that the syntax is return mc:cmdwait blabla and correct it , and error occured... it assumes that "return" is  closing some function..nice mess...pfff
When I post code here, I usually post it as I would enter in the CLI. In the CLI !return mc:cmdwait(...)
causes the return values to be displayed.
If you are calling cmdwait from code, then you are responsible for checking or displaying the return values yourself.
Quote
EDIT no #2 : To add something to the idea on no #4 above. If such thing is possible then someone can create groups of cameras.Lets say i will have 8 poles of 8 cameras each.I can , let's say , connect the cameras of one pole (create the file of ids of these cameras) and do some testing.Do the same thing for every pole.
Then if i want to "work" with a specific set of cameras (of specific pole) , i can just connect using the apoppriate id file.
If you made a list with all the cameras, you could use a text editor to create sub-lists. The format is just a lua table. Note that the table is not necessarily in any specific order, so you would need to pay attention to the IDs.

Alternatively, you could use the mc:sel() function, although you would have to list all the ids, like mc:sel{1,2,3,...}. Of course, you could easily make your own functions to do that. I might add a range option.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #85 on: 21 / July / 2014, 17:41:46 »
@reyalp

pff ... i didn't see the paragraph about  mc:connect{list=...} earlier in your post...my bad.

Something to think about now :)

So lets say i do an initial connection to ALL cameras.I generate the file. And then i can take this file and CUT it to pieces ..and create let's say 8 other files numbered (per id i mean) from 1 to 8 , 9 to 16 , etc etc.

And create buttons named "Pole 1" , "Pole 2" , etc etc and each one of these buttons will connect to the specified by the file cameras....am i getting this right?


And a last thing... the syntax of list=true would be something like mc:connect({list=true}) ?


PS : Can some deletion or mass download command be implemented? :)

*

Offline reyalp

  • ******
  • 14110
Re: Multi-camera setup project.
« Reply #86 on: 21 / July / 2014, 21:48:48 »
And create buttons named "Pole 1" , "Pole 2" , etc etc and each one of these buttons will connect to the specified by the file cameras....am i getting this right?
Yes.

As mentioned earlier, you could also just connect to all the cameras, and make your buttons use mc:sel() with the desired ranges of ids.

Using connect is probably better if you don't expect the other poles to be powered on. Using sel is probably better if you are working on all the cameras, but just want to temporarily do something with only one pole.

Quote
And a last thing... the syntax of list=true would be something like mc:connect({list=true}) ?
Yes. But if you have multiple files as mentioned above, you'll need to use the filename instead.

Quote
PS : Can some deletion or mass download command be implemented? :)
I plan to add both, but as always there is no particular schedule.
Don't forget what the H stands for.

*

Offline mphx

  • ***
  • 210
Re: Multi-camera setup project.
« Reply #87 on: 22 / July / 2014, 08:44:41 »
I did some more tests with connecting to cameras through the file.

Unfortunately usb naming isn't predictable.What i mean.

I powered cameras up , one by one..in order...i noticed that the last one that was powered up took id no #1 !  :blink:

I created the id file...and then i shutdown all of them.I started powering them up randomly this time.They took the same ids !! I connected them through !mc:connect({list=true}) , but it was pointless , since they had the same ids like before.so file or no file , they took the same ids again.

I disconnected usb hub from the pc and reconnected it.Now ids were reversed... last one got id=8 and first one in order took id=1 (that was what i expected when i first powered them up).
So now it was a good time to check if ids will stay the same using the file.Yep it worked.As expected.

But the thing is that the order of powering up doesn't ensure the given ids.
So it might need some copy pasting serials into the file , to achieve the wanted order....but atleast it will be done once...when the time comes...


Re: Multi-camera setup project.
« Reply #88 on: 22 / July / 2014, 09:08:19 »
But the thing is that the order of powering up doesn't ensure the given ids.
So it might need some copy pasting serials into the file , to achieve the wanted order....but atleast it will be done once...when the time comes...
Somehow,  this still feels to me like a better solution : http://chdk.setepontos.com/index.php?topic=11631
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14110
Re: Multi-camera setup project.
« Reply #89 on: 22 / July / 2014, 17:10:24 »
I powered cameras up , one by one..in order...i noticed that the last one that was powered up took id no #1 !  :blink:
I did warn you that I hadn't tested this thoroughly. It was just casual observation with 3 cameras that might have provided a shortcut to getting them in order.
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal