User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

plugins:gopro_controller

This is an old revision of the document!


GoProController

:!:
(You have to install the plugin over the plugin section within DroidScript)

Taken from the official DroidScript documentation

The GoProController plugin enables remote control of GoPro cameras from DroidScript apps. With this plugin, you can control the camera shutter and change the cameras options.

GoProController currently supports the GoPro HERO3 range of cameras and HERO2 cameras with the Wifi BacPac.

NOTE: GoProController uses an unofficial GoPro API which, although unlikely, may be changed in future firmware updates, which in turn could affect the functionality of this plugin.

Getting Started

Before using GoProController, please ensure you have the latest firmware installed on your GoPro camera (see gopro.com/update).

To control the GoPro remotely, you must connect your Android device to the GoPro's Wifi hotspot. If you have used the official GoPro Android app, you will be familiar with this already. Follow these steps to get connected:

  1. Power on your camera.
  2. Press the Wifi button on the side of the camera or Wifi BacPac to turn on the camera's Wifi hotspot.
  3. In your Android device's Wifi Network settings, connect to the camera's Wifi network.

For connection troubleshooting, see gopro.com/support

Using the GoProController Plugin

In order to use GoProController, you must first load the plugin at the top of your script using the LoadPlugin method like this:

app.LoadPlugin( "GoProController" );

Then you can create an instance of the plugin object when you need it like this:

gopro = app.CreateObject( "GoProController" );

To establish a connection to the GoPro, call the Connect method passing in the IP address of the GoPro, which by default is 10.5.5.9:

gopro.Connect( "10.5.5.9" );

If successful, the OnConnect callback will be called. If the GoPro could not be found the OnError callback will be called with “NotFound” as the error. These callbacks can be set using the SetOnConnect and SetOnError methods.

Example - Connect To GoPro

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  btn = app.CreateButton( "Connect" );
  btn.SetOnTouch( Connect );
  lay.AddChild( btn );
 
  app.AddLayout( lay );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.SetOnConnect(gopro_OnConnect);
  gopro.SetOnError(gopro_OnError);
}
 
function Connect()
{
  app.ShowProgress("Connecting...");
  gopro.Connect( "10.5.5.9" );
}
 
function gopro_OnConnect()
{
  app.HideProgress();
  app.ShowPopup( "Connected!" );
}
 
function gopro_OnError( error )
{
  app.HideProgress();
  app.ShowPopup( "GoPro not found. Make sure you connect to the GoPro Wifi hotspot." );
}

When you are finished with the GoPro, call the Disconnect method to close the connection with the GoPro:

gopro.Disconnect();

Recording Video and Taking Photos

Depending on which mode the camera is in, the following methods will start/stop recording video, take a photo or photo burst, or start/stop timelapse recording:

 gopro.StartShutter();
 gopro.StopShutter();

Note that if the camera is in Photo or Burst mode, StopShutter has no effect.

Example - Start/Stop Shutter

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  btnStart = app.CreateButton( "Start Shutter" );
  btnStart.SetOnTouch( Start );
  lay.AddChild( btnStart );
 
  btnStop = app.CreateButton( "Stop Shutter" );
  btnStop.SetOnTouch( Stop );
  lay.AddChild( btnStop );
 
  app.AddLayout( lay );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.Connect( "10.5.5.9" );
}
 
function Start()
{
  gopro.StartShutter();
}
 
function Stop()
{
  gopro.StopShutter();
}

Camera Status

The current status of the camera can be requested using LoadStatus. The camera status will be returned as a JSON object via a callback passed to LoadStatus, and includes information about the camera, including the current mode, battery level, video mode, photo mode, etc.

Example - Load Camera Status

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  btn = app.CreateButton( "Load Camera Status" );
  btn.SetOnTouch( LoadStatus );
  lay.AddChild( btn );
 
  app.AddLayout( lay );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.Connect( "10.5.5.9" );
}
 
function LoadStatus()
{
  gopro.LoadStatus( gopro_OnStatusLoaded );
}
 
function gopro_OnStatusLoaded( status )
{
  statusMsg = "";
  for( var item in status )
  {
   statusMsg = statusMsg + item + ":" + status[item] + ",\n";
  }
  app.ShowPopup( statusMsg );
}

The following table shows the complete list properties available in the status JSON object:

Camera Status Property List

AutoPowerOff Auto power off duration in seconds
BatteryLevel Battery level, 0 - 100
BeepVolume Camera beep volume
BurstRate Photo burst rate
BurstRecording Indicates if the camera is currently taking a photo burst
CameraMode Current camera mode
DefaultCameraMode Startup camera mode
LEDs Indicates how many of the status indicator lights are active
Locate Indicates if the camera is currently Locating (See the Locate Mode section)
Orientation Camera orientation
OSD Indicates if the On Screen Display is on
PhotoCount Number of photos taken
PhotoMode Photo mode, includes the resolution and field of view, e.g. 5mpWide
PhotosAvailable Number of photos available to take
Protune Indicates if Protune mode on
SDCard Indicates if there is currently an SD card in the camera
SpotMeter Indicates if the spot meter is on
TimelapseInterval Timelapse interval in seconds
VideoAvailableTime Time in seconds remaining for video
VideoCount Number of videos recorded
VideoFOV Video field of view
VideoFPS Video framerate
VideoMode Video mode, e.g. 720, 1080, etc
VideoStandard PAL or NTSC
VideoRecording Indicates if video is currently recording
VideoRecordingTime Duration in seconds of the currently recording video

The camera mode, for example, can be accessed from the status JSON object as follows:

cameraMode = statusJSON.CameraMode;

Changing Camera Options

A subset of the camera properties described above are settable using SetOptions. SetOptions takes a JSON object containing one or more properties to be set.

Example - Set Camera Mode

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  modeSpin = app.CreateSpinner( "Video,Photo,Burst,Timelapse", 0.5 );
  modeSpin.SetOnTouch( modeSpin_OnChange );
  lay.AddChild( modeSpin );
 
  app.AddLayout( lay );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.Connect( "10.5.5.9" );
}
 
function modeSpin_OnChange( mode )
{
  var options = {
    CameraMode: mode
  };
 
  gopro.SetOptions(options);
}

Example - Turn Protune On/Off

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  btnProtuneOn = app.CreateButton( "Protune On" );
  btnProtuneOn.SetOnTouch( ProtuneOn );
  lay.AddChild( btnProtuneOn );
 
  btnProtuneOff = app.CreateButton( "Protune Off" );
  btnProtuneOff.SetOnTouch( ProtuneOff );
  lay.AddChild( btnProtuneOff );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.Connect( "10.5.5.9" );
 
  app.AddLayout( lay );
}
 
function ProtuneOn()
{
  var options = {
    Protune: "On"
  };
 
  gopro.SetOptions(options);
}
 
function ProtuneOff()
{
  var options = {
    Protune: "Off"
  };
 
  gopro.SetOptions(options);
}

The following table shows the complete list of settable camera options and their possible values:

Camera Options List

AutoPowerOff Never, 60, 120, 300 (seconds)
BeepVolume 0, 70, 100
BurstRate 3/1s, 5/1s, 10/1s, 10/2s, 30/1s, 30/2s, 30/3s
CameraMode Video, Photo, Burst, Timelapse
DefaultCameraMode Video, Photo, Burst, Timelapse
LEDs Off, 2, 4
Orientation Up, Down
OSD On, Off
PhotoMode 5mpWide, 5mpMedium, 7mpWide, 7mpMedium, 8mpMedium, 11mpWide, 12mpWide
Protune On, Off
SpotMeter On, Off
TimelapseInterval 0.5, 1, 2, 5, 10, 20, 60 (seconds)
VideoFOV Wide, Medium, Narrow
VideoFPS 12, 15, 12.5, 24, 25, 30, 48, 50, 60, 100, 120, 240
VideoMode WVGA, 720, 960, 1080, 1440, 2.7k, 4K, 2.7KCinema, 4KCinema, 720SuperView, 1080SuperView
VideoStandard PAL, NTSC

It is important to note that the above table shows an exhaustive list of values for each option. Not all GoPro models support all of these values, and the availability of certain values are dependent on the values of other options. For example, the VideoStandard option (PAL or NTSC) determines which VideoFPS values are available, and the available VideoModes are dependent on whether Protune is On or Off. See the GoPro user manuals for more details.

The GoPro model can be queried using GetModel which returns the model name in the form “HERO3 Silver Edition”:

app.ShowPopup(gopro.GetModel());

Turning the Camera On and Off

The GoPro camera can be turned on and off independently of the GoPro's Wifi hotspot. When the camera is turned off, the camera methods, such as StartShutter, StopShutter, LoadStatus, SetOptions, are unavailable. Use the IsPowerOn method to determine if the camera is currently turned on or off. The camera can be turned on remotely using the PowerOn method like this:

 if( !gopro.IsPowerOn() )
 gopro.PowerOn();

When the camera is fully powered on and ready to receive commands, the OnReady callback will be called. The OnReady callback can be set using the SetOnReady method. If the camera is turned on when Connect is called, the OnReady callback will be called after the OnConnect callback.

Example - Turn Camera On/Off

app.LoadPlugin( "GoProController" );
 
function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
  btnPowerOn = app.CreateButton( "Power On" );
  btnPowerOn.SetOnTouch( PowerOn );
  lay.AddChild( btnPowerOn );
 
  btnPowerOff = app.CreateButton( "Power Off" );
  btnPowerOff.SetOnTouch( PowerOff );
  lay.AddChild( btnPowerOff );
 
  app.AddLayout( lay );
 
  gopro = app.CreateObject( "GoProController" );
  gopro.SetOnConnect( OnConnect );
  gopro.SetOnReady( OnReady );
  gopro.Connect( "10.5.5.9" );
}
 
function OnConnect()
{
  app.ShowPopup("Connected!");
}
 
function OnReady()
{
  app.ShowPopup("Ready!");
}
 
function PowerOn()
{
  gopro.PowerOn();
}
 
function PowerOff()
{
  gopro.PowerOff();
}

Locate Mode

When the GoPro is in Locate Mode, it's LEDs flash and it beeps. To put the GoPro in Locate Mode, call the StartLocate method, and to turn it off, call the StopLocate method.

plugins/gopro_controller.1427366993.txt.gz · Last modified: 2015/03/26 18:49 (external edit)