Thursday, August 23, 2012

Installing fview and Strokelitude from Scratch

Install Ubuntu

This step is not stictly necessary, but everything works in Lucid, so it may save time.

  • Download and install Ubuntu 10.04 (Lucid) from
  • Often the display will be improved by looking under System>Administration>Hardware Drivers for video card drivers.
  • Run the Update Manager (under System>Administration).

Install fview

Andrew Straw wrote fview, a general purpose video acquistion application. Strokelitude (also by Dr. Straw) is a plugin for fview.

  • Add the repositories, following the instructions at

    sudo add-apt-repository ppa:astraw/ppa
    sudo wget --output-document=/etc/apt/sources.list.d/astraw.list$(lsb_release -cs).list
    sudo apt-get update && sudo apt-get install astraw-keyring && sudo apt-get update
  • From synaptic (System>Administration>Synaptic Package Manager) install the following packages with all their dependencies:

    • camiface
    • python-motmot-fview
    • libhdf5-serial-1.8.4
    • hdf5-tools
    • python-tables
    • python-enthought-traits
    • python-enthought-traits-ui
    • python-chaco
    • python-pylibusb
    • pyro
    • python-motmot-fastimage
    • python-motmot-realtimeimageanalysis
    • python-motmot-fviewexttrig
    • git-core
  • Test fview by typing fview at a terminal (Applications>Accessories>Terminal) or going to Applications>Sound & Video>fview don't worry about error message:

    While attempting to open the plugin "fview_ext_trig",
    FView encountered an error. The error is:
    Cannot find device.
    (Perhaps run with environment
    variable REQUIRE_TRIGGER=0.)

    Initialize the camera by going to Camera>initialize camera...

  • Note: If you are using a firewire (1394) camera and you cannot initialize it, try running sudo fview instead. Also, run the following command in a terminal:

    sudo adduser $USER video
    sudo chown .video /dev/raw1394

    then log out and log back in.

Install strokelitude

Now we are ready to install the plugin, "strokelitude," that actually tracks the wing positions.

  • In a terminal, type:

    mkdir src
    cd src
    git clone git://
    cd remote_traits/
    sudo python install
    cd ..
    git clone git://
    cd strokelitude/
    sudo python install
  • Start fview, you should now see strokelitude as an option under Windows.

Install ROS (Electric)

The easiest way to save strokelitude data is to install ROS (Robot Operating System) and save the "topics" that strokelitude "publishes" in a .bag file. In order to do this, we install ROS, then start roscor before opening fview. We record using the rosbag record command.

  • Follow the instructions at . Briefly, you need to do the following. In a terminal, type:

    sudo sh -c 'echo "deb lucid main" > /etc/apt/sources.list.d/ros-latest.list'
    wget -O - | sudo apt-key add -
    sudo apt-get update
    sudo apt-get install ros-electric-desktop-full
    echo "source /opt/ros/electric/setup.bash" >> ~/.bashrc
    . ~/.bashrc

    The fourth line will take some time -- you are installing all of ROS.

  • Now we'll need to create a directory in which we can place ROS scripts (see ). In a terminal, type

    cd ~/src
    mkdir ros_workspace
    cd ros_workspace
  • We want to tell ROS that this directory will contain ROS scripts. Create a file named

    source /opt/ros/electric/setup.bash
    export ROS_ROOT=/opt/ros/electric/ros
    export PATH=$ROS_ROOT/bin:$PATH
    export PYTHONPATH=$ROS_ROOT/core/roslib/src:$PYTHONPATH
    export ROS_PACKAGE_PATH=~/src/ros_workspace:/opt/ros/electric/stacks:$ROS_PACKAGE_PATH

    then run the file using the command .

    To make this change permanent, assuming the file is in your home directory, add to the bottom of your .bashrc file:

    source  ~/src/ros_workspace/
  • Now we are ready to install the package that defines the message type strokelitude will publish in ROS. In a terminal type:

    git clone git://
    rospack profile
    rosmake strokelitude_ros
    rosdep install rxtools
    rosmake roscpp_tutorials rospy_tutorials rxtools

    then open fview by typing fview in a new terminal. Open the strokelitude window and click box next to 'Processing enabled'

  • In a new terminal type rxplot /strokelitude/left_wing_angle_radians /strokelitude/right_wing_angle_radians in order to view a realtime plot of the fview data

  • In new terminal, navigate to the directory where you want to record data, then type rosbag record -O data /strokelitude (this will save data in data.bag file)

  • To import your data into Python, do something like the following in a python script:

    import roslib
    roslib.load_manifest('rosbag') import rosbag
    bag = rosbag.Bag('data.bag')
    for topic, msg, t in bag.read_messages():

Install strokelitude-jfi-emulator

If you want to do closed-loop experiments using the Reiser panels, probably the simplest way is to use the mcc analog output board to output an analog voltage proportional to each wingstroke. In order to install this, follow these steps:

  • Using synaptic package manager, install libmcclibhid

  • Plug in the usb1208FS (this used to be called pmd1208FS and those work also) and test it by running the command sudo testusb1208FS in a terminal. Type 'b' to blink the LED.

  • Using synaptic, install python-wjul. This allows Python access to the usb1208FS.

  • install strokelitude-jfi-emulater by typing the following into a terminal:

    cd src
    git clone git://
    cd strokelitude-jfi-emulator
    sudo python install


Bojana Janković said...

Hello, Peter!

My name is Bojana, I am a Master student in Bjoern Brembs' lab in the University of Regensburg, Germany. We are currently setting up an experiment with drosophila in torque compensator, and we would like to use Strokelitude for getting the data. (the experiment is going to be set up like in this experiment ) We've installed the programme, got it running, but we've been encountering some problems. I tried googling and that is how I ran into your blog. So, I would like to ask you if you could help me a little with the programme.

The programme is crashing sometimes. We determined that it happens when the videos are taken at different fps, so I would like to know whether you had some similar experiences and how you solved them. And also what is the highest possible frame rate to provide clear and nice videos?

The second question is about how the programme itself works. When I open the strokelitude window, there are no buttons like run or start, which confuses me a little bit. The only thing that showed up to be acquiring something was the option start video recording in the camera options, so I was wondering is that the only way?

Also, what happens with that saved data? Can it be used afterwards in matlab or does it need some kind of conversion? Also, is it necessary to save all the videos and then do the analysis or there is a way of just getting the data without saving the videos?

I honestly hope I haven't asked too many stupid questions, but I've just started working on this today and I am completely unfamiliar with it, and my Professor also doesn't know much about it. So any kind of help would be more than useful.

Thank you in advance,
Bojana Jankovic

Andreas Grasskamp said...
This comment has been removed by the author.