Tango on an embedded system

Hello,
I never used TANGO controls before and I have to develop an embedded application with a TCP/IP stack, which is fully compatible with TANGO.
The embedded system is based on LPC1768 from NXP and I use the C language. I am able to develop on it but I don’t know how the information must be exchanged.
I read some parts of the tango.pdf and the ppts available on this website. I understood TANGO is object oriented but I still don’t understand the link between tango and my system.

Someone can help me please? :slight_smile:

Thank you.

I will try to explain my vision of your problem:

You want to access data from your embedded system in order to show them in a Tango Control System.

So from the Tango point of view, your embedded system will just be another “Device” in the system, like a motor, thermocouple or anything else.

You have to use TCP/IP for communicating with yout system, and that’s not a problem at all. For Tango, it’s just a device.

What you need is writing a device server which communicates with your system and which has some commands and attributes. Example, if you want to monitor the temperatur of your system, you will have a Temperature attributes. If you want to do a reset, implement a reset command. Just use Pogo to define your interfaces, and fill the blank.

This guidelines can help you too :

http://www-controle.synchrotron-soleil.fr:8001/docs/TangoGuidelines/TangoDesignGuidelines-GB4-3.pdf

Thank you for the pdf it should be helpful.

For your example, how tango could know the temperature attributes is coming from my device server? is there an adresse?

Pogo is helpful too but it generate C++, Python or java code but in my case I work with C.

For accessing an attribute on the bus, you must know its address, which looks like tango/test/my_device_test/my_attribute.

When you have declared a device server and the associated devices, you have defined unique names, so normally, we know where we are reading the temperature.

On your second question, I think you want to directly have a Tango device server running on your board, but I’m not sure if your card is compatible. There have been some test with BeagleBone card, or libera.

The C binding is here http://www.tango-controls.org/downloads/bindings/ but lack some functions.

I haven’t used it so no advice on this part.

Maybe the simpliest way is to have a simple Socket Server on your card and an socket client as device server. You will just have to define the tokens for the communication.

For accessing the temperature attributes which software I should used? is it JIVE?

In my board, I can run a webserver but I don’t know if a Tango server is possible.

I’m reading the c_binding source code but I am not sure this is necessary.

Sorry about all my question, I need to understand.

In fact, when you use Jive and do right click on a device you can choose multiple options.
“Monitor device” and “Test Device” create generic Tango client.
With thess clients you can read/write your attribute and execute commands.

But you can also :

  • use the Tango client API in C++, Java or Python.
  • use QTango (C++), ATKWidgets (Java) or Taurus (Python) to create a simple GUI with the available widgets.
  • use one of the binding (Labview, matlab, igor Pro, panorama) to access your data.

For your board, if it has already a WebServer allowing you to read your data, maybe the solution is to communicate with this webserver inside your device server.

In my mind, reading the data from my webserver is a good idea.
But to be fully compatible with tango is it possible to read data from a webserver with tango tools?

With Tango, everything is possible :wink:

See the Tango API like a Layer, so you do your communictaion with your webserver, and then use this in your device server.

First, find a way to communicate with your webserver in the language you are familiar with (C++, python, java), you can design a class that is doing this purpose
Second, define your Tango interface with Pogo and fill the blank using the class you just created.

In my case, I don’t have to do the TANGO API but my embedded system has to be compatible with Tango.
But to be sure I would like to develop one and test it.

To resume :
I have an eval board (MCB1700) from keil. I used uvision 5 to develop on it in C.
This board is connected to my laptop with an ethernet link.
This board has an IP and I have a webpage in my screen.
So I can change/send a string with this webpage.
With our example we can assume that this string is the temperature.

Sorry, I still don’t understand what I am supposed to do with Tango at this step. :confused:

From my point of view you can have two approaches to have your board Tango compatible. I prefer to call it board to avoid confusion with Tango device:

  • Include Tango core in the image you will flash to the board. (In the esrf, Andy did something with Gumstix). Also the device server that controls whatever your board is doing shall be also included in the image.
  • Support in the board some [industrial] protocol (like scpi, modbus, among others).

Both options are not exclusive.

With the first the Tango device server can be launched inside the board (together with other tango services like the Starter, being one extra host in your tango system).

The second option will allow you to have a device server running in any another machine controlling it by the protocol you chose.

Perhaps the better (but the harder) is to do both then your device server can run in or out of your board.

hi sblanch,
What do you call “Tango core”?
I am trying to #include <c_tango.h> from c_binding in my project but I have some trouble. Like the need to include <tango.h>

I think Sergi call Tango Core for the Tango librairies compiled for your target.

Some reading about embedding Tango :

https://accelconf.web.cern.ch/accelconf/ica07/PAPERS/WPPA28.PDF

I understand absolutly nothing :.(

Is there any exemple in C which work?

Yes, by Tango core I mean the middleware of Tango, the libraries that provides the necessary services for the distributed system agents work together in the distributed (control) system. I think this is the c++ code in the tango-cs sourceforge repository.

I’ve never used the C binding and I cannot provide you with an example. Even that I imagine that, as a binding, it may needs the libraries of Tango below the C binding. But I’m not sure of that.

I’ve look back the board you mention and I’m wrong if I thing that its system image you build is not flashed and it’s stored in an sd card? If correct you may have enough space to not have hard restrictions on that.

I coded my webserver in flash.
My problem is not a problem of space.
My problems are :
I don’t know what tools I need to be fully compatible
If I need libraries, I don’t know how to compile them or just use them
I don’t know if I have to code some functions in target to be compatible

As I said before my target is programmed with C code so when I tried to add some header and sources files I have a lot of error due to the files dependencies.

You still have the two options I’ve mention before. I think the webserver is not providing a good interface for a Tango device server.

As an example, if you provide some socket interface with an scpi protocol or similar (like can be modbus over tcp), it can be developed (you or someone else) a device server (that runs in a different machine) who interfaces the functionalities given by your board to the Tango control system.

As an example with scpi, there is a device server called skippy (and I mention because I did it and I know it better), that can talk with oscilloscopes, function generators among other instruments, to provide functionalities from them to the control system. In this case, if you develop a listener of scpi and provide a command tree set, that device server can be extended to know your instrument in a Tango installation.

The second option, I understand it is harder. It means to include in your image the Tango libraries. To know how to compile and what to include to have it running, it may help the debian packaging. There are several packages involved (probably exclude the tango-db part) and if you are not familiar with the system, perhaps the best option is the first with a protocol we already support.

I am trying the second one but it’s very hard because of all file dependencies.

I don’t know if I already said but I am working on Windows 7 with uvison 5.

I’m still not sure to understand your first option may be because I don’t know ‘scpi’.

Hi,
May be I begin to understand.
So correct me if I’m wrong.

In my laptop I have to create a c++ class which can do the gateway between my board and tango.
This class can exchange with my board with TCP/IP connection.
But this class must be compatible with tango.
This class is used like a database and I can use/see it on Jive.

Is it true? or not?

That looks to be a third way, also valid but at least operating system dependant.

Providing you a library to install outside your board, lets call it a driver, then someone can develop a Tango device server who uses your API to connect to your board. With that, a new element comes to the scene and you should provide a library for all the systems that supports Tango (I think Gnu/Linux and Windows). Also a secondary issue is the languages your API can work. If you provide the API with a header file for C/C++, then you restrict the language to use in the Tango device server development or force this developer to add another layer with Cython, for example, or an equivalent for Java.

That’s why I see with better eyes that you support some of the standard (industrial) communication protocols. Like you have a webserver embedded in your board, add also a socket server that talks one of those protocols that are already supported and have Tango devices for it.

You’re right I didn’t think about the operating system.

In my case I’m working on windows but the client wants the system compatible with linux and windows.

So, may be my idea is not so good.

If I add a socket server where can I find “those protocols that are already supported and have Tango devices for it” ?