October 30, 2012

Connecting a USB camera to Speedgoat

Our aim is to use a high speed camera connected through CameraLink interface in the future. For the first attempts with video, we used a USB2.0 webcam.

Choosing the camera

We were looking for some friendly-priced camera with full resolution around 2Mpx at framerate 30 fps. Another criterion was the possibility to set the parameters of the camera (white balance, exposure time, etc.) manually.

When choosing the camera, we had to be aware that the manufacturers always present the highest resolution and highest framerate at once, but they often omit the fact that the highest resolution is not available at the highest framerate.

Finally, we have chosen Creative Live! Cam Socialize HD 1080. For a reasonable price (around 1300CZK), it offers capturing video sequences in full-HD resolution 1920x1080 at framerates up to 30 fps. The parameters of the camera can be set manually (through software). In addition, the camera has glass lens, which is another advantage compared to cheaper models that are often provided with plastic optics.

Experience with USB camera on Speedgoat

Speedgoat offers in fact a 'plug-and-play' use of the USB camera. You only need to know which blocks to put in the Simulink model and interconnect them correctly to start capturing the video.
  1. boot Speedgoat
  2. plug-in the USB camera
  3. connect to Speedgoat from the host PC using the xPC Explorer
  4. open your Simulink model and choose preferred camera configuration
  5. you can start the video capture by running the model
Be sure not to plug-in the camera until the target machine has booted. If the target machine detects a USB device connected when you turn it on, it tries to boot from it as if it was a USB stick.

We tried to transmit the video to the host PC over the Ethernet cable, but the transmission does not work very well. Even though the camera is capturing frames at 30 Hz, the resulting effective framerate on the host PC is around 3 Hz. The capture rate was checked by an xPC Target Scope connected to a single image pixel, through which we could observe the time intervals between changes of the pixel's intensity value. We did not find any error in our model nor any other working solution on the web. The problem might be that the communication between the target and host PC during the execution of the target application generates so heavy network traffic that the video frames which are transmitted via UDP get lost. A possible solution could be to build a standalone target application to eliminate the host-target communication during execution and only use the Ethernet for video transmission. However, one needs an xPC Target Embedded Option licence to build standalone target applications, so we could not verify this hypothesis.

October 24, 2012

Getting started with Speedgoat platform

We will be using Speedgoat Performance real-time target machine for our experiments. It is running under FreeDOS and is aimed to be used together with xPC Target package from Mathworks, which means that one creates a Simulink model, which is afterwards executed in external mode (i.e. it is compiled into an executable code and launched on the target machine). The target machine can either run in standalone mode, or be connected to a host PC during execution of the target application. We are using the second mode of operation, because one needs a licence for xPC Target Embedded Option to be able to deploy standalone applications.
The target machine is connected to the host PC via Ethernet cable (it can be connected to the LAN as well, but we are using a direct connection with dedicated Network Adapters).

Settings

The easiest way is to use the graphical interface of the xPC Explorer. To launch the explorer, type 'xpcexplr' in Matlab command line window. Through the xPC Explorer, you can connect/disconnect target machines, launch/stop target applications, monitor/trace/log signals from the target application when it is running etc. Various settings of the target machine including the target-host communication settings are available through graphical interface of xPC Explorer. To communicate successfully, you have to set the host and target IP addresses according to your real network configuration. (The default settings are 192.168.7.1 for target and 192.168.7.2 for host PC)
To make the settings persistent, save the settings in the xPC Explorer, insert a USB stick into the host PC (will connect e.g. as drive 'E:') and then type 'speedgoatmachineboot('E:')' in Matlab command line window. This will generate boot files on the USB stick. Then disconnect the USB stick from the host PC, plug it into the target machine and boot the target machine. It should load the new core including all your settings. Then you are asked to remove the USB stick and re-boot the target machine, this time already with the new settings.
The settings can be checked using a pre-implemented configuration test which is launched by command 'xpctest'.

Timeout during the initialization of the target application

With a more complex target application, it can happen that a timeout occurs during its initialization on the Target PC and the Target disconnects from the Host as a result. Even though it is possible to reconnect to the Target with initialized target application, it is annoying. Fortunately, it is quite easy to fix this issue by setting the communication timeout in the Model Configuration Parameters of the target model in Simulink (choose pane Code Generation > xPC Target options).
Setting the communication timeout to avoid problems during initialization of the target application

October 3, 2012

Aim and Motivation

The aim of this project is to test additional methods for measurement of position of objects (steel balls) on the surface of Magnetic Platform for Planar Manipulation, which is developed in research group AA4CC at Department of Control Engineering, FEE CTU in Prague.

Current method of measurement based on usage of resistive foil has a weak spot for more complex applications. It is not able to measure position of more than one object at once. It would be much more interesting to have the possibility to detect the position of multiple objects on the platform simultaneously, which would allow us to design feedback control of position of those objects.

For this purpose, we are going to test two alternatives. First, it will be combination of a camera and image processing, which is quite promising and second, it will be the capacitive foil.
In addition, the whole control software, which is currently run in Matlab Real-Time Workshop, will be moved to Speedgoat real-time target machine.
Magnetic Platform
Magnetic Platform, courtesy of AA4CC