Xangle trigger scripts

 
A new "script" trigger mode was added in XangleCS starting with version 2024-01-25.
This mode lets you fine tune trigger scenarios for your cameras and gives you controls over camera settings, various presets (light, gpio, projector, display...) and some of the server settings (trigger mode, sound...).
notion image
Trigger scripts also include keyboard shortcuts to quickly switch between scripts (CRTL+SHIFT+[1 to 10]) .
Use cases for these scripts include the ability to change lighting during a long exposure shot or quickly switch between trigger mode and camera settings with a simple keyboard shortcut.

Creating and installing scripts

Scripts are .json files that are stored in the config\trigger-scripts  folder of the working directory of xangle (typically %userprofile%\xangleCS\).
 
notion image
You can either create a script directly from the app or copy (import) an existing json script to this folder. We strongly recommend using a text editor that supports JSON(visual studio code / notepad++...) to edit these files and enforce the syntax.
You can also use online editor such as https://jsoneditoronline.org/ or https://jsonformatter.org/json-editor
If you are using a web browser you might need to refresh the page (F5) after importing a new script. If you are running in the app, then it is advised to restart it.

Script syntax

The script is divided into several optional parts that govern different aspects of a shooting. Each part is a JSON subsection using the following syntax.

camera_preset

camera_preset refers to an existing camera preset created using the camera-preset page in the xangleCS app.
When a camera_preset is present in the script, that preset will be applied to all the camera groups upon selecting the script. It can be used to change the various settings of all your cameras (exposure, iso, image format…) before actually running the script.
Example:
"camera_preset": { "id": "r100-craw" },
Note that the id is case sensitive and must refer to an existing camera_preset

preset_sequence

preset_sequence is a JSON array that represents a sequence of presets you want to apply at a certain time. Each preset entry must have an “id” and can have an optional “delay” (in ms).
Example:
"preset_sequence" : [ { "id": "red lights", "delay": 0 }, { "id": "green lights", "delay": 2000 }, { "id": "flashing lights", "delay": 7000 } ],
In this example, we will use 3 lights presets. We start with red lights then switch to green after 2 seconds, and finish with a preset named “ flashing lights”  7 seconds after the script was initially started.
NB. Here again the id is case sensitive and it must refer to an existing preset.

camera_commands

camera_commands is the core section of a script. It will enable you to control the trigger logic, change the behavior of your cameras or the raspberry pis that host them. The available commands vary greatly depending on the type of cameras you are using, please contact our dev team if you require guidance.
Typical commands typically include “setSetting” that can also be used to emulate “half press”  and “full press” trigger commands (see example below).
Example:
"camera_commands": [ { "command": "disable_events", "value": true, "delay": 0 }, { "command": "setSetting", "setting": "eosremoterelease", "value": "Press Half", "use_projector": "0", "use_trigger_sequence": "1", "delay": 1000 }, { "command": "setSetting", "setting": "eosremoterelease", "value": "Press Full", "use_projector": "0", "use_trigger_sequence": "1", "delay": 1250 }, { "command": "setSetting", "setting": "eosremoterelease", "value": "Release Full", "use_projector": "0", "use_trigger_sequence": "1", "delay": 1450 }, { "command": "setSetting", "setting": "eosremoterelease", "value": "Release Half", "use_projector": "0", "use_trigger_sequence": "1", "delay": 1550 }, { "command": "get_picture_from_cam", "delay": 2000 } ],
In this example the script will run a typical trigger (without mirror lockup) by sending these commands in a sequence:
Press Half  -> “Press Full” -> Release Full -> Release Half.
The half press starts after 1 second and is followed by other commands with a 100 or 200 ms delay between each.
“Use_trigger_sequence” : “1” 
will add the individual extra delays you set for each camera, for example if you used a custom trigger sequence or interval shooting before running that script…
The first and last commands control the behavior of the raspberry pi. disable_events and get_picture_from_cam respectively pause and resume the event thread and improves the accuracy of the subsequent trigger commands.

server_commands

server_commands can be used to tweak  the behavior of xangleCS to some extent.
Only a few commands are available:
set_trigger_mode can be used to switch between all the trigger modes available in the control deck. Possible values are:
  • single
  • interval
  • custom
  • jaf
  • multiple
  • burst
  • bulb
  • [experimental] projector
  • [experimental] video
  • script
The trigger mode will return to script at the end of the script.
In addition to the mode, you can change some settings related to this mode, for example if you were to switch to burst, you might want to change the image limit or duration:
{ "command": "set_trigger_mode", "mode": "burst", "settings": { "burst": { "limit_duration": true, "duration": 1000, "limit_images": true, "max_image_count": 2, "timeout": 5000 } }, "delay": 0 }
In the example above, we switch the trigger mode to burst at script startup and specify a duration of 1 second with 2 images limit. Note that the trigger sequence must be set accordingly with a delay of 1 second between “full press” and “full release” .
play_metronome lets you control the xangle metronome in order to have an audio queue. That can be used for long trigger scripts scenarios (long exposure for instance).
Settings include delay and duration.
{ "command": "play_metronome", "duration_ms": 6400, "delay": 1250 },
play_sound will play one of the system sound at a given timing. Specific sound can be identified by their signal value which includes:
  • trigger_start
  • trigger_end
{ "command": "play_sound", "signal": "trigger_start", "delay":0 }, { "command": "play_sound", "signal": "trigger_end", "delay":3500 }
 

Shortcuts

The 10 first scripts available in the dropdown are accessible with a keyboard shortcut. Note that you need to have focus on the dashboard in order for these shortcuts to work.
These shortcuts are CRTL+SHIFT + digit (1 to 10)
The digit represent the order in the dropdown menu and is displayed as a prefix in the list:
notion image
In the example above
  • CRTL + SHIFT + 1 will load “burst 1s - 2x - L jpg”
  • CRTL + SHIFT + 2 will load “burst 10x-JPG-2s”
  • etc

Scripts examples

You will have to edit the camera_preset to match one of your preset