Using operations un components

Dear all, I'm using operations from a custom component in another custom components. Surfing on the website I found this webpage http://www.orocos.org/wiki/rtt/rtt-20/upgrading-rtt-1x-20/methods-vs-operations which in §3 explains how to use operations from a peer component in another component.

The problem I have is that I do not have the rtt/Method.hpp file on my computer.

I have orocos 2.6, is that normal? How can I use operations in other modules?

Thank you for your help,

Best regards,

MDC

OperationCaller - added operation declaration

I found the OperationCaller class that seems to do the job.

I did the following

TaskContext* peer_ptr = getPeer("peerName");
RTT::OperationCaller<outType( inType )> operationAlias = this->peer_ptr->getOperation("operationName");
std::cout << operationAlias(testIn) << std::endl;
that compiles without errors.

When I deploy it, I got the following Segmentation fault problem

Real-time memory: 517904 bytes free of 524288 allocated.
[...]/ros_workspace/orocos/orocos_toolchain/ocl/bin/deployer: line 20: 17189 Segmentation fault      (core dumped) $cmd $*
that is caused by this line
RTT::OperationCaller<outType( inType )> operationAlias = this->peer_ptr->getOperation("operationName");

The footprint of the operationName is

std::vector<double> operationName(std::vector<double>);
is this the source of the problem?

This way seems to be better than the one of the beginning of the discussion (no files missing, at least), but it needs to be refined. Anyway, I have problems in finding an explanation on how to call an operation of a module within another module in OROCOS using this way or with alternative ways.

Does anybody know how to do that?

Thank you for your help,

Best regards,

GIT pull

I just did a git pull in [..]/ros_workspace/orocos/orocos_toolchain but still the file rtt/Method.hpp is missing in my installation. Where/how can I get it?

From this file list http://people.mech.kuleuven.be/~orocos/pub/documentation/rtt/v2.6.x/api/html/files.html it looks correct that the file is not present in the folder. But is there an updated guide that shows how to use operations in orocos components?

Thank you,

Best regards,

MDC

GIT pull

Dear Mirko,

On Fri, Jan 4, 2013 at 4:04 PM, <mirko [dot] comparetti [..] ...> wrote:

> I just did a git pull in [..]/ros_workspace/orocos/orocos_toolchain but
> still
> the file rtt/Method.hpp is missing in my installation. Where can I get it?
>

When writing on the forum, could you please use the 'quote' link instead ?

rtt/Method.hpp is an Orocos 1.x class, while rtt/Operation.hpp replaces it
in Orocos 2.x.

Are you reading the correct manuals ? See:
http://www.orocos.org/wiki/main-page/toolchain/toolchain-reference-manuals

Peter

Re:

Dear peter, Ok, I'll use quote also when I'm adding new information to the post.

I was looking to the wrong manual but later on I realized which one is the correct one to use (at least this is what I think), explained here maybe due to the fact that I'm using std::vectors and std::deque as in and out parameter of the operation.

Thank you for your help,

Best regards,

MDC

peter wrote:
Dear Mirko,

On Fri, Jan 4, 2013 at 4:04 PM, <mirko [dot] comparetti [..] ...> wrote:

> I just did a git pull in [..]/ros_workspace/orocos/orocos_toolchain but > still > the file rtt/Method.hpp is missing in my installation. Where can I get it? >

When writing on the forum, could you please use the 'quote' link instead ?

rtt/Method.hpp is an Orocos 1.x class, while rtt/Operation.hpp replaces it in Orocos 2.x.

Are you reading the correct manuals ? See: http://www.orocos.org/wiki/main-page/toolchain/toolchain-reference-manuals

Peter

Re:

Dear all, I'm facing a problem with the OROCOS operations. Here is what I'm doing in the component called componentNew

this->task_name = "componentPeer";
this->task_ptr = this->getPeer(this->task_name);
 
if (!this->task_ptr) {
    return false;
}
if (this->task_ptr->isActive()) {
    this->task_oper = this->task_ptr->getOperation("operationName");
}
where in the hpp file I defined
std::string task_name;
TaskContext* task_ptr;
RTT::OperationCaller<bool(void)> task_oper;

The code compiles but I verified that the task_ptr is NULL. I followed the instruction in from 3.4.1, but it seems that I'm I suppose that I'm trying to get the reference of the peer in the wrong way. In my xml schema I'm importing and loading the component componentPeer and the current component componentNew

Do I need to add something in the xml deployment schema? Or is there any other solution?

Thank you for your help,

Best regards,

Mirko

mastermirko wrote:
Dear peter, Ok, I'll use quote also when I'm adding new information to the post.

I was looking to the wrong manual but later on I realized which one is the correct one to use (at least this is what I think), explained here maybe due to the fact that I'm using std::vectors and std::deque as in and out parameter of the operation.

Thank you for your help,

Best regards,

MDC

peter wrote:
Dear Mirko,

On Fri, Jan 4, 2013 at 4:04 PM, <mirko [dot] comparetti [..] ...> wrote:

> I just did a git pull in [..]/ros_workspace/orocos/orocos_toolchain but > still > the file rtt/Method.hpp is missing in my installation. Where can I get it? >

When writing on the forum, could you please use the 'quote' link instead ?

rtt/Method.hpp is an Orocos 1.x class, while rtt/Operation.hpp replaces it in Orocos 2.x.

Are you reading the correct manuals ? See: http://www.orocos.org/wiki/main-page/toolchain/toolchain-reference-manuals

Peter