[Rtai] Small control system proyect.
Paolo Mantegazza
mantegazza at aero.polimi.it
Fri May 8 18:24:16 CEST 2009
Paolo Mantegazza wrote:
> Robert Perez wrote:
>> Apart from shm functions I believe that no more lib functions are
>> called (but perhaps I will need some later).
>>
>> If I understood well the docs of RTAI I must not call linux functions
>> from control programs to maintain real time.
>>
>>
>>
>> The idea I have is: master program set a flag in shm of control_prog1
>> to start an execution cycle and then master goes to sleep for 20ms.
>>
>> control_prog1 awakes, executes a cycle then awakes the master to tell
>> it that it has finished and then goes to sleep.
>>
>> Master awakes, takes out the permissor from control_prog1 and gives it
>> to control_prog2 and wakes up that process and then goes to sleep again.
>>
>> That is the main loop of the processes involved unles a control_prog
>> don't finish the cycle in 20ms, then the master awakes and send the
>> overruned
>> control_prog to sleep even if it didn't finish the cycle.
>>
>> When the turn comes again for that cprog the master wakes it up and
>> the cprog continues from the same place it was inside the cycle.
>>
>>
>>
>> I think that to wake up the master module I could use some semaphore
>> or futex (I'm reading docs on how to use them), but I don't
>>
>> know if I can from the master, wake another RT_TASK.
>>
>> I have seen that we could use names for RT processes and then access
>> them by name.
>>
>> Do you think this is a good way ?
>>
>
> All of what you want to do can be done in strict real timer under RTAI.
> I see some kind of sequential states driven execution. For it I'd use
> just intertask messages. Since the master wait for an answer from
> control progs the latter and the master could use rt_receive, the master
> does it with a timeout. When the ctask finishes it rt_send the master
> and rt_receive for the next cycle. An overrun condition can than be
> handled with RTAI real time signals or simply using rt_task_suspend. In
> the latter case when it is time to resume the overruner again the master
> uses rt_task_resume and goes to rt_receive with timout again, and so on
> and so on. Notice there is no need of shm and it can be done between
> processes and threads alike.
>
> Paolo.
>
BTW, I forgot to mention that all of what above can be done both locally
and remotely, UDP at the moment. Since I saw at your links that you are
talking about distributed controllers such a feature might turn out to
be quite useful. The same code can work in whatever way and needs just a
configuration launch scripts, while with shm you are bound to work locally.
Paolo
>>
>> Thanks in advance.
>>
>>
>>
>>
>>> Date: Fri, 8 May 2009 08:58:57 +0200
>>> From: mantegazza at aero.polimi.it
>>> To: robertperez67 at hotmail.com
>>> CC: rtai at rtai.org
>>> Subject: Re: [Rtai] Small control system proyect.
>>>
>>> Robert Perez wrote:
>>>> Hi all.
>>>>
>>>>
>>>>
>>>> I want to ask if it's possible to use linux + RTAI for the following
>>>> scenario:
>>>>
>>>>
>>>>
>>>> I want one (master) process to allow other (child) processes to run
>>>> in an ordered fashion (by writing an enable bit in shm)
>>>>
>>>> In addition this (master) process should be able to put a child
>>>> running process to sleep if a
>>>> certain condition is true and then awake the next one and so on.
>>>>
>>>>
>>>>
>>>> Of course all of these should be RT processes.
>>>>
>>>> This is for a hobby control system proyect I'm planning.
>>>>
>>>> Also the child processes should be able to talk through shm.
>>>>
>>>>
>>>>
>>>> I got it working part of it in linux but I will need real time to
>>>> make it a serious project.
>>>>
>>>> I am considering moving to RTAI but I want to know if its possible
>>>> before reading lots of documentation.
>>>>
>>>> BTW it is coded in C++ and I don't know if C++ is supported in RTAI.
>>>>
>>>>
>>> A few things you can see here:
>>> http://www.aero.polimi.it/mbdyn/mbdyn-rt/index.html, is in C++. It is
>>> just a matter of initializing and staticalize everything in advance
>>> or through a server process.
>>>
>>>> Could somebody please tell me what functions should I use, or an
>>>> idea on how to implement it ?
>>>>
>>> SHM a part what function calls do you use to have it work with Linux?
>>>
>>> Paolo
>>>
>>>>
>>>> Thank you all and keep the good work!.
>>>>
>>>>
>>>>
>>>> Robert Perez.
>>>>
>>>> PD: for those interested, the humble proyect is here
>>>> http://sourceforge.net/projects/freedcs/ and website
>>>> http://freedcs.sourceforge.net/
>>>>
>>>> _________________________________________________________________
>>>> ¡Invita a todos tus amigos de una sola vez! Pruébalo ahora
>>>> http://www.microsoft.com/latam/windows/windowslive/products/social-network-connector.aspx
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> _______________________________________________
>>>> Rtai mailing list
>>>> Rtai at rtai.org
>>>> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>>>
>>
>> _________________________________________________________________
>> ¡Invita a todos tus amigos de una sola vez! Pruébalo ahora
>> http://www.microsoft.com/latam/windows/windowslive/products/social-network-connector.aspx
>>
>
>
> _______________________________________________
> Rtai mailing list
> Rtai at rtai.org
> https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai
>
More information about the Rtai
mailing list