Better way to confirm a task is done on Z1?

I am using ptpcam in python to control the Z1. After I send a commend, I search for the key word and use that for conforming the task is success. If it cannot find it, I just resend the command again. This method is working okey, but I wonder if there is better and smarter way to confirm a task is done. Below is a one of the function I use to capture the image. Thanks.

    def Capture():
        cmdCapture = ["ptpcam", "--capture"]
        isSuccess = False
        retryNum = 0
        while not isSuccess:
            process = subprocess.Popen(cmdCapture,stdout=subprocess.PIPE)
            process.wait
            status = process.communicate()[0].decode('ascii')
            if "successfully" in status:
                isSuccess = True
                return isSuccess
            elif retryNum <= MaxTryNum:
                reTryNum =+1    
                time.sleep(2) 
                continue
            else:
                return False
1 Like

I have not tried this, but there is a CaptureComplete API call.

https://api.ricoh/docs/theta-usb-api/event/capture_complete/

This might also be relevant.

https://api.ricoh/docs/theta-usb-api/property/functional_mode/

https://api.ricoh/docs/theta-usb-api/property/capture_status/

There’s a long thread here with examples to send the raw USB hexcodes to the camera with ptpcam -R

RICOH THETA API Over USB Cable - (Z1, V, S, SC models)

At the time we were testing the USB API, we were just trying to get it to work. However, if I were to build something today, I would try to experiment with something like 0x5002 FunctionalMode or 0xD808 CaptureStatus to see if I could get better results.

Hi Craig,

Thanks for the advice. I will try the hexcodes and the functions you mentioned.

2 Likes