Examples of setting GPS Info

Different examples setting GPS info.

from community member 200cm3

- (void)setGpsLocation:(double)lat lng:(double)lng alt:(double) alt
{
 [self setOptions:@{@"gpsInfo":
                           @{@"lat": [NSNumber numberWithDouble: lat],
                             @"lng": [NSNumber numberWithDouble: lng],
                             @"dateTimeZone": @"2014:05:18 01:04:29+08:00",
                             @"_altitude": [NSNumber numberWithDouble:alt],
                             @"datum": @"\"WGS84\""}}];
    
}

Using shell script from Jason Charcalla.

JSON_GPS_SET_REQ=$(< <(cat <<EOF
{
  "name": "camera.setOptions",
  "parameters": {
    "sessionId": "SID_${SID}",
    "options": {
                  "gpsInfo": {
                 "lat": ${GPS_LAT},
                 "lng": ${GPS_LON},
                 "_altitude": ${GPS_ALT},
                 "_dateTimeZone":"${GPS_DATE} ${GPS_TIME}+00:00",
                  "_datum":"WGS84"
            }
        }
  }
}
EOF
))
                   # Set the gps values on the camera via wifi
                echo ${JSON_GPS_SET_REQ}
                   curl -s -X POST -d "${JSON_GPS_SET_REQ}" http://${CAMIP}:${PORT}/osc/commands/execute >> /dev/null
             else
            # Set the gps via usb
            ptpcam --set-property=0xD801 --val="${GPS_LAT},${GPS_LON},${GPS_ALT}m@${GPS_DATE}${GPS_TIME}Z,WGS84"
         fi

       else
          echo "GPS enabled but now location found."
       fi
    fi

Full code for the shell script, including use of input from a GPS unit connected to a Raspberry Pi

1 Like

Hello.

I am able to communicate with THETA Z1 using Raspberry Pi and ptpcam, but I cannot update GpsInfo (0xD801).

What’s wrong?

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"


$ sudo ptpcam --list-devices

Listing devices...
bus/dev vendorID/prodID device model
001/008 0x05CA/0x2716   RICOH THETA Z1

$ sudo ptpcam --info

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



$ sudo ptpcam --set-property=0xD801 --val="45.000000,136.000000,1234.00m@202109041753000900Z,WGS84"

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "(null)"
Changing property value to 45.000000,136.000000,1234.00m@202109041753000900Z,WGS84 [(null)] FAILED!!!

There could be a bug in the USB API implementation in the Z1 firmware 2.00.1. If that is the case, we can report this to RICOH. However, @jcasman and I would like to try and test this more first.

The project below used to work with an older RICOH THETA model. The format of the ptpcam command looks the same as the format you used on the Z1. Can you take a look at line 819 in the script below and try it with the Z1?

We can also try and compare the USB API behavior with this:

Gps_info

Though, the format of dateTimeZone appears to be different.

We can also try with different camera models to try and verify that the command format works on a different model.


command to test

$ sudo ptpcam --set-property=0xD801 --val="45.000000,136.000000,1234.00m@202109041753000900Z,WGS84"

Update:

I’m unable to use this with either the Z1 or the V. I think I have the format of value of the device property incorrect.

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


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

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "(null)"
Changing property value to 45.000000,136.000000,1234.00m@20210904T175300.1Z,WGS84 [(null)] FAILED!!!
PTP: Invalid Device Prop Value
craig@craig-desktop:~/Development/ricoh/usb/gps$ bash gps_test.sh 

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


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

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "(null)"
Changing property value to 45.000000,136.000000,+1234.00m@20210904T175300Z,WGS84 [(null)] FAILED!!!
PTP: Invalid Device Prop Value

Test Setup

  • Set GPS information with mobile app
  • use USB API to get GPS information from image and recheck format

Acquire GPS information using USB API after setting with WebAPI

$ ptpcam_mod --show-property=0xD801

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20140517T170429,WGS84"
craig@jetson:~/Documents/tools/power_on$ 

Test of setting 0xd801 with result from --show-property

$ ptpcam_mod --set-property=0xD801 --val="23.532000,23.532000+999.00m@20140517T170429,WGS84"

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20140517T170429,WGS84"
Changing property value to 23.532000,23.532000+999.00m@20140517T170429,WGS84 [(null)] FAILED!!!
PTP: Invalid Device Prop Value

test with no quotes

$ ptpcam_mod --set-property=0xD801 --val=23.532000,23.532000+999.00m@20140517T170429,WGS84

Camera: RICOH THETA Z1
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20140517T170429,WGS84"
Changing property value to 23.532000,23.532000+999.00m@20140517T170429,WGS84 [(null)] FAILED!!!

test with gphoto2

failed

The property 'PTP Property 0xd801' / 0xd801 was not set (0x201b: PTP Invalid Device Prop Format).

Test with SC2

SC2 with firmware 1.64

craig@jetson:~/Documents/tools/power_on$ ptpcam --info

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

set GPS value works with SC2

$ ptpcam_mod --set-property=0xD801 --val="23.532000,23.532000+999.00m@20140517T170429,WGS84"

Camera: RICOH THETA SC2
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20140517T170429.0-0700,WGS84"
Changing property value to 23.532000,23.532000+999.00m@20140517T170429,WGS84 [(null)] succeeded.
craig@jetson:~/Documents/tools/power_on$ 

SC2 result success with same string sent to Z1 and failed.

get GPS value works with SC2

$ ptpcam_mod --show-property=0xD801

Camera: RICOH THETA SC2
'UNKNOWN' is set to: "23.532000,23.532000+999.00m@20140517T170429.0-0700,WGS84"
craig@jetson:~/Documents/tools/power_on$ 

SC2 value was correctly saved using USB API


Test with V firmware 3.70.1

$ ptpcam_mod --info

THETA Device Info
==================
Model: RICOH THETA V
  manufacturer: Ricoh Company, Ltd.
  serial number: '00105377'
  device version: 3.70.1
  extension ID: 0x00000006
  image formats supported: 0x00000004
  extension version: 0x006e

set GPS info fails

$ ptpcam_mod --set-property=0xD801 --val="23.532000,23.532000+999.00m@20140517T170429,WGS84"

Camera: RICOH THETA V
'UNKNOWN' is set to: "(null)"
Changing property value to 23.532000,23.532000+999.00m@20140517T170429,WGS84 [(null)] FAILED!!!
PTP: Invalid Device Prop Value

conclusion

It looks like a potential bug in the V/Z1 USB API.

We will report to RICOH.