Changing format of reported data

Does anyone know where you can change the formatting options (eg
precision, width) of data times reported by the OCL reporting
components? In particular, we need more than the default number of
significant digits.

It is not the RTT::TableMarshaller, though setting options on the
stream there does affect some data items (eg DataPort<double>). Of
note, it does *not* affect the contents of a KDL::Vector port (which
is what we need).

It does not appear to be in the KDL RTT toolkit.

Anyone?
S

Changing format of reported data

On May 15, 2009, at 09:39 , S Roderick wrote:

> Does anyone know where you can change the formatting options (eg
> precision, width) of data times reported by the OCL reporting
> components? In particular, we need more than the default number of
> significant digits.
>
> It is not the RTT::TableMarshaller, though setting options on the
> stream there does affect some data items (eg DataPort<double>). Of
> note, it does *not* affect the contents of a KDL::Vector port (which
> is what we need).

It is in the RTT::TableMarshaller.

Example patch

Index: src/marsh/TableMarshaller.hpp
===================================================================
--- src/marsh/TableMarshaller.hpp (revision 30149)
+++ src/marsh/TableMarshaller.hpp (working copy)
@@ -80,6 +80,10 @@
this->serialize( bag->value() );
else {
this->s->width( v->getName().length() );
+ this->s->setf(std::ios_base::fixed);
+ this->s->precision(6);
*this->s << v->getDataSource();
}
}

Then "make install" for RTT (which doesn't actually compile anything),
then "make; make install" in OCL (to rebuild file reporting, in my
case), and rerun your application. All double data is now 6DP (with
the above modifications).

The inability to specify any formatting on a per-item basis is a
limitation, but perhaps something we could leave till RTT 3.0? ;-)

Changing format of reported data

Hi Stephen,

On Fri, May 15, 2009 at 19:33, S Roderick <kiwi [dot] net [..] ...> wrote:
> On May 15, 2009, at 09:39 , S Roderick wrote:
>
>> Does anyone know where you can change the formatting options (eg
>> precision, width) of data times reported by the OCL reporting
>> components? In particular, we need more than the default number of
>> significant digits.
>>
>> It is not the RTT::TableMarshaller, though setting options on the
>> stream there does affect some data items (eg DataPort<double>). Of
>> note, it does *not* affect the contents of a KDL::Vector port (which
>> is what we need).
>
> It is in the RTT::TableMarshaller.
>
> Example patch
>
> Index: src/marsh/TableMarshaller.hpp
> ===================================================================
> --- src/marsh/TableMarshaller.hpp       (revision 30149)
> +++ src/marsh/TableMarshaller.hpp       (working copy)
> @@ -80,6 +80,10 @@
>                      this->serialize( bag->value() );
>                  else {
>                      this->s->width( v->getName().length() );
> +                    this->s->setf(std::ios_base::fixed);
> +                    this->s->precision(6);
>                      *this->s << v->getDataSource();
>                  }
>                        }
>
> Then "make install" for RTT (which doesn't actually compile anything),
> then "make; make install" in OCL (to rebuild file reporting, in my
> case), and rerun your application. All double data is now 6DP (with
> the above modifications).
>
> The inability to specify any formatting on a per-item basis is a
> limitation, but perhaps something we could leave till RTT 3.0? ;-)

The difficulty is not the implementation, but finding a convenient way
to let the user specify it. Maybe the proper way to do is marshalling using
the NetCDF marshaller (which stores the complete value in a
structured file format) and then importing
that file in the tool you like. Matlab for example can read NetCDF files.

Peter