A conceptual questions

Hi,

in my application I need to connect to a controller using rtnet. The main idea
is to have a asynchronous task that open a socket and listen. On the other
hand, another task that make the control in s synchrony way.

Thinking in the way that they communicate I have thought some ideas that I
would like to share to ear some opinion if I'm in a "correct" way or I'm
totally wrong. The ideas are:

- in the asynchronous task, with the socket, emit an event when the socket
receive a data with the data. This event is connected to the synchronous task
that make the control.

- in the asynchronous task, with the socket, emit an event when the socket
receive a data and put the data to a port. The port is connected to a
synchronous task that make the control.

- in the asynchronous task, with the socket, when the socket receive a data
with the data, put the data to a port, and this port is connected to the
synchronous task that make the control.

Any opinion? what is the best/more flexible way to do it in a <4ms loop?

Also, another question. I understand that one big difference between a method
and a command is that the method is executed directly and an command is
queued. It is correct?

Regards,

Leo

A conceptual questions

On Dec 3, 2007 4:41 PM, Leopold Palomo-Avellaneda <lepalom [..] ...> wrote:
> in my application I need to connect to a controller using rtnet. The main idea
> is to have a asynchronous task that open a socket and listen. On the other
> hand, another task that make the control in s synchrony way.
>
[...]
> - in the asynchronous task, with the socket, emit an event when the socket
> receive a data with the data. This event is connected to the synchronous task
> that make the control.

I guess you mean NonPeriodic and Periodic here instead of
a(synchronous)? If not, I think you should specify with what/who they
are (a)synchronous

> - in the asynchronous task, with the socket, emit an event when the socket
> receive a data and put the data to a port. The port is connected to a
> synchronous task that make the control.
>
> - in the asynchronous task, with the socket, when the socket receive a data
> with the data, put the data to a port, and this port is connected to the
> synchronous task that make the control.
>
> Any opinion? what is the best/more flexible way to do it in a <4ms loop?

What will you use the event for if the second task is Periodical? Or
do you want to use a synchronous event handler?

I think the best solution depends on your use case, i.e. the meaning
of the data that you read from the socket. (Do you need to buffer
them, for instance, or will it suffice to always take the most recent
one)

You might have a look at the OCL component for ethercat
(ocl/hardware/ethercat-demo) which also uses rtnet sockets.

> Also, another question. I understand that one big difference between a method
> and a command is that the method is executed directly and an command is
> queued. It is correct?

A method is executed in the Activity of the caller. A command is
executed in the Activity of the called one (This might (and will
mostly)be different threads).

Klaas

A conceptual questions

A Dilluns 03 Desembre 2007 17:24, Klaas Gadeyne va escriure:
> On Dec 3, 2007 4:41 PM, Leopold Palomo-Avellaneda <lepalom [..] ...> wrote:
> > in my application I need to connect to a controller using rtnet. The main
> > idea is to have a asynchronous task that open a socket and listen. On the
> > other hand, another task that make the control in s synchrony way.
>
> [...]
>
> > - in the asynchronous task, with the socket, emit an event when the
> > socket receive a data with the data. This event is connected to the
> > synchronous task that make the control.
>
> I guess you mean NonPeriodic and Periodic here instead of
> a(synchronous)? If not, I think you should specify with what/who they
> are (a)synchronous

yes .. :-( NonPeriodic and Periodic ..... tasks I'm sorry,

> > - in the asynchronous task, with the socket, emit an event when the
> > socket receive a data and put the data to a port. The port is connected
> > to a synchronous task that make the control.
> >
> > - in the asynchronous task, with the socket, when the socket receive a
> > data with the data, put the data to a port, and this port is connected to
> > the synchronous task that make the control.
> >
> > Any opinion? what is the best/more flexible way to do it in a <4ms loop?
>
> What will you use the event for if the second task is Periodical? Or
> do you want to use a synchronous event handler?

the nonperiodic task with the socket is capturing the messages that the
controller sends with the positions and more data of the robot. We have an
Stäubli controller using VxWorks and a LLI lib. With this lib, we have made a
program that every cycle of the robot controller send a message in the
network with the position of the encoders and the torques applied. The idea
is receive this, and put the values in the periodic task where the control
loop is done. The robot controller can listen by a socket commands of torque
to apply to the robot.

The idea is that the control loop is periodic, but I cannot ensure that the
data that fill the periodic task (the position of the encoders of the robot)
could be periodic, so it's nonperiodic. Then, how is the "best" way to
communicate both?

> I think the best solution depends on your use case, i.e. the meaning
> of the data that you read from the socket. (Do you need to buffer
> them, for instance, or will it suffice to always take the most recent
> one)

I don't think that I need to buffer it, with the most recent I think that it's
sufficient.

> You might have a look at the OCL component for ethercat
> (ocl/hardware/ethercat-demo) which also uses rtnet sockets.

Ok, I will look it.

> > Also, another question. I understand that one big difference between a
> > method and a command is that the method is executed directly and an
> > command is queued. It is correct?
>
> A method is executed in the Activity of the caller. A command is
> executed in the Activity of the called one (This might (and will
> mostly)be different threads).

but the queues?

Thank's,

Leo

A conceptual questions

On Dec 3, 2007 5:48 PM, Leopold Palomo-Avellaneda <lepalom [..] ...> wrote:
> A Dilluns 03 Desembre 2007 17:24, Klaas Gadeyne va escriure:
> > On Dec 3, 2007 4:41 PM, Leopold Palomo-Avellaneda <lepalom [..] ...> wrote:
[....]
> the nonperiodic task with the socket is capturing the messages that the
> controller sends with the positions and more data of the robot. We have an
> Stäubli controller using VxWorks and a LLI lib. With this lib, we have made a
> program that every cycle of the robot controller send a message in the
> network with the position of the encoders and the torques applied. The idea
> is receive this, and put the values in the periodic task where the control
> loop is done. The robot controller can listen by a socket commands of torque
> to apply to the robot.
>
> The idea is that the control loop is periodic, but I cannot ensure that the
> data that fill the periodic task (the position of the encoders of the robot)
> could be periodic, so it's nonperiodic. Then, how is the "best" way to
> communicate both?

The scenario you suggest using a non-periodic and a periodic task
seems a good solution for this scenario. However, I don't think you
need the event then (if as you state below, you only need the most
recent data).

> > I think the best solution depends on your use case, i.e. the meaning
> > of the data that you read from the socket. (Do you need to buffer
> > them, for instance, or will it suffice to always take the most recent
> > one)
>
> I don't think that I need to buffer it, with the most recent I think that it's
> sufficient.
>
[...]
> > > Also, another question. I understand that one big difference between a
> > > method and a command is that the method is executed directly and an
> > > command is queued. It is correct?
> >
> > A method is executed in the Activity of the caller. A command is
> > executed in the Activity of the called one (This might (and will
> > mostly)be different threads).
>
> but the queues?

Commands are also queued, indeed.

Klaas

A conceptual questions

A Dilluns 03 Desembre 2007, Klaas Gadeyne va escriure:
> On Dec 3, 2007 5:48 PM, Leopold Palomo-Avellaneda <lepalom [..] ...> wrote:
> > A Dilluns 03 Desembre 2007 17:24, Klaas Gadeyne va escriure:
> > > On Dec 3, 2007 4:41 PM, Leopold Palomo-Avellaneda <lepalom [..] ...>
> > > wrote:
>
> [....]
>
> > the nonperiodic task with the socket is capturing the messages that the
> > controller sends with the positions and more data of the robot. We have
> > an Stäubli controller using VxWorks and a LLI lib. With this lib, we have
> > made a program that every cycle of the robot controller send a message in
> > the network with the position of the encoders and the torques applied.
> > The idea is receive this, and put the values in the periodic task where
> > the control loop is done. The robot controller can listen by a socket
> > commands of torque to apply to the robot.
> >
> > The idea is that the control loop is periodic, but I cannot ensure that
> > the data that fill the periodic task (the position of the encoders of the
> > robot) could be periodic, so it's nonperiodic. Then, how is the "best"
> > way to communicate both?
>
> The scenario you suggest using a non-periodic and a periodic task
> seems a good solution for this scenario. However, I don't think you
> need the event then (if as you state below, you only need the most
> recent data).

I'm not sure, depend on if we want to integrate or not, or if we need some
previous "states" of the data to make the control. But, if I understand you
well, you propose that, creating a port where the nonperiodic task put the
values received and the periodictask reading from that, it's more or less
a "correct approach". Isn't it?

> > > I think the best solution depends on your use case, i.e. the meaning
> > > of the data that you read from the socket. (Do you need to buffer
> > > them, for instance, or will it suffice to always take the most recent
> > > one)
> >
> > I don't think that I need to buffer it, with the most recent I think that
> > it's sufficient.
>
I don't know ... (as I have said before) ...

>
> > > > Also, another question. I understand that one big difference between
> > > > a method and a command is that the method is executed directly and an
> > > > command is queued. It is correct?
> > >
> > > A method is executed in the Activity of the caller. A command is
> > > executed in the Activity of the called one (This might (and will
> > > mostly)be different threads).
> >
> > but the queues?
>
> Commands are also queued, indeed.

Methods no.

thanks

best regards,

Leo

A conceptual questions

On Mon, 3 Dec 2007, Leopold Palomo Avellaneda wrote:

[...]
> I'm not sure, depend on if we want to integrate or not, or if we need some
> previous "states" of the data to make the control. But, if I understand you
> well, you propose that, creating a port where the nonperiodic task put the
> values received and the periodictask reading from that, it's more or less
> a "correct approach". Isn't it?

This is indeed the 'software pattern' to synchronize the data exchange
between two asynchronously running activities: the nonperiodic task is the
one you use to wait for the results of the other, external activity (over
which you have no control), and to implement the data flow policy (= forget
all data except for the last one; FIFO buffering; circular buffering; ...)
to get the data into the periodic task in a deterministic way.

Herman

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm