Difference between revisions of "FPSControl"

From ElphelWiki
Jump to: navigation, search
(Created page with "= Controlling FPS = == Modes == The sensor has 2 operation modes: *Free Running *Triggered <br> == Free Running Mode == In this mode you can achieve higher frame rate...")
 
 
Line 18: Line 18:
 
=== Setup  ===
 
=== Setup  ===
  
There are 2 things that can prevent your custom FPS settings to work properly: <br>
+
There are 2 things that can prevent your custom FPS settings to work properly: <br>  
  
*Too high resolution<br>
+
*Too high resolution<br>  
 
*autoexposure is enabled and your camera environment is too dark<br>
 
*autoexposure is enabled and your camera environment is too dark<br>
  
==== Reduce Resolution<br> ====
+
==== Reduce Resolution ====
  
#Open up the Camera Control Interface (codename: camvc) <br>
+
#Open up the Camera Control Interface (codename: camvc) <br>  
#Click the "Camera" icon (first on the left)<br>
+
#Click the "Camera" icon (first on the left)<br>  
 
#Reduce the resolution (full frame will not give more than 10 fps in RGB mode) to 1280x720 for example by reducing the WOI (Windows of Interest). <br>
 
#Reduce the resolution (full frame will not give more than 10 fps in RGB mode) to 1280x720 for example by reducing the WOI (Windows of Interest). <br>
  
==== Disable Autoexposure<br> ====
+
==== Disable Autoexposure ====
  
#Also in the Camera Control Interface (codename: camvc) click the "Sun" icon (first slider under the WOI&nbsp;settings). You will notice that the slider will change from a triangle to a circle.<br>
+
#Also in the Camera Control Interface (codename: camvc) click the "Sun" icon (first slider under the WOI&nbsp;settings). You will notice that the slider will change from a triangle to a circle.<br>  
 
#Now you can move the slider. Set it to a value below 40 ms.<br>
 
#Now you can move the slider. Set it to a value below 40 ms.<br>
  
==== Settings FPS<br> ====
+
==== Settings FPS<br> ====
  
#Open up the Parameter Editor (codename: autocampars).<br>
+
#Open up the Parameter Editor (codename: autocampars).<br>  
#Check the "Streamer" Settings and click "View/Edit Current"<br>
+
#Check the "Streamer" Settings and click "View/Edit Current"<br>  
#Find the FP1000SLIM and FPSFLAGS parameters. Notice that if you hover over these parameters a tooltip will popup giving you an explanation of the particular parameter.<br>
+
#Find the FP1000SLIM and FPSFLAGS parameters. Notice that if you hover over these parameters a tooltip will popup giving you an explanation of the particular parameter.<br>  
#Set the desired FPS x 1000 in the dec (decimal) field of FP1000SLIM. Lets say you want 25 frames per second. Write "25000" in the dec field of FP1000SLIM.<br>
+
#Set the desired FPS x 1000 in the dec (decimal) field of FP1000SLIM. Lets say you want 25 frames per second. Write "25000" in the dec field of FP1000SLIM.<br>  
 
#Set the FPSFLAGS field to "1". This means "maintain fps (not lower than)". Don't forget to press the "Apply" button after changing the values in the fields.<br>  
 
#Set the FPSFLAGS field to "1". This means "maintain fps (not lower than)". Don't forget to press the "Apply" button after changing the values in the fields.<br>  
#Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change click the live image to the right of the settings. The Camera Control Interface has a time-out and stops to reload the live image if there is no activity in the interface. Clicking the live image will wake it up again.<br>
+
#Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change click the live image to the right of the settings. The Camera Control Interface has a time-out and stops to reload the live image if there is no activity in the interface. Clicking the live image will wake it up again.<br>  
 
#The fps indicator will show "24.989fps". To get higher FPS precision use the Triggered mode.
 
#The fps indicator will show "24.989fps". To get higher FPS precision use the Triggered mode.
  
Line 48: Line 48:
 
In triggered mode the minimal frame period is the frame readout time (same as the frame period in the free running mode) plus exposure time plus 8 extra lines (some sensor internal overhead). This can effectively reduces exposure time to less than 50% of 1/FPS.  
 
In triggered mode the minimal frame period is the frame readout time (same as the frame period in the free running mode) plus exposure time plus 8 extra lines (some sensor internal overhead). This can effectively reduces exposure time to less than 50% of 1/FPS.  
  
On the other hand it is much easier to set any required frame period in triggered mode than in free running - you can just specify the period in single pixel clock increments (as long as it is above the minimal for this image size and exposure, of course).  
+
On the other hand it is much more precise to set any required frame period in triggered mode than in free running - you can just specify the period in single pixel clock increments (as long as it is above the minimal for this image size and exposure, of course).
 +
 
 +
The camera supports both internal triggering (FPGA trigger generator) and external triggering (i.e. another camera). <br>
 +
 
 +
More details on the own [[Trigger]] page.  
  
 
=== Setup  ===
 
=== Setup  ===
  
In the camera you can set trigger to FPGA trigger generator (or you can trigger from the external source, i.e. another camera).  
+
#Open up the Parameter Editor (codename: autocampars).<br>
 +
#Check the "Camera trigger modes" Settings and click "View/Edit Current"<br>
 +
#Set TRIG_CONDITION = 0<br>
 +
#Set TRIG = 4 <br>
 +
#Set the TRIG_PERIOD according to your desired FPS (96.000,000 / FPS). For our example of 25 FPS that will be 96.000,000 / 25 = 3840000<br>
 +
#Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change drag the exposure time slider below 16. Now you should see an FPS of exactly 25.<br>
  
<br>  
+
===== Recovering from too long TRIG_PERIOD<br> =====
 +
 
 +
If you set TRIG_PERIOD to something too long, camera may wait and wait... Refreshing the page will not help, at some point all 3 currently specified instances of PHP will be occupied and you'll not be able to open any PHP-based pages (i.e. Parameter Editor) anymore. To recover from that condition (without power-cycling the camera) you may telnet to the camera and run killall -9 lighttpd # - that will kill web server and all PHP instances, then restart them all.
 +
 
 +
That PHP restart still will not "unfreeze" the camera from waiting for the trigger thought, the driver responsible for changing the run time parameters is driven by the sensor frame sync interrupts, you may check the status of the camera/sensor by refreshing the http://192.168.0.9:8081/pointers page - it will work even when the main web server and PHP are busy. If frame number is not changing - the sensor is not being triggered. In that case you can open external trigger control page, set TRIG=0 and before applying change the value in "Program ahead" column from 3 to 0 - in that case the driver will not wait the frame sync interrupts before applying the parameter(s).
  
 
= Summary  =
 
= Summary  =
  
{| border="1" class="wikitable"
+
{| cellpadding="5" border="1" class="wikitable"
 
|-
 
|-
 
| <br>
 
| <br>
| Free Running Mode  
+
| '''Free Running Mode'''
| Triggered Mode
+
| '''Triggered Mode'''
 
|-
 
|-
 
| max. FPS  
 
| max. FPS  
| higher
+
| higher  
 
| lower
 
| lower
 
|-
 
|-
 
| max. Exposure Time  
 
| max. Exposure Time  
| 1 / FPS
+
| 1 / FPS  
 
| less than 1 / FPS
 
| less than 1 / FPS
 
|-
 
|-
 
| FPS&nbsp;precision  
 
| FPS&nbsp;precision  
| low<br>
+
| low<br>  
 
| high
 
| high
 
|}
 
|}
  
<br>  
+
<br>
 
 
This is why when you do not need the highest fps it is usually more convenient to run sensor in triggered mode. It is not controlled by the camera GUI, but you can change it from the custom script or with parsedit.php. If you just open the http://192.168.0.9/parsedit.php page it will show you some sample links to control different parameters, just select the "External Trigger Controls". You may even reduce the number of parameters using the following link:
 
 
 
http://192.168.0.9/parsedit.php?embed=0.1&amp;title=External+trigger+controls&amp;TRIG&amp;TRIG_PERIOD
 
 
 
Each parameter has a short description that would appear as a tooltip when you put the mouse pointer over it.
 
 
 
The triggered mode is turned on by setting TRIG=4, free running mode TRIG=0.
 
 
 
TRIG_PERIOD - frame period in pixel clock periods, by default the clock is set to 96MHz.
 
 
 
If you set something too long, camera may wait and wait... Refreshing the page will not help, at some point all 3 currently specified instances of PHP will be used (something did not work with dynamically increasing number of instances) and you'll not be able to open any PHP-based pages (i.e. parsedit.php). To recover from that condition (without power-cycling the camera) you may telnet to the camera and run killall -9 lighttpd # - that will kill web server and all PHP instances, then restart them all.
 
 
 
That PHP restart still will not "unfreeze" the camera from waiting the trigger, the driver responsible for changing the run time parameters is driven by the sensor frame sync interrupts, you may check the status of the camera/sensor by refreshing the http://192.168.0.236:8081/pointers page - it will work even when the main web server and php are busy. If frame number is not changing - the sensor is not being triggered. In that case you can open external trigger control page, set TRIG=0 and before applying change the value in "Program ahead" column from 3 to 0 - in that case the driver will not wait the frame sync interrupts before applying the parameter(s).
 

Latest revision as of 02:35, 9 February 2011

Controlling FPS

Modes

The sensor has 2 operation modes:

  • Free Running
  • Triggered


Free Running Mode

In this mode you can achieve higher frame rate and exposures can overlap frames (while you are reading the current frame exposure of the next one already began). The maximum exposure this is basically 1/FPS.

In the free running mode the software can only adjust frame period by changing vertical and horizontal blanking. It is also possible to change the sensor clock frequency, but sensor "does not like" when the clock is adjusted while it is running and may hang.

Setup

There are 2 things that can prevent your custom FPS settings to work properly:

  • Too high resolution
  • autoexposure is enabled and your camera environment is too dark

Reduce Resolution

  1. Open up the Camera Control Interface (codename: camvc)
  2. Click the "Camera" icon (first on the left)
  3. Reduce the resolution (full frame will not give more than 10 fps in RGB mode) to 1280x720 for example by reducing the WOI (Windows of Interest).

Disable Autoexposure

  1. Also in the Camera Control Interface (codename: camvc) click the "Sun" icon (first slider under the WOI settings). You will notice that the slider will change from a triangle to a circle.
  2. Now you can move the slider. Set it to a value below 40 ms.

Settings FPS

  1. Open up the Parameter Editor (codename: autocampars).
  2. Check the "Streamer" Settings and click "View/Edit Current"
  3. Find the FP1000SLIM and FPSFLAGS parameters. Notice that if you hover over these parameters a tooltip will popup giving you an explanation of the particular parameter.
  4. Set the desired FPS x 1000 in the dec (decimal) field of FP1000SLIM. Lets say you want 25 frames per second. Write "25000" in the dec field of FP1000SLIM.
  5. Set the FPSFLAGS field to "1". This means "maintain fps (not lower than)". Don't forget to press the "Apply" button after changing the values in the fields.
  6. Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change click the live image to the right of the settings. The Camera Control Interface has a time-out and stops to reload the live image if there is no activity in the interface. Clicking the live image will wake it up again.
  7. The fps indicator will show "24.989fps". To get higher FPS precision use the Triggered mode.

Triggered Mode

In triggered mode the minimal frame period is the frame readout time (same as the frame period in the free running mode) plus exposure time plus 8 extra lines (some sensor internal overhead). This can effectively reduces exposure time to less than 50% of 1/FPS.

On the other hand it is much more precise to set any required frame period in triggered mode than in free running - you can just specify the period in single pixel clock increments (as long as it is above the minimal for this image size and exposure, of course).

The camera supports both internal triggering (FPGA trigger generator) and external triggering (i.e. another camera).

More details on the own Trigger page.

Setup

  1. Open up the Parameter Editor (codename: autocampars).
  2. Check the "Camera trigger modes" Settings and click "View/Edit Current"
  3. Set TRIG_CONDITION = 0
  4. Set TRIG = 4
  5. Set the TRIG_PERIOD according to your desired FPS (96.000,000 / FPS). For our example of 25 FPS that will be 96.000,000 / 25 = 3840000
  6. Go back to the Camera Control Interface (codename: camvc) and take a look at the fps indicator. If it did not change drag the exposure time slider below 16. Now you should see an FPS of exactly 25.
Recovering from too long TRIG_PERIOD

If you set TRIG_PERIOD to something too long, camera may wait and wait... Refreshing the page will not help, at some point all 3 currently specified instances of PHP will be occupied and you'll not be able to open any PHP-based pages (i.e. Parameter Editor) anymore. To recover from that condition (without power-cycling the camera) you may telnet to the camera and run killall -9 lighttpd # - that will kill web server and all PHP instances, then restart them all.

That PHP restart still will not "unfreeze" the camera from waiting for the trigger thought, the driver responsible for changing the run time parameters is driven by the sensor frame sync interrupts, you may check the status of the camera/sensor by refreshing the http://192.168.0.9:8081/pointers page - it will work even when the main web server and PHP are busy. If frame number is not changing - the sensor is not being triggered. In that case you can open external trigger control page, set TRIG=0 and before applying change the value in "Program ahead" column from 3 to 0 - in that case the driver will not wait the frame sync interrupts before applying the parameter(s).

Summary


Free Running Mode Triggered Mode
max. FPS higher lower
max. Exposure Time 1 / FPS less than 1 / FPS
FPS precision low
high