While the Timelapse Engine provides all the functionality needed to perform the motion control for your time-lapse video, you'll still need a way to interface with the engine. The engine can communicate with any computer that has a USB port, so we'll just need some software to tell it what to do. OpenMoco Slim is the first, and most basic interface to the time-lapse engine. It's a simple application that provides a low-profile way to interact with the engine and script complex sequences of motion in Windows, Linux, and OSX.
We'll cover how to get Slim up and running, and walk through the basics of using it.
OpenMoco Slim
Slim is a simple, script-oriented interface to the engine. Written in perl, it's natively cross-platform and easy to modify. It is designed to provide a no-frills, simple interface for controlling the engine and scripting time-lapse sequences. You can use it to issue one command at a time, or script out sequences and settings to quickly re-play a desired sequence automatically.
This article assumes that you've already successfully installed, compiled, and uploaded the Timelapse Engine to your Arduino.
Install
You'll need the following to install Slim and get it running:
- Perl 5.8
- The OpenMoco Timelapse Perl API
Linux
Installing on Ubuntu, Debian and similar distributions that use the apt package manager is a breeze.
To follow these instructions, you'll also need the wget package, if you don't have it installed, do an `apt-get install wget` before beginning.
In a terminal window, type the following commands to install the SerialPort module, and all of the necessary packages
Installing Device::SerialPort
If you don't already have the Device::SerialPort perl module installed, you'll need to install it before installing the TimeLapse engine API:
sudo apt-get install libdevice-serialport-perl
Now, we'll install the TimeLapse perl API and the Slim interface.
cd ~/openmoco
wget 'http://www.openmoco.org/downloads/Perl-OpenMoco-Interface-TimeLapse-0.02.zip'
unzip Perl-OpenMoco-Interface-TimeLapse-0.02.zip
cd 0.02
perl Makefile.PL
sudo make install
cd ..
wget 'http://www.openmoco.org/downloads/openmoco-slim-0.11.zip'
unzip openmoco-slim-0.11.zip
cd openmoco-slim
perl openmoco-slim.pl
That's it - you should now be at the Slim prompt.
Apple OSX
Installation on OSX is quite easy as well, OSX ships with perl installed by default. The instructions below assume that you're using the `fink' package manager, but if you're using `ports', just replace `fink' with `ports'.
Use the following commands in a terminal.
Installing Device::SerialPort
If you don't already have Device::SerialPort installed, you can install it easily by typing the following commands:
Now we'll install the TimeLapse perl API and Slim.
cd ~/openmoco
wget 'http://www.openmoco.org/downloads/Perl-OpenMoco-Interface-TimeLapse-0.02.zip'
unzip Perl-OpenMoco-Interface-TimeLapse-0.02.zip
cd 0.02
perl Makefile.PL
sudo make install
cd ..
wget 'http://www.openmoco.org/downloads/openmoco-slim-0.11.zip'
unzip openmoco-slim-0.11.zip
cd openmoco-slim
perl openmoco-slim.pl
Windows
For Windows, the installation is a little more complex, as you'll have to first install perl. There are several ways to do so, but this one will assume you're going to use ActivePerl and install it before you begin.
You will also need to download and install nmake from Microsoft. (Hint: download the linked file, and then run it to install nmake.)
Installing Win32::SerialPort for Activeperl
The first thing that you'll need to do is open up the perl package manager included with Activeperl. The Win32::SerialPort module does not come with the standard installation, and doesn't come from Activestate, so we'll need to add a new repository to get the package.
Go to Edit->Preferences, and then choose the 'Repositories' tab. Add the location "http://www.bribes.org/perl/ppm/" (without quotes) as a repository.
After PPM updates the database, scroll down to Win32-SerialPort, right click and then select 'install...' Now, press the green arrow at the top right of the screen to download and install the package.
Now we're ready to install the TimeLapse perl API and slim.
To install the TimeLapse API, first download OpenMoco-Interface-TimeLapse-0.02.zip
Save the file, and un-zip it.
Open up a command prompt (Start->run->cmd.exe), and change directories to where you unzipped the TimeLapse API package.
Type the following commands:
nmake install
You now have the perl API installed, and we can install Slim. First, download Slim, save the file and un-zip it.
You can then either run `perl openmoco-slim.pl' from the command line (from within the Slim directory) or double-click on the icon using windows file explorer.
Slim Workflow
While Slim doesn't provide much in the way of a user interface, it does expose every API command available, and lets you script your activities.
There are two ways to use Slim: in interactive mode and in script mode. To run Slim interactively, just run the script and you'll be presented with a prompt. At the prompt you can enter any command you like, or load a script from disk. In scripting mode, openmoco-slim is given a single argument that is the name of the script you want to run. Slim will exit after executing the script completely. There are several example scripts provided in the example directory.
Scripting allows you to set up commands in advance and run them repeatably whenever you like. Nearly any command can be run from a script, and certain commands like sleep and echo are provided to make scripting more useful.
Whether you're running a script or entering commands manually, the workflow is unchanged:
- Enter your Serial Port
- Connect to the engine
- Set parameters
- Start program or issue commands
The following commands illustrate this workflow:
[2] > connect
[3] > set_camera exposure 500
[4] > set_camera cycle 10
[5] > set_camera on
[6] > start
At any time, you can type `help' to get a list of commands, and `help ' for help with a particular command.
Interacting With the Engine
It's important to understand that the interaction between you and the engine is live. It is either running (start), paused (pause), or stopped (stop). While the engine is running, it constantly checks to see if it should be doing anything. When some actions occur, they trigger other actions.
Exposing the camera causes motors to move.
After a camera shot has fired, and any required delays (such as camera post delay) have passed, each motor axis that is currently enabled moves a defined distance. The motors will not move unless they are enabled, and the camera is enabled and taking shots. You can, however, move the motors manually using the `move' command.
You can change any parameter at any time while the program is running, and it will take effect at the next available opportunity. For example, if you change the exposure length while the camera is currently exposing, the next exposure will be the length you specify. This allows you to make adjustments to your video while the engine is running and without having to stop the program or lose any settings.
Keyframes allow you take actions when a condition is met.
After the camera fires, any camera keyframes are also checked. This is also true for after motors move (motor keyframes), and as time elapses (time keyframes). As these events occur, all keyframe values are checked - so you can set keyframes on things like 100 shots having been taken, 3,000 steps taken by a given motor, or 20 seconds having passed. If any keyframe value is matched, the action indicated by that keyframe is executed.
While you only have eight keyframes of each type (camera, motor, and time) available, they are removed as they are matched. After executing the action associated with a keyframe, the keyframe is removed. They are removed for two reasons - one is to free the slot up for another keyframe, and the second is to allow us to execute keyframes if they are matched or exceeded. This allows us to set keyframes in the past and have them execute at the next available opportunity.
You can set as many keyframes for the same point as you have slots available. That means you can have up to eight different actions triggered at the same point in time, or same camera shot, or same distance for a motor.
An example of creating a keyframe:
Or, create a keyframe at position 5 for the camera, activated at 500 shots, executing action 1.
Actions let you change settings and trigger events
You can store up to eight actions, and each action can be called from any keyframe (you can assign it to multiple keyframes if you like.). An action can change parameters for a motor, start a downward linear ramp in speed, alter the camera settings, or stop the program. They let you synchronize changes in the output video between different elements, or program complex moves.
An example of creating an action:
Or, set action 1 to `enable motor #0 going in a positive direction'.
Use `help' to see what other commands are available.
Windows Com Ports Greater than 9
For windows users, if the COM port used by your arduino is listed at a number higher than 9 (COM9), you'll get an error from Slim if you try to enter it in the normal way. To make it work, use the following notation:
Note: that's backslash-backslash-dot-backslash-comport
!c