Commit 2c1ed865 authored by Valentin Valls's avatar Valentin Valls
Browse files

Recipe to create a custom tango camera

parent 9a3aa018
......@@ -47,3 +47,107 @@ Status DevVoid DevString Return the device state as a string
getAttrStringValueList DevString: DevVarStringArray: Return the authorized string value list for
Attribute name String value list a given attribute name
======================= =============== ======================= ===========================================
Custom LimaCCDs camera simulator
A custom camera simulator can be created following this recipe.
- Create a custom tango camera simulator
- Create a dedicated LimaCCDs runner
- Set/update the tango database
Tango camera simulator
.. code-block:: python
# module
from Lima import Core
from Lima import Simulator
import as TangoSimuMod
class MyCamera(Simulator.Camera):
"""Derive the camera in order to custom the way to render the frame"""
def fillData(self, data):
# Increment the first pixel every frames
data.buffer[0, 0] = data.buffer[0, 0] + 1
class MySimulator(TangoSimuMod.Simulator):
"""Derive the tango device in order to handle extra attributes/properties/commands implementation"""
class MySimulatorClass(TangoSimuMod.SimulatorClass):
"""Derive the tango device class in order to describe extra attributes/properties/commands"""
# Plugin
def get_control(**kwargs):
return TangoSimuMod.get_control(
def get_tango_specific_class_n_device():
return MySimulatorClass, MySimulator
Tango LimaCCDs runner
This is needed if your camera module is not already part of the
`` package.
You need to use this module as a program entry point to have a custom `MyLimaCCDs`
.. code-block:: python
# module
def register_lima_camera(camera_module):
Register a python module as a Tango Lima camera.
The module have to expose a `get_tango_specific_class_n_device`
method returning the Tango device and deviceclass classes.
camera_module: A python module containing the Tango Lima device classes
_tangoclassclass, tangoclass = camera_module.get_tango_specific_class_n_device()
name = tangoclass.__name__
sys.modules[f"{name}"] = camera_module
from Lima.Server import camera
from myproject import MySimulator
from Lima.Server import LimaCCDs
return LimaCCDs.main()
Database description
This is a representation of the Tango database content.
.. code-block:: yaml
personal_name: my_simulator
server: LimaCCDs
- class: MySimulator
tango_name: id00/mysimulator/my_simulator
nb_prefetched_frames: 1 # Alloc a single frame in memory
fill_type: EMPTY # let python filling the full frame
- class: LimaCCDs
LimaCameraType: MySimulator # ask to use your custom camera
Start the tango device
.. code-block:: sh
MyLimaCCDs my_simulator
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment