Does InitiateCapture work for API v2 over USB (Theta S)?

The place to discuss development topics.
Discussions on the RICOH THETA API and SDK, image processing of spherical images, other hardware related topics, introduction of useful libraries, etc.

Does InitiateCapture work for API v2 over USB (Theta S)?

Postby mattwymore » 21 Apr 2016, 00:11

Hi Folks,

Has anyone been able to get the InitiateCapture command to work with v2 of the API over USB? I am using the Windows Portable Devices API on windows 10. The code I am using works with other MTP/PTP capable cameras, but with the Theta S image capture will not trigger. Just wondering if anyone else has tried this. Thanks.

matt
mattwymore
 
Posts: 4
Joined: 05 Apr 2016, 21:20

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby mattwymore » 21 Apr 2016, 19:24

Okay, I figured out how to make this work. This feature does work correctly, you just have to issue "raw" MTP/PTP commands to get it to work. So if anybody else is using the Windows Portable Devices API to control the Theta S, keep this in mind:

1. It looks like you can't use the WPD command WPD_COMMAND_STILL_IMAGE_CAPTURE_INITIATE to initiate capture. If you use this command the driver returns an error to you.

2. The correct way to do this is to use WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITHOUT_DATA_PHASE and set up all the parameters and Op Code for image capture and then send that command. Take a look at this example from Microsoft for setting things up. Basically you just need to change the Op Code to 0x100E (for initiate capture) and change the StorageID to 0x0 (as documented in the Theta v2 USB API) and you are ready to go.

Hopefully this helps out anybody that is trying to do tethered capture.
mattwymore
 
Posts: 4
Joined: 05 Apr 2016, 21:20

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby codetricity » 21 Apr 2016, 21:12

How did you get the API over USB to work? Is there a new piece of software that was released? It doesn't seem to be listed here:
https://theta360.com/en/support/download/

Did the API over USB start to work with the firmware upgrade? I'm really curious to learn what you needed to do.

Thank you.
codetricity
 
Posts: 397
Joined: 31 Jul 2015, 01:56

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby mattwymore » 22 Apr 2016, 14:33

Hi,

I did have to upgrade the firmware to get this to work. If you don't upgrade, the camera only acts like a storage device when you plug it into your computer. It won't even work with the Theta S app on iOS/Android. My device is on firmware version 1.42 which I believe is the latest. Once I upgraded to that I was able to talk to the device with the Windows Portable Devices API. I am writing my own controller so there were no other software packages needed for me. Hope that helps.

matt
mattwymore
 
Posts: 4
Joined: 05 Apr 2016, 21:20

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby codetricity » 22 Apr 2016, 19:12

My understanding is that RICOH only enabled PTP API (v1 of the THETA API) over a USB cable, not the v2 (Google OSC specification). I actually didn't know it was already working with the new firmware. Thank you. Is there any sample code you want to share?

I saw a demo of the camera connected to a tablet with a USB cable at a show. It was really slick and got around the problem of having to initiate a WiFi connection or dealing with timeout. In the demo I saw, the camera was also powered from the same USB cable in addition to being controlled by USB.

Would be great to get some starter code for this. Did you find an example somewhere or any documentation?
codetricity
 
Posts: 397
Joined: 31 Jul 2015, 01:56

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby mattwymore » 24 Apr 2016, 01:02

Once I finish this project I would like to post a sample. There a few details that were kind of a pain to figure out, so it would be great to help out other folks to spare them that pain. It will probably be about a week before I can post this though...I need to get code ready for clients, but stay tuned!

matt
mattwymore
 
Posts: 4
Joined: 05 Apr 2016, 21:20

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby codetricity » 25 Apr 2016, 18:50

@matt, thank you. I haven't had time to test the API over USB yet, but I know this will be an important feature for people that want to connect the THETA to an external standalone device like a real estate or construction tool (go to construction site and show client what building looks like from the inside). This would also be great for live streaming of events from a small, high-powered windows device.
codetricity
 
Posts: 397
Joined: 31 Jul 2015, 01:56

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby backinside » 20 Jun 2016, 22:50

Hi

Did you manage to post the code somewhere?
I would like to control the sleep cycle of the device through USB to save power, since the device is discharging faster than I can charge it
Can you share your findings?

Best
backinside
 
Posts: 3
Joined: 01 Jun 2016, 10:53

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby 200ok » 08 Jul 2016, 13:31

This is a great thread. I am also interested in this. The WiFi works well, but it is often times much too slow.
200ok
 
Posts: 1
Joined: 24 Jun 2016, 17:13

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby codetricity » 08 Jul 2016, 20:21

I wrote a guide here on how to use the API over USB:
http://codetricity.github.io/theta-s/usb.html

There's some problems that I still need to sort out. Help would be awesome.

What's working:

  • Grab info
  • List images
  • Take Picture
  • Download images to JPG or hex stream
  • Set Mode
  • Start Video Capture
  • Show all known attributes supported by API such as battery level
  • Power the camera from the USB cable indefinitely and have it always ready for API commands

The good:
  • I don't have to mess with WiFi setup
  • I don't take up a network interface on my computer (it's just a USB connection)
  • The camera never times out or loses battery
  • The download is super fast

Remaining Problems
  • I have a problem stopping the video. Seems totally doable, but I do not have it working
  • the delay with stitching after initiateCapture is causing an error code on the response, but the picture is saved and is fine. You may have to set a delay in your code before you take the next picture as there may not be a suitable response code for completing initiateCapture. I would like to find out.
  • I do not have good C code examples despite using the libptp shared library. It works, I just don't have good code examples. Please help.

I'd like to build a demo that takes timelapse pictures over the course of several days, possibly 20,000 pictures or so in order to show the value of the USB API. Seems easy as I have the camera already set to take a picture with Python code and delete the picture from the camera after it downloads it to local storage. I suppose I could also have it automatically upload to the RICOH Cloud.

I think it is very possible to get this working on the Raspberry Pi and I was looking for a nice case. I think this looks really cool and am thinking about it for a type of demo.

Image

I woke up and ordered this case, so maybe the controller will look like a normal tablet if I use this to control the THETA.

Image
codetricity
 
Posts: 397
Joined: 31 Jul 2015, 01:56

Re: Does InitiateCapture work for API v2 over USB (Theta S)?

Postby codetricity » 14 Jul 2016, 14:04

I have a Raspberry Pi working with the USB cable to control the THETA using gphoto2. This is easier than libptp as gphoto2 is an apt package. Just install it and use it.
I'm documenting my progress here:
http://lists.theta360.guide/t/ricoh-theta-s-api-over-usb-cable/65/17?u=codetricity

So far, I've tested these commands over USB from the Raspberry Pi:
  • take picture
  • check and adjust shutter volume (0-100)
  • list images and directories on camera
  • download picture or range of pictures from camera to Raspberry Pi
  • download video
  • list parameters on camera that can be changed
codetricity
 
Posts: 397
Joined: 31 Jul 2015, 01:56


Return to Development



All times are UTC