Data to file

Hi everyone,

I have different components connected to other components (a closed-loop system).
The simulation looks it is going OK, but I would like to know if there is a way of taking the data and save it to a file.

Thanks in advance,

Iker

Ruben Smits's picture

Data to file

On Wednesday November 5 2008 12:19:04 iker [..] ... wrote:
> Hi everyone,
>
> I have different components connected to other components (a closed-loop
> system). The simulation looks it is going OK, but I would like to know if
> there is a way of taking the data and save it to a file.
>
> Thanks in advance,

Look at the FileReporter component in ocl, it does exactly this job for ports
(and i think also attributes/properties) of components.

xml/orocos-reporting.html>

Ruben

Data to file

I am getting close, but I am not getting the results.

This is part of my code:

...
feedbackControllerComponent *controller = NULL;
PlantComponent *plant = NULL;
...
feedbackControllerComponent("controller");
plant=new PlantComponent("plant");
...

OCL::FileReporting reporter("Reporter");
reporter.addPeer( controller );
reporter.addPeer( plant );
...

According to the manual (http://people.mech.kuleuven.be/~orocos/pub/stable/documentation/ocl/v1.4.x/doc-xml/orocos-reporting.html), I should add 2 XML files, but I do not know how to do it. And after that, how to obtain the output data (.txt format for example).

Thanks in advance

Iker

[

Ruben Smits wrote:

On Wednesday November 5 2008 12:19:04 iker [..] ... wrote:
> Hi everyone,
>
> I have different components connected to other components (a closed-loop
> system). The simulation looks it is going OK, but I would like to know if
> there is a way of taking the data and save it to a file.
>
> Thanks in advance,

Look at the FileReporter component in ocl, it does exactly this job for ports
(and i think also attributes/properties) of components.

xml/orocos-reporting.html>

Ruben

Data to file

On Friday 07 November 2008 15:55:25 iker [..] ... wrote:
> I am getting close, but I am not getting the results.
>
> This is part of my code:
>
> ...
> feedbackControllerComponent *controller = NULL;
> PlantComponent *plant = NULL;
> ...
> feedbackControllerComponent("controller");
> plant=new PlantComponent("plant");
> ...
>
> OCL::FileReporting reporter("Reporter");
> reporter.addPeer( controller );
> reporter.addPeer( plant );

This is ok. , then add the line:

reporter.marshalling()->readProperties("Reporting.cpf")

And save the attachments in your application directory. Reporting.cpf will
instruct the Reporter component to monitor the ports listed in
reported-ports.cpf

That should do it.

If you used the taskbrowser, you can also use:

Reporter.marshalling.readProperties("Reporting.cpf")

Peter