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

As far as I know, there is no end-user application that controls the camera settings over the USB cable. People primarily use the USB API for custom robotics, surveillance and drone applications. Usually, they don’t put the application out since they use the application as part of another product.

You can try holding down the power and Wi-Fi buttons on your Z1 down for 18 seconds.

If you’re still stuck, you can use this testing app for Z1 that we built for internal use.

Android App to Manage In-Camera Stitching, Top/Bottom Correction, and Reset

You should also consider calling RICOH official customer support.

I’m glad if you can answer more than one questionnaire, rather than just choosing one from multiple options.
It would be even better if you could include Japanese as well. Translation is possible, of course, but we want to avoid fluctuation in the translation.

Thanks for the great feedback. I changed the survey to allow more than one response per category. This was a mistake on my part. Thanks for the help. :slight_smile:

1 Like

I sent a questionnaire.

1 Like

@NaokiSato102, thanks for filling out the survey.

I have several updates to the USB API information at the site below. Most importantly, I have an example of how to turn on the THETA from a power off state using a Jetson Nano to send a USB power signal to the camera. Previously, I had only documented how to wake the camera up from sleep, put it to sleep or power off the camera.

I think the technique of powering on the camera from power off might be useful for robotics systems where the robot and associated power supply are off for a week. In this circumstance, having the camera be in sleep mode and then waking it up may not be sufficient.

This could also be useful for situations where the camera is remote and the area has suffered a power outage, eventually leading to the camera running out of battery and turning off. In that case, the technique described in the documentation may help to get the camera back to a powered on state that can then communicate using the USB API.

https://theta360.guide/special/linuxstreaming/

Different topic regarding Python bindings for USB API

I’m having problems using the Python bindings to gphoto2. Have you had more success, especially with setting the camera mode from still image to live streaming?

I have been using this example, but have not been able to use the full API.

There seems to be a bit more information here:

There is another project here:

https://gphoto2-cffi.readthedocs.io/en/latest/

I’ve started the build a test GUI using Dart with Flutter widgets and GTK on Linux. At the moment, I can just change between still image and live streaming with the buttons. I have many of the other commands built out, just not connected to buttons. At the moment, I’m using ptpcam behind the buttons. This makes it easier to manage the scripts I am building to test more of the camera USB API.

Change to Live Streaming

usb_api_3

Wake From Sleep

sleep

Hi,
Thanks alot for the updates. I have a setup where I want to control multiple 360 cameras from a raspberry pi. I was wondering if its possible using ptpcam. I tried connecting RICOH Z and RICOH V to my laptop and used ptpcam -i to check attached devices but its only able to show Z and when I disconnect Z It shows me V. I was wondering if I connect lets say 3 or 4 cameras to a RPI and try to get pictures from them how could it be done.

Thanls

I tested on x86 as that was what I was working on at the moment. I can test on other devices, but it may take time. I’m assuming that you just need to specify the --dev and that you’re fine. If you’re still having a problem, please post again.

Test Environment

  • Ubuntu 20.04 on x86
  • libptp and ptpcam. compiled from source with patches. v 2-1.2.0 (assuming you have this working. If not please post again)
  • Camera with dev id 42 is Z1 with firmware 1.50.1
  • camera with dev id 41 is V with fimrware 3.40.1
craig@cube:~$ ptpcam --list-devices

Listing devices...
bus/dev	vendorID/prodID	device model
003/042	0x05CA/0x036D	RICOH THETA Z1
003/041	0x05CA/0x2714	RICOH THETA V

$ ptpcam --dev=042 --info

Camera information
==================
Model: RICOH THETA Z1
  manufacturer: Ricoh Company, Ltd.
  serial number: '10010104'
  device version: 1.50.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x006e

craig@cube:~$ ptpcam --dev=041 --info

Camera information
==================
Model: RICOH THETA V
  manufacturer: Ricoh Company, Ltd.
  serial number: '00105377'
  device version: 3.40.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x006e

craig@cube:~$ ptpcam --dev=041 --capture

Initiating captue...
Object added 0x00000226
Capture completed successfully!
craig@cube:~$ ptpcam --dev=042 --capture

Initiating captue...
Object added 0x00000011
Capture completed successfully!

Slightly more complex, list files:

~$ ptpcam --dev=042 --list-files

Listing files...
Camera: RICOH THETA Z1
Handler:           Size: 	Captured:      	name:
0x0000000e:      9086912	2019-01-01 08:03	R0010001.JPG
0x0000000f:      7968843	2019-01-01 08:00	R0010002.JPG
0x00000010:      7990763	2019-01-01 08:01	R0010003.JPG
0x00000011:      8008310	2019-01-01 08:03	R0010004.JPG

I have several hundred pictures on the V, but it showed it.

$ ptpcam --dev=041 --list-files

Listing files...
Camera: RICOH THETA V
Handler:           Size: 	Captured:      	name:
0x00000142:      4152882	2020-06-17 20:59	R0010273.JPG
0x00000143:      3979605	2020-06-17 21:03	R0010274.JPG
0x00000147:      4413502	2020-06-17 21:43	R0010277.JPG
...

Test with Two Cameras in Streaming

$ ptpcam --dev=041 --set-property=0x5013 --val=0x8005

Camera: RICOH THETA V (bus 0, dev 41)
'Still Capture Mode' is set to: [Normal]
Changing property value to 0x8005 [(null)] succeeded.
craig@cube:~$ 

$ ptpcam --dev=042 --set-property=0x5013 --val=0x8005

Camera: RICOH THETA Z1 (bus 0, dev 42)
'Still Capture Mode' is set to: [Normal]
Changing property value to 0x8005 [(null)] succeeded.

At this stage, I now have two cameras streaming into the same devices. I need to do more tests to manipulate both streams.

however, if your application is handing the stream and image processing already, then you should be good to go.

Other Ways to Grab Device ID

You can also grab the device ID with lsusb or libusb.

image

Updates to document available here:

https://theta360.guide/special/linuxstreaming/

  • Walkthrough of compiling libptp and ptpcam on Raspian 10 buster using Raspberry Pi 3
  • Example uses libusb-compat with links to relevant GitHub repos our SourceForge downloads
  • Overview of options to use THETA USB API from the camera, including using subprocess or process from different languages such as Python and Dart. The example above uses Dart and Flutter on a Raspberry Pi 3 to send API commands to a THETA Z1 using the USB cable.
  • Added new section on using Raspberry Pi to turn on THETA from power off state. Previous technique only explained how to use an NVIDIA Jetson to turn on THETA. You can likely use an x86 computer, but it is more expensive.
2 Likes

I’ve started a video series on using the USB API. The first video is an overview of what the API is and where it can be used.

The second video is an overview of the specific packages that are commonly used to implement ptp or mtp on the different OSs.

RICOH THETA USB API Development Quick Start

RICOH THETA USB API on Raspberry Pi - Setup and Use

RICOH THETA Raspberry Pi - Take, Download, Delete Files with USB Cable

RICOH THETA USB API - Stabilize Timelapse

1 Like

Hello i have a RICOH THETA V camera and i am trying to use it through the USB API. I have a problem when i put it on sleep mode, i cannot “wake” it up, the commands of ptpcam are “working” but the camera cannot recover from sleep mode. When the second command runs (which is to wake up the camera), the LED on the side lights green, then blue, then green and it turns off again. Thank you.

what firmware version are you using?

Are you using Linux natively on the Lenovo? Or, are you using WSL?

How much time are you waiting after you put the camera to sleep? Try waiting 20 seconds or more before you wake it up.

I’ll try and replicate this later today.

My firmware version is 3.70.1, I am using Linux natively, Ubuntu 18.04. Also I tried many different scenarios I let it sleep for over 3-4 minutes, tried waking it up immediately after putting it in sleep mode etc.,

THETA V - Did not wake up

craig@craig-desktop:~$ ptpcam --info

Camera information
==================
Model: RICOH THETA V
  manufacturer: Ricoh Company, Ltd.
  serial number: '00105377'
  device version: 3.70.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x006e

craig@craig-desktop:~$ ptpcam --info

Camera information
==================
Model: RICOH THETA V
  manufacturer: Ricoh Company, Ltd.
  serial number: '00105377'
  device version: 3.70.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x006e

craig@craig-desktop:~$ ptpcam --set-property=0xD80E --val=1

Camera: RICOH THETA V
'UNKNOWN' is set to: 0
Changing property value to 1 [(null)] succeeded.
craig@craig-desktop:~$ ptpcam --set-property=0xD80E --val=0

Camera: RICOH THETA V
'UNKNOWN' is set to: 1
Changing property value to 0 [(null)] succeeded.

Result: Did not wake up.

retry test with Z1 - woke up

craig@craig-desktop:~$ ptpcam --info

Camera information
==================
Model: RICOH THETA Z1
  manufacturer: Ricoh Company, Ltd.
  serial number: '10010104'
  device version: 2.00.1
  extension ID: 0x00000006
  extension description: (null)
  extension version: 0x006e

craig@craig-desktop:~$ ptpcam --set-property=0xD80E --val=1

Camera: RICOH THETA Z1
'UNKNOWN' is set to: 0
Changing property value to 1 [(null)] succeeded.
craig@craig-desktop:~$ ptpcam --set-property=0xD80E --val=0

Camera: RICOH THETA Z1
'UNKNOWN' is set to: 1
Changing property value to 0 [(null)] succeeded.
craig@craig-desktop:~$ 

Next step

We will summarize and report to RICOH.

Dear Theta Community,

any news on this post?

I recently started using a ThetaV also for robotics with live streaming (as a virtual pan and tilt unit). For the the real system automation and integration I just can not afford to push buttons so I scraped down ptpcam from libptp2 and thus started to build a c++ thetaV API using ptp… it is coarse and early stage, but I am happy to share the code. I can changes modes, streaming works fine,

Just one issue, when it comes to waking up the device I have the same issue as above. Neither with with my code nor with ptpcam as above it works.

My observation, we had 2 thetas in the lab and before programming, I am 99% sure it worked with ptpcam on a theta where I did not upgrade the firmware… Then later I did and when coding I could not make it work ever again.

Can anyone confirm or try with a theta V that does not have 3.70.1 (I think the working version was bought in 2018 and not upgraded)

I hope this helps and someone knows?

It would be really cool to use the low latency live streaming in remote operated robots as “pan and tilt unit without moving parts”

Thanks a lot in advance,
Thomas

I believe wake from sleep did work on the V prior to firmware 3.70.1. I don’t have a V with an earlier firmware, but it did work for me in the past.

I’ve reported this problem to RICOH and will add your new report.

It would be great if you could share your C++ code for the THETA V API.

Dear Craig,

thanks for the quick response. Let us hope that this in interest of RICOH, if there is anything we can do I would be open for it. For my use case the automation and wake-up would be really important but we could also buy a Z1 if it supports it.

For the code: It is really fresh and I was just putting together and documenting a bit to get it out here. As said a bit coarse, missing features and robustness checks but a foundation for something more. It also re-use a bit of original code from ptpcam…

This is a start for controlling it via c++ using underlying ptp

The overall goal, using the above lib is a virtual pan and tilt unit…

Both work but lack yet robustness and have hardcoded values… But I will improve and could help out attempts building it.

2 Likes

The Z1 works with wake from sleep. See this post. The second test is with the Z1 and it did wake from sleep. This is with firmware 2.00.1, which is the newest firmware for the Z1.

RICOH THETA API Over USB Cable - (X, Z1, SC2, V, S, SC models) - #96 by craig

The V used to work, but the newest firmware 3.70.1 does not work with wake from sleep. There is no way to roll the firmware back.

This is an example putting the camera to sleep and waking it up as well as powering it on and powering it off. Older firmware, but the API still worked with the Z1 in my more recent test with firmware 2.00.1

This is very cool. What type of board do you have connected to the RICOH THETA? Is it a Raspberry Pi, Jetson Nano, x86? The libptp code is a bit difficult to work with, so this type of project is a big help to add an easier layer of abstraction.

The controller is amazing. Well done! I’m curious as to what the board you are using is so that I can test it out with similar hardware. Maybe I should try it on x86?

theta-virtualptu/src/virtualptu-main.cpp at main · kruegerrobotics/theta-virtualptu · GitHub

Thanks, I used both x86_64 Debian and the jetson nano, both worked with the control libs…

For the streaming part itself I was very closely (re)using this example but build the GStreamer pipeline bit by bit. It works well on the x86_64 Debian but on the Nano it was very slow, even using the omx decoders but I think here it is my mistake just somewhere in the pipeline, caps filter or so.

I will check your example would be even curious if the Z1 has better latency in streaming via USB than the V

Thanks for the information. I’ll try it out.

There’s also an implementation of using gstreamer

I believe the Z1 and the V have roughly the same latency. On x86, I can get 250ms using nvdec and glimagesink with the Z1. I did not test the V. However, I have both a V and a Z1, so I could run some comparison tests.

Optimization - RICOH THETA Development on Linux

I normally don’t use a joystick with Linux. Should I just plug an XBox One controller into the Linux box with a USB cable? I have one lying around the living room.