-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera - Process does not seem to complete (Question) #13
Comments
Connect another SSH session and run this:
And check/post the log. Also, set log level to DEBUG rather than INFO and have a look. I have literally taken approximately 1 million picture captures with this library without problem. |
You camera is enabled via raspi-config? |
Yes it woks with Raspistill. |
Without all the logging I asked you for, it's impossible to say any more. |
I really believe that! But as I said previosly I'm begginer at raspiberry world.
The debug logs are this: Thanks. |
Honestly, I don't know. Are you using the latest version of this library? Does it hang there every time you use it? What is your own code doing - is it single-threaded? This looks similar to another reported issue #9, but nobody ever reported it failing on the first capture. As a result of #9, you can specify a timeout on the capture which would prevent your permanent hang, the idea being you create a new camera and try again. But if you can't get a single capture, I really have no idea what could be wrong. |
On the face of this issue looks like #9 (now superseded by #14), but I would like to know if in your case you fail to get even a single capture working. For the related issue, I have never seen myself or had it reported that the Pi was completely stuck and needed a power-cycle, so there's a chance your issue is different. |
Hi Mark Lee. Again. Thank you for your atention. |
Will you please answer this question that I asked above: Does it fail on the first capture? Or have you been capturing lots of pictures and it eventually stops? |
It fails on the first try. |
I can't believe this would be the problem, but would you please try this: This is the current code:
Change it to this:
I have had a few JNA projects with non-obvious object-scoping/garbage-collection issues. I will be amazed if this fixes the problem, but I'd like to rule it out if you don't mind trying. |
I have no idea why it fails for you on the first capture. I've got over 100k successful captures in a test I'm running right now :-/ I noticed before you were using sshexec, have you tried instead manually launching your app on the Pi? |
I suppose you could maybe grab your thread dump when you hang just in case there's anything different in there. |
Did switching to picam-2.0.0 make any difference for you? |
Hi Caprica. Good night. On the first try running with sshexec it doesnt show anymore caprica logs information as before. I was wondering if in my raspberry It missing something to install... could be? |
Another thing that I tried. I've cloned picam project directly on my raspberry and did mvn test on command line. It runs sucessfully. But as I could notice, he only test the FourCCTest.java. Why others class as BasicTest and StressTest are not in the @test annotation? Another question. I'm trying to debug remotly but I get a lots of errors. |
You asked a bunch of questions... The tests you mention are not unit-tests, they are integration tests that must be run on the Pi, because that's where the hardware is of course. For me developing on the Pi itself is just too slow and painful. I develop the Java code on Linux, build it, and copy it over. It's a little awkward but only takes a few seconds when you get into the rhythm. So when I run a build on Linux, I can't have those tests run. For debugging the Java code, in principle you can connect a remote debugger but I never bothered. For debugging the native code, gdb, but it's kinda hard to use. For the JNI version (picam-2) there is much less Java code, so the Java logging is basically useless and I removed it. Anyway, back to your problem... The thing about the Pi, it's pretty much supposed to be a standard platform, right? So if the camera capture works for me, it should work for everyone. You are the first person I have had a report from that had their Pi completely lock up when trying a capture. Where it apparently locks up, the only thing the Java code is doing is waiting on a semaphore to be notified by a native callback. The standard test is: does Raspistill work? You already told me Raspistill did work for you, so I am totally confused as to why this library is not working for you and I am running out of suggestions to help you. Maybe make sure your software is fully upgraded, the OS, the firmware, everything. Is there anything unusual/non-standard about your Pi hardware and/or OS? Also, I don't know but it may be better for you to stick with picam-1 until we get to the bottom of this issue. But really, I don't know what else to suggest right now. |
i think we should talk more specifically.
I'm personally using Java Embedded version builded at my local machine then copied to Raspberry, that way save me a lot of space and JVM is specifically Embedded
@caprica |
Could you post the exact code you are running and the exact command-line you are using to start your application? If you are running only the code in the tutorial, is it exactly that code without any modifications? |
IMO, you should trying using a "proper" JDK on your Pi at least until you get this working. Your Java Embedded version might be the culprit. Edit: Ooops, I didn't see that another name joined the conversation. So @AlexanderShniperson you are saying this does actually work with the embedded version? That's really interesting to know. |
@LoveraSantiago please tell me your exact OS and JDK/JVM versions, I have a spare Pi that I could try and set up exactly the same as you, but it might take some time. |
@caprica |
Hi @caprica and @AlexanderShniperson I am using For the project I make a "fat jar" with all dependencies inside my jar. I also validate my Raspistill commands directly in the command line and with this little java project who executes raspitill commands. https://blogs.msdn.microsoft.com/robert_mcmurray/2015/06/12/simple-java-wrapper-class-for-raspistill-on-the-raspberry-pi-2/ |
You're using the standard Raspbian OS? |
I have a Pi 2 Model B and a Pi 3 Model B+, both with their own camera. All of my testing until today had been on the Pi 2 (with OpenJDK). Today I tested on the Pi 2 with Oracle's JDK, and on the Pi 3 from scratch (a completely fresh installation). For the Pi 3, I did this:
The output was this:
This produced a file named "1.jpg" that contained a valid picture. No error and no lockups. I ran the same test on my Pi 2 with Oracle's JDK. Same result. Please try the exact same test with picam-2.0.1 jar when it arrives in Maven Central later today. I am totally at a loss to explain why Raspistill works for you, but this does not. It makes no sense. I don't know what else I can do to help you. :-( |
Hi @caprica |
Well, I have no idea then. I tested that configuration as you can see above. Please run the test app I mentioned in an above comment. If that doesn't work, there must be something different about your environment but I don't know what. |
I had the same problem. What I've found out is you need to have a little timeout before you make a first |
There is no reason according to the code that what you've described would make any difference. In my own tests, I take pictures immediately after creating the camera and instantly one after the other with no delay for hundreds of thousands of pictures without seeing this particular issue. Very, very rarely I do see a hang described in the other issue #9. I have seen that hang maybe once in 1.5 million pictures taken in my own tests. But what is described in this issue is different to that described in #9. Believe me, I'd like to 100% nail all such hangs, but dubious sleeps is not IMO the answer. |
The only reason I could think of, and this is just a wild guess, the native code which got copied into temp folder right before the camera is initiated is not yet ready for some reason. I'll investigate more and keep you posted. But the delay was the only way I could get the lib working. |
That's an interesting observation. But the code that copies the native library simply uses Files.copy(src,dest). I'd be very surprised if that wasn't guaranteed to complete properly before the method returned and the native library was loaded. As far as I can remember, I was using the exact same hardware and software as OP and I did not see this issue. It's all very strange. Any testing is very welcome! |
Maybe I have a better SD card or something, I dunno. :-/ |
I agree that coping the native file cannot be an issue. But initiating Shared Library could take some time I suppose. I'm not sure how it works, but I'm guessing that in some cases the system cannot load objects or functions from |
Your feedback and testing is appreciated, thanks. |
After some research it looks like indeed maybe Files.copy is not forcing a file-system sync. |
I made a quick patch here 676103a It might help if the theory advanced above is correct. |
As to the other suggestion - if the library is not properly loaded and "ready" immediately by the time System.load() returns, then all bets are off. I just can't believe this would be the case. |
Reinstalled everything on a new flash card from scratch, have the same problem. Need delay for the library to work. I'll try your patch later and let you know if it helped. |
Actually, just reviewing the entirety of this issue I think OP had this issue before picam started bundling a native library. |
Hi
|
What happens if you use the latest release version, not a snapshot version? |
lib version Also have this exception
I'm using proguard, maybe it is produce problems, will try to disable them |
Disabled ProGuard didn't make effect |
Seems like a different issue than what is being discussed here. The only thing I can think of is the JNI version bundles a pre-built shared library that might be incompatible with your Pi hardware/software combination. But I thought all Pi had the same hardware architecture so it would be OK to bundle a pre-built library. If the problem is with the JNI version go back to the JNA version. :-/ |
@caprica |
@AlexanderShniperson probably create a new issue for your problem please. things you can try: build the JNI library yourself on your own Pi and tell picam to use that specifically, and/or; post full hardware/OS details, I'm especially interested in the architecture triplet; also make sure you run the test application bundled with picam and post the results (as described in the github readme for the project) You can use gcc -dumpmachine to get the triplet |
Closing due to lack of activity. |
Hi Caprica and folks
I am working with camera. I followed the http://capricasoftware.co.uk/projects/picam/tutorials
I am using Noir Camera V2 8mp
While running the "Taking Pictures" example I see the logs of the Camera class:
[main] INFO uk.co.caprica.picam.Camera - >>> Begin Take Picture >>>
[main] INFO uk.co.caprica.picam.Camera - Preparing to capture...
[main] INFO uk.co.caprica.picam.Camera - Capture started
And the process stops. Nothing happens.
If I run the program again no log appears.
I also noticed that when trying to turn off my raspberry pi it stays frozen and dont shutdown. When I run this example.
Any tips to help me please.
Thanks
The text was updated successfully, but these errors were encountered: