Real Time looses when acquiring

Jordi Blanch Carles jordi_blanch at encopim.com
Tue Nov 27 17:36:34 CET 2007


    You were right, with an rtai_comedi module insmod now it seems that
we achieve the required performance, but we are getting some errors
creating the counter channel that was working properly before this last
change. We will try to solve them.

    Thank you very much for your help!

El dt 27 de 11 del 2007 a les 16:14 +0100, en/na Paolo Mantegazza va
escriure:

> Jordi Blanch Carles wrote:
> >     Yes, we have tried the latency test and the maximum latency we get 
> > is about 11us.
> > 
> 
> Even too nice a result, then you can run Comedi in hard real time.
> 
> >     We are trying to add rtai_comedi.h to our code, but we are having a 
> > lot of troubles because it complains when compiling about different 
> > decarations of comedi_open() methods. If we remove comedilib.h reference 
> > from our code, change all comedi_t pointers to void pointers, and erase 
> > all function calls to comedi_get_range(), it compiles but when running 
> > the code it fails openning the comedi device and Linux gives up 
> > responding giving a continuous NULL rt_fun_ext[9] error.
> > 
> 
> The making cries are likely due to your environment setup. The NULL 
> error might be simply because you did not insmoded the RTAI comedi module.
> 
> So it is possible your real time misses happens because you gave up 
> using rtai_comedi.h interface with the related module. In such a case 
> you were using Linux ioctl to get to comedi.
> 
> Paolo.
> 
> >     We don't know what is happening, so we'll continue searching...
> > 
> > El dt 27 de 11 del 2007 a les 13:17 +0100, en/na Paolo Mantegazza va 
> > escriure:
> > 
> >>Jordi Blanch Carles wrote:
> >>>     With "comedi_acquire()" I meant a method to acquire a single channel 
> >>> from a DAQ board. In order to translate the value from the DAQ to a 
> >>> physical magnitude we apply a 3 order regression to the value, and  we 
> >>> also apply an IIR filter to remove noise. All this is done in the 
> >>> mentioned "comedi_acquire()" method. At the end, this "comedi_acquire()" 
> >>> method uses the comedi_data_read() comedi command for every channel.
> >>> 
> >>
> >>Anothere point: have you verified if the machine you are using is OK for 
> >>real time, i.e. by running the standard RTAI latency test?
> >>
> >>Paolo.
> >>
> >>> 
> >>> 
> >>> El dt 27 de 11 del 2007 a les 11:47 +0100, en/na Paolo Mantegazza va 
> >>> escriure:
> >>> 
> >>>>Jordi Blanch Carles wrote:
> >>>>> 
> >>>>>   Hello everyone.
> >>>>> 
> >>>>>     We have developed an application that runs a 10KHz task in RTAI. In
> >>>>> this task we acquire the cpu time with rt_get_time_ns(), and after that
> >>>>> we acquire 2 analog inputs from a NI 6220 and one counter from a NI
> >>>>> 6201. Sometimes, during analog and counter acquisition the RTAI task
> >>>>> looses the real time and next cycle occurs 3 times later that it should
> >>>>> have happened, that is, if time difference between two samples should be
> >>>>> 0,1 ms, when rtai looses real time this difference is 0,3 ms. This leads
> >>>>> to erroneous calculus because we use the counter input with the time
> >>>>> acquisition to measure speed. Each time the task acquires the counter
> >>>>> value, the increments between two acquisitions is almost the same, but
> >>>>> sometimes this increment is three times the mean value, when this occurs
> >>>>> the next cycle runs three times later than it should have run, so there
> >>>>> has been a problem during acquisition at the last cycle, this
> >>>>> acquisition has made the system "freeze" during a long time.
> >>>>> 
> >>>>> Code:
> >>>>> rt_get_time_ns();
> >>>>> comedi_acquire(analog_1);
> >>>>> comedi_acquire(analog_1);
> >>>>> comedi_acquire(counter);  <--- Sometimes this value increment is three
> >>>>> times the last one, then at the next cycle, the difference between time
> >>>>> results also three times the last one.
> >>>>> 
> >>>>
> >>>>What is comedi_acquire? I do not see it within the list of those 
> >>>>supported in rtai_comedi.h.
> >>>>
> >>>>Paolo
> >>>>
> >>>>> Example:
> >>>>> Time (ms)    Counter
> >>>>> 0,0                0
> >>>>> 0,1                10
> >>>>> 0,2                20
> >>>>> 0,3                50  <---- Counter value has an increment three times
> >>>>> greater than the last one (but the speed of the object doesn't really
> >>>>> have this increment)
> >>>>> 0,6                60  <---- Time value has an increment three times
> >>>>> greater than the last one (the cycle period), there has been some
> >>>>> problem with real time.
> >>>>> 0,7                70
> >>>>> 
> >>>>>     We have created the real time task as a LXRT hard real time task in
> >>>>> one shot timer mode.
> >>>>> 
> >>>>>     So the question is, could comedi instructions make RTAI real time
> >>>>> tasks loose real time? How can we prevent this behaviour? Has anyone
> >>>>> seen something like this and has solved the problem?
> >>>>> 
> >>>>>     Thanks in advance.
> >>>>> 
> >>>>> -- 
> >>>>> Jordi Blanch Carles
> >>>>> Unidad de Ensayo y Control
> >>>>> 
> >>>>> ENCOPIM S.L.
> >>>>> C/. del Parc, 5 (nave 13)
> >>>>> P.I. Els Pinetons
> >>>>> E-08291 RIPOLLET (Barcelona)
> >>>>> Tel: (+34) 935 94 23 47
> >>>>> Fax: (+34) 935 94 64 15
> >>>>> 
> >>>>> ==========================================================
> >>>>> La información contenida en la presente transmisión es confidencial y su
> >>>>> uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
> >>>>> persona destinataria de la presente transmisión, rogamos nos lo
> >>>>> comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
> >>>>> cualquier copia de la misma (tanto digitales como en papel).
> >>>>> 
> >>>>> The information contained in this transmission is confidential and is
> >>>>> intended only for the use of the addressee(s). If you are not the
> >>>>> designated recipient of this transmission, please advise us immediately
> >>>>> by telephone (+34 935 942 347) and destroy any copies (digital and
> >>>>> paper).
> >>>>> ======================================================
> >>>>> 
> >>>>
> >>>>
> >>>>
> >>>>_______________________________________________
> >>>>RTAI mailing list
> >>>>RTAI at rtai.org <mailto:RTAI at rtai.org> <mailto:RTAI at rtai.org <mailto:RTAI at rtai.org>>
> >>>>https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
> >>>>
> >>> -- 
> >>> Jordi Blanch Carles
> >>> Unidad de Ensayo y Control
> >>> 
> >>> ENCOPIM S.L.
> >>> C/. del Parc, 5 (nave 13)
> >>> P.I. Els Pinetons
> >>> E-08291 RIPOLLET (Barcelona)
> >>> Tel: (+34) 935 94 23 47
> >>> Fax: (+34) 935 94 64 15
> >>> 
> >>> ==========================================================
> >>> La información contenida en la presente transmisión es confidencial y su
> >>> uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
> >>> persona destinataria de la presente transmisión, rogamos nos lo
> >>> comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
> >>> cualquier copia de la misma (tanto digitales como en papel).
> >>> 
> >>> The information contained in this transmission is confidential and is
> >>> intended only for the use of the addressee(s). If you are not the
> >>> designated recipient of this transmission, please advise us immediately
> >>> by telephone (+34 935 942 347) and destroy any copies (digital and
> >>> paper).
> >>> ======================================================
> >>> 
> >>
> >>
> >>
> >>_______________________________________________
> >>RTAI mailing list
> >>RTAI at rtai.org <mailto:RTAI at rtai.org>
> >>https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
> >>
> > -- 
> > Jordi Blanch Carles
> > Unidad de Ensayo y Control
> > 
> > ENCOPIM S.L.
> > C/. del Parc, 5 (nave 13)
> > P.I. Els Pinetons
> > E-08291 RIPOLLET (Barcelona)
> > Tel: (+34) 935 94 23 47
> > Fax: (+34) 935 94 64 15
> > 
> > ==========================================================
> > La información contenida en la presente transmisión es confidencial y su
> > uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
> > persona destinataria de la presente transmisión, rogamos nos lo
> > comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
> > cualquier copia de la misma (tanto digitales como en papel).
> > 
> > The information contained in this transmission is confidential and is
> > intended only for the use of the addressee(s). If you are not the
> > designated recipient of this transmission, please advise us immediately
> > by telephone (+34 935 942 347) and destroy any copies (digital and
> > paper).
> > ======================================================
> > 
> 
> 

-- 
Jordi Blanch Carles
Unidad de Ensayo y Control

ENCOPIM S.L.
C/. del Parc, 5 (nave 13)
P.I. Els Pinetons
E-08291 RIPOLLET (Barcelona)
Tel: (+34) 935 94 23 47
Fax: (+34) 935 94 64 15

==========================================================
La información contenida en la presente transmisión es confidencial y su
uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
persona destinataria de la presente transmisión, rogamos nos lo
comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
cualquier copia de la misma (tanto digitales como en papel).

The information contained in this transmission is confidential and is
intended only for the use of the addressee(s). If you are not the
designated recipient of this transmission, please advise us immediately
by telephone (+34 935 942 347) and destroy any copies (digital and
paper).
======================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.rtai.org/pipermail/rtai/attachments/20071127/af05f8bd/attachment.htm 


More information about the Rtai mailing list