How to inherit from generalTask to implement myTask1, myTask2..?

Hi all,

I have to write few different tasks that have a lot of common operations
between them.
I would like to describe these common operations and properties in a
generalTask
and then inherit from it to implement myTask1, myTask2,.. just adding
others
operations and properties different for each different task.
So I will never load an instance of generalTask, I would use it just a
model to inherit from.
Which is the correct way to do that?
Should be quite simple but I'm not sure of which syntax I have to use.

I have red at page 42 of The Orocos Component Builder's Manual
http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
"Polymorphism:Task Interface " but I'm not sure that it is what I'm looking
for.

Thank you for any hint

Best regards

Luca

How to inherit from generalTask to implement myTask1, myTask2..?

On Mon, Jun 11, 2012 at 10:43 AM, Luca Magnabosco <magnabosco [dot] luca [..] ...
> wrote:

> Hi all,
>
> I have to write few different tasks that have a lot of common operations
> between them.
> I would like to describe these common operations and properties in a
> generalTask
> and then inherit from it to implement myTask1, myTask2,.. just adding
> others
> operations and properties different for each different task.
> So I will never load an instance of generalTask, I would use it just a
> model to inherit from.
> Which is the correct way to do that?
> Should be quite simple but I'm not sure of which syntax I have to use.
>
> I have red at page 42 of The Orocos Component Builder's Manual
>
> http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
> "Polymorphism:Task Interface " but I'm not sure that it is what I'm
> looking for.
>

It is a more advanced case of what you want to do. An Orocos C++ component
is just a class which
inherits from TaskContext. So you just include its header and inherit from
it in turn.

There's basically no wrong way in doing that. Only make sure you never
inherit from TaskContext twice, somewhere in your inheritance tree.

>
> Thank you for any hint
>
> Best regards
>
> Luca
>

Peter

How to inherit from generalTask to implement myTask1, myTask2..?

On 06/11/2012 11:43 AM, Luca Magnabosco wrote:
> Hi all,
>
> I have to write few different tasks that have a lot of common
> operations between them.
> I would like to describe these common operations and properties in a
> generalTask
> and then inherit from it to implement myTask1, myTask2,.. just adding
> others
> operations and properties different for each different task.
> So I will never load an instance of generalTask, I would use it just a
> model to inherit from.
> Which is the correct way to do that?
> Should be quite simple but I'm not sure of which syntax I have to use.
>
> I have red at page 42 of The Orocos Component Builder's Manual
> http://www.orocos.org/stable/documentation/rtt/v2.x/doc-xml/orocos-compo...
> "Polymorphism:Task Interface " but I'm not sure that it is what I'm
> looking for.
>
> Thank you for any hint

Maybe it is worth to have a look at
http://www.rock-robotics.org/stable/documentation/orogen/task_inheritanc...
and orogen (a code generator for the Orocos Realtime Toolkit)

Greets Alex