A couple of Multicam doubts and general help - page 4 - General Help and Assistance on using CHDK stable releases - CHDK Forum

A couple of Multicam doubts and general help

  • 81 Replies
  • 4549 Views
Re: A couple of Multicam doubts and general help
« Reply #30 on: 19 / November / 2019, 05:27:26 »
Advertisements
Hi, I'm back! During the last week I've been mainly working in the hardware side of the project, which has been really time consuming. Yesterday finally got to test part of the rig with ten cameras (with only SX150is cameras), and wow! It worked way better than I expected! However I had to deal with a couple of hardware problems first, that may be troublesome in the future when more cameras are added. Software wise, just a couple of hiccups that I got to bypass temporarily.

- First of all USB hub connections are topped out with seven cameras on a single port, even if I use a network of self powered usb hubs. Win7 throws a "too many devices" error. So I had to plug a branch of cameras to a different port, and this is a limiting factor in order to plug the remaining 17 cameras I have since i have no more ports (there's four USB ports but i think they share just two internal hubs). This is probably a hardware/driver issue I'll have to deal with. (I'm suspicious that the main central hub, the one where all the other hubs are being connected is not powering up by itself and instead drawing power from laptop, will need to check)


- Turning cameras on. I already expected this, but yesterday I realized how big a PITA is to turn each camera on manually once they're set up on the rig. I've read suggestions about hacking the power buttons, etc... but couldn't find it again.


- The LED light strips I'm building are way less powerful than I expected. They're SMD 5630s which are the most powerful/readily available for general public. But the amount of light is clearly insufficient and gives a ton of noise in my images. Will have to double the amount, or look for other alternatives. Any tips are welcome.


- Ok, now regarding the software/CHDK side: Couldn't get this to work
Code: [Select]
  mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
I tried inserting the readline like 'folder', "folder", '..folder..' but to no avail. Will try to copy/paste the error later. It surely is a syntax mistake on my side...


- If the cams.txt file that stores camera numbering doesn't match up the connected cameras, the program will quit. I disabled this line temporarily (and used just mc:connect) in order to test the rest of stuff. Will have to recreate it with the new batch of cameras
Code: [Select]
  mc:connect({list='cams.txt'})

- I haven't yet implemented the tonumber suggested previously nor the prompt with default values/confirmation. It's in the to do list. I tried setting the values manually with option 4, but I probably introduced them wrong (had little time to test yesterday) and i think they were ignored. Shutter 0.02, ISO 80, f 4. I'm trying to use the lowest ISO available (which should be ISO 80 "market") and since cameras don't have a real aperture diaphragm I'll have to use the widest aperture available so ND filters don't come in and spoil image quality (f3.4 in SX150is, and f2.8 in most of the others, since they're not the same, is there a possibility to set "widest aperture" in all of them?)


Well, despite all these problems, the project is starting to take shape and I'm very happy with how the code worked up to now. I'm very surprised! Will keep working on it and report anything that comes up. Thanks!!

Re: A couple of Multicam doubts and general help
« Reply #31 on: 20 / November / 2019, 13:39:14 »

USB hub problems are (kind of) sorted out for the moment. Had to re-route most connections, and have the main hub close to the laptop (without extension cable) to avoid problems. In the future will have to rethink this (better hubs?). New lights are coming in the next week, it was shocking to see how bad cameras performed with such poor lighting, noise was eating detail completely (even DNGs were poor) :( Camera power is still being handled by hand at the beggining of each session, I can cope with this for now but will be grateful for any tips.


On the software side, I managed to rebuild the camera list with correct numbering, implemented tonumber in the parameters prompt, and finally got the correct value format for each parameter. So it's all working great. Still haven't managed to get the 'folder' string inserted in the download path, I've tried all the combinations I could think of, but no... no way to get it working. And have left the default values idea for later, to avoid further problems, So if anyone could help me with the 'folder' string, I'll be really grateful :)
Code: [Select]
  mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})

*

Online reyalp

  • ******
  • 12201
Re: A couple of Multicam doubts and general help
« Reply #32 on: 20 / November / 2019, 15:33:17 »
Camera power is still being handled by hand at the beggining of each session, I can cope with this for now but will be grateful for any tips.
The usual solution to this is to mechanically hold the power buttons down or cut them out and hardwire the connections, and then control the power supplies with externally in some way.
Two common issues:
1) You may need to to send
Code: [Select]
mc:cmdwait('post_levent_to_ui"UnpressPowerButton"')
after startup to avoid some parts of the camera firmware getting confused by the power button being held.

2) If you have the power button held, software shutdown (e.g. lua shut_down or "PressPowerButton" levent) stops the firmware OS, but doesn't actually power off the camera hardware (or it powers back on immediately because the physical button is still active). You should first send shutdown, wait a small amount of time, and then cut the external supply.

Quote
On the software side, I managed to rebuild the camera list with correct numbering, implemented tonumber in the parameters prompt, and finally got the correct value format for each parameter. So it's all working great. Still haven't managed to get the 'folder' string inserted in the download path, I've tried all the combinations I could think of, but no... no way to get it working. And have left the default values idea for later, to avoid further problems, So if anyone could help me with the 'folder' string, I'll be really grateful :)
Code: [Select]
  mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
Can you post the specific error or symptom? It would also be helpful to have the code including where "folder" is set.
Don't forget what the H stands for.

Re: A couple of Multicam doubts and general help
« Reply #33 on: 20 / November / 2019, 16:04:58 »
Hi, will keep in mind the tips for the power button hack. thanks!
This is the related code:
Code: [Select]
elseif option == '6' then        ---------DOWNLOAD
  local folder=cli.readline('Folder>')
  mc:cmdwait('play')
  mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
And this is the error from the GUI, I'm back at home and can't test it from CLI since i dont have any cameras here. It acts normally, but there's no files to download and does nothing.
Code: [Select]
> !dofile('MENU4b.lua')
ERROR: call failed:attempt to yield from outside a coroutine
stack traceback:
   C:\CHDKPTP\lua\gui.lua:675: in function 'readline'
   MENU4b.lua:4: in main chunk
   [C]: in function 'dofile'
   [string "dofile('MENU4b.lua')"]:1: in main chunk
   [C]: in function 'xpcall'
   C:\CHDKPTP\lua\cli.lua:748: in function <C:\CHDKPTP\lua\cli.lua:739>
   (...tail calls...)
   [C]: in function 'xpcall'
   C:\CHDKPTP\lua\cli.lua:285: in function 'execute'
   C:\CHDKPTP\lua\gui.lua:683: in function 'action'
   C:\CHDKPTP\lua\gui.lua:642: in function <C:\CHDKPTP\lua\gui.lua:640>
   (...tail calls...)
   [C]: in function 'MainLoop'
   C:\CHDKPTP\lua\gui.lua:758: in function <C:\CHDKPTP\lua\gui.lua:731>
   (...tail calls...)
   C:\CHDKPTP\lua\main.lua:286: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk
If I substitute '..folder..' for 'folder' CLI shuts down. This is the error i get in the GUI.
Code: [Select]
> !dofile('MENU4b.lua')
ERROR: call failed:MENU4b.lua:34: '}' expected near 'folder'
stack traceback:
   [string "dofile('MENU4b.lua')"]:1: in main chunk
   [C]: in function 'xpcall'
   C:\CHDKPTP\lua\cli.lua:748: in function <C:\CHDKPTP\lua\cli.lua:739>
   (...tail calls...)
   [C]: in function 'xpcall'
   C:\CHDKPTP\lua\cli.lua:285: in function 'execute'
   C:\CHDKPTP\lua\gui.lua:683: in function 'action'
   C:\CHDKPTP\lua\gui.lua:642: in function <C:\CHDKPTP\lua\gui.lua:640>
   (...tail calls...)
   [C]: in function 'MainLoop'
   C:\CHDKPTP\lua\gui.lua:758: in function <C:\CHDKPTP\lua\gui.lua:731>
   (...tail calls...)
   C:\CHDKPTP\lua\main.lua:286: in main chunk
   [C]: in function 'require'
   [string "require('main')"]:1: in main chunk
« Last Edit: 20 / November / 2019, 16:06:47 by ikercito »


*

Online reyalp

  • ******
  • 12201
Re: A couple of Multicam doubts and general help
« Reply #34 on: 20 / November / 2019, 16:41:47 »
Code: [Select]
elseif option == '6' then        ---------DOWNLOAD
  local folder=cli.readline('Folder>')
  mc:cmdwait('play')
  mc:download_images({dst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}',delete=true})
And this is the error from the GUI, I'm back at home and can't test it from CLI since i dont have any cameras here. It acts normally, but there's no files to download and does nothing.
The gui error is the same one you encountered before, which is a general problem with using readline from the GUI. It's not related to the folder variable or download command. You can start the cli with chdkptp -i whether or not you have cameras. Of course, you won't be able try the actual download.

If what you are saying is that with the cameras, there are no errors and no files downloaded, I'd suggest adding verbose=true or pretend=true to the download command, so you can see what it's trying to do.
Quote
Code: [Select]
> !dofile('MENU4b.lua')
ERROR: call failed:attempt to yield from outside a coroutine
stack traceback:
   C:\CHDKPTP\lua\gui.lua:675: in function 'readline'
...
If I substitute '..folder..' for 'folder' CLI shuts down. This is the error i get in the GUI.
The syntax in the first example, with '..folder..' is correct. Without the .. is incorrect, resulting in the second error quoted.

In general, to debug stuff like this, you want to see what the program is actually doing at each step, and isolate the problem the most specific part of the code you can.

You and use print to display values. So for example you could use
Code: [Select]
local folder=cli.readline('Folder>')
 print('folder is',folder)
To make sure the value was being read like you expected.
You could also build the dst string outside of the download_images command, and print that, like
Code: [Select]
local mydst='c:/download/'..folder..'/CAM${id}/_IMG_${shotseq}${ext}'
 print('dst is',mydst)
And as suggest above, you can use "pretend" to see what the download would do, like
Code: [Select]
mc:download_images({dst=mydst,delete=true,pretend=true})
If you aren't sure of syntax, you can try things in the chdkptp console with the ! command.
Don't forget what the H stands for.

Re: A couple of Multicam doubts and general help
« Reply #35 on: 20 / November / 2019, 17:51:54 »
Will test it tomorrow as soon as possible. It's a minor problem, but it's been giving me a headache so long. I'm starting to suspect I had something else wrong in the code when I inserted the ..folder.. part, and blamed on it. Anyway, will test asap.
Regarding the power button hack, do you think I could glue it down? Thanks again for all your help. :D

*

Online reyalp

  • ******
  • 12201
Re: A couple of Multicam doubts and general help
« Reply #36 on: 20 / November / 2019, 19:14:36 »
Regarding the power button hack, do you think I could glue it down? Thanks again for all your help. :D
I haven't done it as a permanent mod. I'd personally go for something less permanent and more adjustable. One approach I recall being suggested is rubber bands holding a washer sized to match the button. A zip tie in a similar setup might work too. Another option is to make some kind of bracket with a set screw.

Some related threads
https://chdk.setepontos.com/index.php?topic=13289.0
https://chdk.setepontos.com/index.php?topic=12971.20
https://chdk.setepontos.com/index.php?topic=11434.0

Don't forget what the H stands for.

Re: A couple of Multicam doubts and general help
« Reply #37 on: 21 / November / 2019, 08:51:41 »

Ok, so... Voila! The '..folder..' thing now works! I probably confused some other error, or there was something else preventing it from working :(
Just taped a nut onto the power button, added "unpresspowerbutton" command at startup and all seems to be working prefectly!
A new improvement, added zoom control:
Code: [Select]
elseif option == '2' then        ---------SET ZOOM
  local zoom=cli.readline('Zoom>')
  mc:cmdwait('call set_zoom('..zoom..')')
Since I have a few non SX150is cameras (A2600, to A2300) I expected this option to be troublesome given the different range in zoom. But despite the zoom ratios being different, it's working nicely with both types (from 0 to 128 they zoom in and out nicely). And I'm proud I did this one on my own :D
I'm working in getting a reliable focus method right now. Will report back. Thanks again!


Re: A couple of Multicam doubts and general help
« Reply #38 on: 26 / November / 2019, 18:39:55 »
Hi again, I finally have 20 cameras up and running. There's been all sort of problems along the way, and still have a few to resolve. But, they're "sort of" working. Regarding USB connections, I've had to swap my laptop for a more powerful desktop, to overcome numerous connection issues. On that matter (I believe it is USB related, correct me if I'm wrong) today i've gotten this error a couple of times during different stages of the process (when syncing, zooming,... it's happened in three different cameras)
Code: [Select]
ERROR: call failed:I/O error
attempted to close non-present device bus-0:\\.\libusb0-0002-0x04a9-0x3271
I've been reading about this type of error, some suggest it can be due to power failures/instability. Indeed it has happened on one of the A2400 that I've connected to a power source (instead of it's battery) while the other three (on the same source) have remained stable. But next up I've had the same type of error on two A2400s using their own original battery. So I'm quite puzzled, but I'm thinking it might be USB related? Bad cables maybe? (just ordered a couple of new ones)


The big problem here is that if this error happens, it throws down the whole process and has to be restarted, sometimes even cameras need a fresh start. I suppose this is part of the inner working and there's nothing to do about it? Well, just wanted to check. Thanks again :)

*

Online reyalp

  • ******
  • 12201
Re: A couple of Multicam doubts and general help
« Reply #39 on: 26 / November / 2019, 20:55:54 »
On that matter (I believe it is USB related, correct me if I'm wrong) today i've gotten this error a couple of times during different stages of the process (when syncing, zooming,... it's happened in three different cameras)
Code: [Select]
ERROR: call failed:I/O error
attempted to close non-present device bus-0:\\.\libusb0-0002-0x04a9-0x3271
By itself, that error just tells you that the connection went away. It could be that the camera crashed or hung or other USB errors. Power or grounding issues are certainly a possible cause in a multicam rig, but there are plenty of "normal" bugs that can crash cams too.

If the camera crashes (shuts down, without retracting the lens, if it was out), you can try getting a romlog: https://chdk.fandom.com/wiki/Debugging#Camera_crash_logs_.28romlog.29

Quote
The big problem here is that if this error happens, it throws down the whole process and has to be restarted, sometimes even cameras need a fresh start. I suppose this is part of the inner working and there's nothing to do about it? Well, just wanted to check. Thanks again :)
If the camera hangs or crashes, it at least needs to be restarted. There is a function mc:check_connections described on https://chdk.setepontos.com/index.php?topic=13212.msg135500#msg135500 which might be helpful.

Quote
If you notice cameras are crashed, run mc:check_connections(). You can pass it options for connect, e.g. a camera list like {list='mylist.txt'}

It checks for disconnected cameras in the current selection. If none are found, it returns without making any changes.
Otherwise, it exits the camera side script on the remaining cameras. If mc.cam_powercycle_cmd is defined, it runs it with the IDs of the disconnected cameras and waits 5 seconds. If not, it lists the cameras to be restarted and waits for keyboard input.
After the cameras are restarted, it runs mc:connect with the options passed in, followed by mc:start()

That thread also has some discussion of presumed power related crashes with a2500
Don't forget what the H stands for.

 

Related Topics