Table Of Contents

Previous topic

Introduction

This Page

Build HOWTO

Mechanical

Aluminium channel struts and connectors (Bosch Mechanical Elements in the UK, available from Farnell or RS; 80/20 in the USA, McMaster-Carr) were used to build a box of dimensions 1m wide x 60 cm deep x 1.65 m tall, by cutting struts with a hacksaw and connecting struts together using small 90 degree elements. This box was placed with long axis upright on a lab bench, and the rear vertical struts clamped to the backboard of the bench. The treadmill is placed in the center of this box on the lab bench. A further strut was placed at the top of the box, running through the midline of the box, directly above the treadmill, extending out towards the front of the lab bench. Holes were drilled in through this strut, and two ball and socket joints (standard camera/photography ball and sockets: Jessops.co.uk) were bolted to this strut.

The two cameras were attached to these ball and socket joints, and aligned such that the treadmill was centred and aligned with the field of view in both cameras. Details of cameras and lenses are in the manuscript. The camera lenses were 130 cm above the surface of the treadmill belt.

Electrical

The Grasshopper camera was connected to the PCI FireWire card via a standard FireWire 800 cable. The camera link Gazelle camera was connected to the Matrox Solios Camera Link PCI card inside the high speed video computer with two camera link cables, in the Full/Maximum bandwidth configuration.

The Panlab Treadmill Control box was connected to the PC with a standard RS232 serial cable.

Both PCs were connected to the same ethernet switch, that in turn is connected to the university network and the internet. The computers need to be assigned IP addresses and be resolvable to each other. E.g., the command:

ping computer.fred.ac.uk

should work from either machine to the other and return short ping times (on the order of hundreds of microseconds, maximum), between them.

Software

The Python program tmilltracker.py handles the automated tracking and feedback control system. It relies on two further pieces of software: OpenCV to do much of the animal tracking and estimation, and libcamiface to do video grabbing.

The main steps of software installation are as follows:

  1. Install Ubuntu Linux. The most recent, Desktop version should work well.
  2. Install OpenCV with Python bindings.
  3. Install libcamiface, which will install pycamiface, Python bindings for acquistion.
  4. Download the tmilltracker source code directory.
  5. Run the tracker with python tmilltracker.py
  6. Use the menu system to explore and test the functionality.
  7. Pressing d brings up a live view for initial alignment of treadmill.
  8. Then pressing p grabs a static preview image, which should be followed by:
  1. Setting the ROI (o) and
  2. Calibrating the treadmill width (C), which is required to export data in physical units (e.g. meters, meters per second, etc.)

The class TmillSerialInterface abstracts the serial port protocol to provide speed setting commands:

The class TmillTracker.py handles the bulk of the feedback control system. It handles the state machine for the user interface, tracks the animal, and controls the treadmill.