RTT: Changes to ValueParser for unsigned int and float

Hello,

this is Fabian Wiesel.
I work at AI Group at the Freie University Berlin, where we employ Orocos-RTT
for our project (http://robotics.mi.fu-berlin.de).

First, let me thank you for all your work invested in this framework.

I want to suggest a small change to the ValueParser in order to allow
the input of unsigned ints and floats, by introducing C-like suffices
to the numbers. 'f' for float and 'u' for unsigned int.

Enclosed is a patch against RTT 1.4.0, which realises said behaviour.

This patch, however has (at least) one small problem: A negative float value
seems to be parsed as the combination of the unary minus-operator and
a float value, resulting in a semantic error: "Cannot apply unary
operator "-" to float."

Still, I hope this patch is of interest.

My best regards,
Fabian Wiesel

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

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

RTT: Changes to ValueParser for unsigned int and float

On Thu, 7 Feb 2008, wiesel [..] ... wrote:

> this is Fabian Wiesel.
> I work at AI Group at the Freie University Berlin, where we employ Orocos-RTT
> for our project (http://robotics.mi.fu-berlin.de).
>
> First, let me thank you for all your work invested in this framework.

Thanks for being so brave to use it! :-)

We would also welcome fundamental critical remarks from your side. I mean,
on the overal 'architecture' of the Orocos project, things that are
definitely wrong or missing, etc.

And maybe someone from your team could visit us some day in Leuven, or one
or two of our people could come and visit you Berlin. Enjoying a nice
automated guided tour around the city in your robot car ... :-)

Best regards,

Herman Bruyninckx
--
K.U.Leuven, Mechanical Eng., Mechatronics & Robotics Research Group
Tel: +32 16 322480
Coordinator of EURON (European Robotics Research Network)

Open Realtime Control Services

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

RTT: Changes to ValueParser for unsigned int and float

On Thursday 07 February 2008 11:47:13 wiesel [..] ... wrote:
> Hello,
>
> this is Fabian Wiesel.
> I work at AI Group at the Freie University Berlin, where we employ
> Orocos-RTT for our project (http://robotics.mi.fu-berlin.de).
>
> First, let me thank you for all your work invested in this framework.
>
> I want to suggest a small change to the ValueParser in order to allow
> the input of unsigned ints and floats, by introducing C-like suffices
> to the numbers. 'f' for float and 'u' for unsigned int.
>
> Enclosed is a patch against RTT 1.4.0, which realises said behaviour.
>
> This patch, however has (at least) one small problem: A negative float
> value seems to be parsed as the combination of the unary minus-operator and
> a float value, resulting in a semantic error: "Cannot apply unary
> operator "-" to float."

The reaon that this fails is that the RTT has a 'library' of operators
(+,*,!=,...) on data types. This is a 'hard-typed' system, meaning if the
operations are defined on 'double', they don't work on 'float'. So if you
write
var float x = -3.0f

the '3.0f' is interpreted as a float, and the '-' operator is looked up for
float. Since that one is not defined yet, the parser complains. The 'hard'
typed system is not flexible for mixing types, for example, if you write

var float y = 3.0 + 3.0f

It will complain that it can not add a 'double' and a 'float' and so on. You
can take a look at all the defined operators in src/RealTimeToolkit.cpp
function 'loadOperators()' and can easily add your own (one line = one
operator). You'll see that no operators for float are defined. You could also
write your own toolkit which adds these operations.

The RTT should have defined some automatic conversions from type a to type b
(like from int to float or double and vice verse), but until now, there was
no user request for such a feature...

Peter