Ports and Tasks Communications

Hello everyone.

I created a few Orocos components to control my parallel robot, and I have some doubts about the connection ports.

I have 3 components (reading position, reading of strength and control system).

The aim is that the control component executes "UpdateHook" when received the reaches of position and strength, every 10 ms.

Now I'm doing the test just by reading only the position, and this fix with "EvenPort" in the control component, so that in the "UpdateHook", I enter the next line.

  updateHook void () {
        if (vectorPosition.read (val) == RTT:: NewData)
        {//Control ALgorythm... }
}

It works OK.

And now I don't know how the control component runs ONLY when the two data arrives by each of the ports. One solution that occurs to me, but I think it isn't work :

  updateHook void () {
        if (vectorPosition.read (val) == RTT: vectorForce.read NewData & & (val) == RTT:: NewData)
        {... }
}

Do you understand me? (sorry for my English)

What is the right way? What components would specify the period of 10ms? What ports would be "EvenPorts" or "Port"?

Thank you very much, and congratulations on version 2.5.0!

Ports and Tasks Communications

2011/10/10 jocamo5 [..] ... <jocamo5 [..] ...>:
> Hello everyone.
>
> I created a few  Orocos components to control my parallel robot, and I have some doubts about the connection ports.
>
> I have 3 components (reading position, reading of strength and control system).
>
> The aim is that the control component executes "UpdateHook" when received the reaches of position and strength, every 10 ms.
>
> Now I'm doing the test just by reading only the position, and this fix with "EvenPort" in the control component, so that in the "UpdateHook", I enter the next line.
>
>  updateHook void () {
>        if (vectorPosition.read (val) == RTT:: NewData)
>        {//Control ALgorythm... }
> }
> It works OK.

If you're using the EventPort, you're updateHook gets executed each
time new data arrives on the port. So in that case, you don't even
need the if condition.

>
> And now I don't know how the control component runs ONLY when the two data arrives by each of the ports. One solution that occurs to me, but I think it isn't work :
>
>  updateHook void () {
>        if (vectorPosition.read (val) == RTT: vectorForce.read NewData & & (val) == RTT:: NewData)
>        {... }
> }

You're data on both ports will never arrive simultaneously, and there
is no default way to have one trigger from those two ports. You'll
first have to decide on which activity to connect to your Controller
component. When do you want it to wake up? Every time one of both
ports has new Data? Or do you want one of both components to act as
the master? In both cases you can check for NewData on the other port
by putting all updateHook code inside an

&#10;if(vectorPosition.read() == RTT::NewData &amp;&amp; vectorForce.read() == RTT::NewData){&#10;&#10;}&#10;

>
> Do you understand me? (sorry for my English)
>
>
>
> What is the right way?
> What components would specify the period of 10ms?
> What ports would be "EvenPorts" or "Port"?

I think your measuring component should 'drive' the system, preferably
sending updates everytime a new measurement is taken.

Regards,

Steven

>
> Thank you very much, and congratulations on version 2.5.0!
> --
> Orocos-Users mailing list
> Orocos-Users [..] ...
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-users
>

Ports and Tasks Communications

> If you're using the EventPort, you're updateHook gets executed each > time new data arrives on the port. So in that case, you don't even > need the if condition.

Perfect.

> You're data on both ports will never arrive simultaneously, and there > is no default way to have one trigger from those two ports. You'll > first have to decide on which activity to connect to your Controller > component. When do you want it to wake up? Every time one of both > ports has new Data? Or do you want one of both components to act as > the master? In both cases you can check for NewData on the other port > by putting all updateHook code inside an > > if(vectorPosition.read() == RTT::NewData && vectorForce.read() == RTT::NewData){ > > }

Then, if the Position and Force component have a period of 10 ms, and the Control component has an even port, when data position and data force arrive (both NewData), the condition: if(vectorPosition.read() == RTT::NewData && vectorForce.read() == RTT::NewData) will be True, and the code inside will be executed. Right?

Thanks,

Jose