casting support in scripts?

Hi all,

Does the OROCOS scripting engine support (implicit) type coercion ? I'm trying to assign '1e6' to a component property with a type of 'uint64', but the engine complains about a 'Fatal Semantic error: Incompatible types'.

Chapter 3 of the CBM does not mention it, so I gather there is no support for it (yet)?

casting support in scripts?

On Mon, Jun 25, 2012 at 10:42 PM, g ah <gaohml [..] ...> wrote:

>
> Hi all,
>
> Does the OROCOS scripting engine support (implicit) type coercion ? I'm
> trying to assign '1e6' to a component property with a type of 'uint64', but
> the engine complains about a 'Fatal Semantic error: Incompatible types'.
>
> Chapter 3 of the CBM does not mention it, so I gather there is no support
> for it (yet)?
>

There are many automatic type conversions, but apparantly, the
float->(u)int64 one has not been added yet to the ROS types ( I'm assuming
you imported rtt_rosnode )

It's quite trivial to add in ros_primitives_typekit_plugin.cpp in
rtt_rosnode.

Peter

casting support in scripts?

Peter Soetens wrote:
> On Mon, Jun 25, 2012 at 10:42 PM, g ah wrote:
>
>> Hi all,
>>
>> Does the OROCOS scripting engine support (implicit) type coercion ? I'm
>> trying to assign '1e6' to a component property with a type of 'uint64', but
>> the engine complains about a 'Fatal Semantic error: Incompatible types'.
>>
>> Chapter 3 of the CBM does not mention it, so I gather there is no support
>> for it (yet)?
>>
>
> There are many automatic type conversions, but apparantly, the
> float->(u)int64 one has not been added yet to the ROS types ( I'm assuming
> you imported rtt_rosnode )

yes I did. I found that code some time after sending the email.

> It's quite trivial to add in ros_primitives_typekit_plugin.cpp in
> rtt_rosnode.

It was. The conversion to/from (u)int64_t were also missing, so I added those as well. Opening a bug report with a patch attached is probably the best way to get you the patch?

One question though: it seems only direct conversions are performed? So X -> Y, Y -> Z does not result in X -> Z? At least that's what I think I observed in my limited testing.