getProperty<classT> functionality

Hi,

I'm trying to use the getProperty method in RTT 2.0 in the following way:

subbag = bag.getProperty<PropertyBag>("Trans_Vel");

as is explained in the documentation:

"To retrieve this property, either use find or getProperty to retrieve
a Property by name :

base::PropertyBase* pb = bag.find( "name" ).
Property<ClassT> pb = bag.getProperty<ClassT>( "name" )."

The compiler however complains about it:

"error: expected primary-expression before ‘>’ token"

Any ideas on what might go wrong here? I'm using the latest version of RTT 2.0.

Steven

getProperty<classT> functionality

On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> Hi,
>
> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>
> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>
> as is explained in the documentation:

Outdated docs. We dropped the template parameter since the 'subbag'
will check the type anyway.

So you have to write:

&#10; subbag = bag.getProperty(&quot;Trans_Vel&quot;);&#10;

This is so for any getFoo("name") function. The old style is done by
calling getPropertyType<T> in case you would explicitly need that
functionality.

Peter

getProperty<classT> functionality

2010/8/17 Peter Soetens <peter [..] ...>:
> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
> <steven [dot] bellens [..] ...> wrote:
>> Hi,
>>
>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>
>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>
>> as is explained in the documentation:
>
> Outdated docs. We dropped the template parameter since the 'subbag'
> will check the type anyway.

Am I using the wrong docs or are they not updated yet?
I'm struggling with the TemplateIndexTypeInfo struct now, which
apparently is not in RTT 2.0 anymore. Is it replaced by
SequenceTypeInfo?

>
> So you have to write:
>
> &#10;&gt;  subbag = bag.getProperty(&quot;Trans_Vel&quot;);&#10;&gt;
>
> This is so for any getFoo("name") function. The old style is done by
> calling getPropertyType<T> in case you would explicitly need that
> functionality.

thanks

Steven

>
> Peter
>

getProperty<classT> functionality

On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2010/8/17 Peter Soetens <peter [..] ...>:
>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> Hi,
>>>
>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>
>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>
>>> as is explained in the documentation:
>>
>> Outdated docs. We dropped the template parameter since the 'subbag'
>> will check the type anyway.
>
> Am I using the wrong docs or are they not updated yet?

Use the docs at
http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
ie the last beta.

> I'm struggling with the TemplateIndexTypeInfo struct now, which
> apparently is not in RTT 2.0 anymore. Is it replaced by
> SequenceTypeInfo?

Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
out of the box, given that T is also known to the type system (use
StructTypeInfo or
TemplateTypeInfo or any of the other templates according to the needs of T)

Peter

getProperty<classT> functionality

2010/8/18 Peter Soetens <peter [..] ...>:
> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
> <steven [dot] bellens [..] ...> wrote:
>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>> <steven [dot] bellens [..] ...> wrote:
>>>> Hi,
>>>>
>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>
>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>
>>>> as is explained in the documentation:
>>>
>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>> will check the type anyway.
>>
>> Am I using the wrong docs or are they not updated yet?
>
> Use the docs at
> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
> ie the last beta.
>
>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>> apparently is not in RTT 2.0 anymore. Is it replaced by
>> SequenceTypeInfo?
>
> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
> out of the box, given that T is also known to the type system (use
> StructTypeInfo or
> TemplateTypeInfo or any of the other templates according to the needs of T)

I used to pass a RangeIndexChecker to the struct, do I still need to
take care of this myself or does the SequenceTypeInfo checks the range
already?

Steven

>
> Peter
>

getProperty<classT> functionality

On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2010/8/18 Peter Soetens <peter [..] ...>:
>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>> <steven [dot] bellens [..] ...> wrote:
>>>>> Hi,
>>>>>
>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>
>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>
>>>>> as is explained in the documentation:
>>>>
>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>> will check the type anyway.
>>>
>>> Am I using the wrong docs or are they not updated yet?
>>
>> Use the docs at
>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>> ie the last beta.
>>
>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>> SequenceTypeInfo?
>>
>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>> out of the box, given that T is also known to the type system (use
>> StructTypeInfo or
>> TemplateTypeInfo or any of the other templates according to the needs of T)
>
> I used to pass a RangeIndexChecker to the struct, do I still need to
> take care of this myself or does the SequenceTypeInfo checks the range
> already?

SequenceTypeInfo takes care of *everything*. You don't need to add any
of the helper classes functions etc like in 1.x.

Maybe if you showed how your type looked like, I could give a more precise
description of what needs to be done, or where to find such instructions.

Peter

getProperty<classT> functionality

2010/8/18 Peter Soetens <peter [..] ...>:
> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
> <steven [dot] bellens [..] ...> wrote:
>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>> <steven [dot] bellens [..] ...> wrote:
>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>
>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>
>>>>>> as is explained in the documentation:
>>>>>
>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>> will check the type anyway.
>>>>
>>>> Am I using the wrong docs or are they not updated yet?
>>>
>>> Use the docs at
>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>> ie the last beta.
>>>
>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>> SequenceTypeInfo?
>>>
>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>> out of the box, given that T is also known to the type system (use
>>> StructTypeInfo or
>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>
>> I used to pass a RangeIndexChecker to the struct, do I still need to
>> take care of this myself or does the SequenceTypeInfo checks the range
>> already?
>
> SequenceTypeInfo takes care of *everything*. You don't need to add any
> of the helper classes functions etc like in 1.x.
>
> Maybe if you showed how your type looked like, I could give a more precise
> description of what needs to be done, or where to find such instructions.

I'm updating the kdl-toolkit in order to work with RTT2.0, more
specifically the toolkit.cpp file. The toolkit defines additional
operators for frames, wrenches, etc, e.g.:
&#10;add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;

where Frame is an object.

Steven

>
> Peter
>

getProperty<classT> functionality

2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
> 2010/8/18 Peter Soetens <peter [..] ...>:
>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>> <steven [dot] bellens [..] ...> wrote:
>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>
>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>
>>>>>>> as is explained in the documentation:
>>>>>>
>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>> will check the type anyway.
>>>>>
>>>>> Am I using the wrong docs or are they not updated yet?
>>>>
>>>> Use the docs at
>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>> ie the last beta.
>>>>
>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>> SequenceTypeInfo?
>>>>
>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>> out of the box, given that T is also known to the type system (use
>>>> StructTypeInfo or
>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>
>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>> take care of this myself or does the SequenceTypeInfo checks the range
>>> already?
>>
>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>> of the helper classes functions etc like in 1.x.
>>
>> Maybe if you showed how your type looked like, I could give a more precise
>> description of what needs to be done, or where to find such instructions.
>
> I'm updating the kdl-toolkit in order to work with RTT2.0, more
> specifically the toolkit.cpp file. The toolkit defines additional
> operators for frames, wrenches, etc, e.g.:
> &#10;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;
>
> where Frame is an object.

I've added my files in appendix for clarity. The class definitions are
in frames.hpp. In toolkit.cpp I've added the serialize method in the
boost::serialization namespace for Frames, Twists and Wrenches, as
explained in the docs
http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
at section 2.2. The addTransport is, I guess, replaced by addProtocol.
The compiler now complains about:

"[ 80%] Building CXX object
src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
In file included from
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
from
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
In member function ‘RTT::base::AttributeBase*
RTT::types::SequenceTypeInfo<T,
has_ostream>::buildVariable(std::string, int) const [with T =
KDL::Wrench, bool has_ostream = true]’:
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
instantiated from here
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
error: no type named ‘value_type’ in ‘class KDL::Wrench’"

Do I have to add this value_type type in the Wrench class definition?
If so, how do I do this?

Steven

>
> Steven
>
>>
>> Peter
>>
>

getProperty<classT> functionality

On Thu, Aug 19, 2010 at 11:57 AM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>>> <steven [dot] bellens [..] ...> wrote:
>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>>
>>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>>
>>>>>>>> as is explained in the documentation:
>>>>>>>
>>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>>> will check the type anyway.
>>>>>>
>>>>>> Am I using the wrong docs or are they not updated yet?
>>>>>
>>>>> Use the docs at
>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>>> ie the last beta.
>>>>>
>>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>>> SequenceTypeInfo?
>>>>>
>>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>>> out of the box, given that T is also known to the type system (use
>>>>> StructTypeInfo or
>>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>>
>>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>>> take care of this myself or does the SequenceTypeInfo checks the range
>>>> already?
>>>
>>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>>> of the helper classes functions etc like in 1.x.
>>>
>>> Maybe if you showed how your type looked like, I could give a more precise
>>> description of what needs to be done, or where to find such instructions.
>>
>> I'm updating the kdl-toolkit in order to work with RTT2.0, more
>> specifically the toolkit.cpp file. The toolkit defines additional
>> operators for frames, wrenches, etc, e.g.:
>> &#10;&gt;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;&gt;
>>
>> where Frame is an object.
>
> I've added my files in appendix for clarity. The class definitions are
> in frames.hpp. In toolkit.cpp I've added the serialize method in the
> boost::serialization namespace for Frames, Twists and Wrenches, as
> explained in the docs
> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
> at section 2.2. The addTransport is, I guess, replaced by addProtocol.
> The compiler now complains about:
>
> "[ 80%] Building CXX object
> src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
> In file included from
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
>                 from
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
> In member function ‘RTT::base::AttributeBase*
> RTT::types::SequenceTypeInfo<T,
> has_ostream>::buildVariable(std::string, int) const [with T =
> KDL::Wrench, bool has_ostream = true]’:
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
>  instantiated from here
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
> error: no type named ‘value_type’ in ‘class KDL::Wrench’"
>
> Do I have to add this value_type type in the Wrench class definition?
> If so, how do I do this?

I finally see your problem. SequenceTypeInfo is implemented to support
STL Sequences (vector, list etc). Wrench behaves more like a struct.
Your first trial at getting a type into the type system is adding it
as a StructTypeInfo. If that compiles well and you can use your Wrench
in the TaskBrowser (var Wrench w ; w.force.x = 3; etc) you can start
extending it with operators(+-* etc). The [ ] operator can not be
added like it used to be in 1.x. For this (and this lacks in the
docs), you need to create your own type info class that resembles
this:

&#10;using namespace RTT;&#10;struct WrenchTypeInfo : public StructTypeInfo&lt;Wrench&gt; {&#10;  // ... constructor omitted for brevity .. specialize getMember:&#10;  DataSourceBase::shared_ptr getMember(DataSourceBase::shared_ptr&#10;item, DataSourceBase::shared_ptr id) {&#10;     // this code is pretty standard (but also verbose) and&#10;copy/pasted from SequenceTypeInfo:&#10;&#10;     typename internal::AssignableDataSource&lt;T&gt;::shared_ptr data =&#10;boost::dynamic_pointer_cast&lt; internal::AssignableDataSource&lt;T&gt; &gt;( item&#10;);&#10;     if ( !data ) {&#10;            if ( !item-&gt;isAssignable() )&#10;                 log(Error) &lt;&lt; &quot;Can&#039;t return reference to members of&#10;type &quot;&lt;&lt; this-&gt;getTypeName() &lt;&lt;&quot; since given object is not&#10;assignable.&quot; &lt;&lt;endlog();&#10;            else&#10;                 log(Error) &lt;&lt; &quot;Consistency error: TypeInfo of type&#10;&quot;&lt;&lt; this-&gt;getTypeName() &lt;&lt;&quot; can&#039;t handle types of type &quot;&lt;&lt;&#10;item-&gt;getType() &lt;&lt;endlog();&#10;            return base::DataSourceBase::shared_ptr();&#10;       }&#10;      // see if we got an int given by operator[ ] or any other&#10;indexing function:&#10;      typename internal::DataSource&lt;int&gt;::shared_ptr id_indx =&#10;internal::DataSource&lt;int&gt;::narrow( id.get() );&#10;      if ( id_indx ) {&#10;           try {&#10;                 return&#10;internal::newFunctorDataSource(&amp;types::get_container_item&lt;T&gt;,&#10;internal::GenerateDataSource()(item.get(), id_indx.get() ) );&#10;           } catch(...) {&#10;                 log(Error) &lt;&lt; &quot;Wrench: Invalid index : &quot; &lt;&lt;&#10;id_indx-&gt;get() &lt;&lt;&quot;:&quot;&lt;&lt; id_indx-&gt;getTypeName() &lt;&lt; endlog();&#10;           }&#10;    // if not an index, fall back to retrieving &#039;force&#039;, &#039;torque&#039;:&#10;    return StructTypeInfo::getMember(item, id);&#10;}&#10;

It's still verbose, but I believe most of this can be resolved using
some helper functions which we don't have yet. If you have multiple
types in the above case, you can template 'WrenchTypeInfo' too,
similar to what we did before with VectorTemplateTypeInfo.

Peter
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

getProperty<classT> functionality

2010/8/19 Peter Soetens <peter [..] ...>:
> On Thu, Aug 19, 2010 at 11:57 AM, Steven Bellens
> <steven [dot] bellens [..] ...> wrote:
>> 2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>>>> <steven [dot] bellens [..] ...> wrote:
>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>>>
>>>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>>>
>>>>>>>>> as is explained in the documentation:
>>>>>>>>
>>>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>>>> will check the type anyway.
>>>>>>>
>>>>>>> Am I using the wrong docs or are they not updated yet?
>>>>>>
>>>>>> Use the docs at
>>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>>>> ie the last beta.
>>>>>>
>>>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>>>> SequenceTypeInfo?
>>>>>>
>>>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>>>> out of the box, given that T is also known to the type system (use
>>>>>> StructTypeInfo or
>>>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>>>
>>>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>>>> take care of this myself or does the SequenceTypeInfo checks the range
>>>>> already?
>>>>
>>>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>>>> of the helper classes functions etc like in 1.x.
>>>>
>>>> Maybe if you showed how your type looked like, I could give a more precise
>>>> description of what needs to be done, or where to find such instructions.
>>>
>>> I'm updating the kdl-toolkit in order to work with RTT2.0, more
>>> specifically the toolkit.cpp file. The toolkit defines additional
>>> operators for frames, wrenches, etc, e.g.:
>>> &#10;&gt;&gt;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;&gt;&gt;
>>>
>>> where Frame is an object.
>>
>> I've added my files in appendix for clarity. The class definitions are
>> in frames.hpp. In toolkit.cpp I've added the serialize method in the
>> boost::serialization namespace for Frames, Twists and Wrenches, as
>> explained in the docs
>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>> at section 2.2. The addTransport is, I guess, replaced by addProtocol.
>> The compiler now complains about:
>>
>> "[ 80%] Building CXX object
>> src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
>> In file included from
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
>>                 from
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
>> In member function ‘RTT::base::AttributeBase*
>> RTT::types::SequenceTypeInfo<T,
>> has_ostream>::buildVariable(std::string, int) const [with T =
>> KDL::Wrench, bool has_ostream = true]’:
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
>>  instantiated from here
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
>> error: no type named ‘value_type’ in ‘class KDL::Wrench’"
>>
>> Do I have to add this value_type type in the Wrench class definition?
>> If so, how do I do this?
>
> I finally see your problem. SequenceTypeInfo is implemented to support
> STL Sequences (vector, list etc). Wrench behaves more like a struct.
> Your first trial at getting a type into the type system is adding it
> as a StructTypeInfo. If that compiles well and you can use your Wrench
> in the TaskBrowser (var Wrench w ; w.force.x = 3; etc) you can start
> extending it with operators(+-* etc).

I've renamed the toolkit file to typekit and started from scratch
there, as it obviously needs major refactoring.

Following http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
, section 2.2, I've created a KDLTypekitPlugin with one type,
KDL::Vector - files in appendix. The code compiles, but when I try to
load the plugin with loadLibrary (), it gives me

" (type 'ls' for context info)
:loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
Got :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
17.807 [ Info ][DeploymentComponent::loadLibrary] Component package
'/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so'
not seen before.
17.813 [ Debug ][DeploymentComponent::loadLibrary] Succesfully loaded
orocos-kdltk-gnulinux
17.813 [ ERROR ][DeploymentComponent::loadLibrary] Unloading
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
not a valid component library:
17.813 [ ERROR ][DeploymentComponent::loadLibrary]
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
undefined symbol: createComponent
17.813 [ ERROR ][DeploymentComponent::loadLibrary]
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
undefined symbol: getComponentType
= false"

What am I doing wrong?

Steven

> The [ ] operator can not be
> added like it used to be in 1.x. For this (and this lacks in the
> docs), you need to create your own type info class that resembles
> this:
>
> &#10;&gt; using namespace RTT;&#10;&gt; struct WrenchTypeInfo : public StructTypeInfo&lt;Wrench&gt; {&#10;&gt;  // ... constructor omitted for brevity .. specialize getMember:&#10;&gt;  DataSourceBase::shared_ptr getMember(DataSourceBase::shared_ptr&#10;&gt; item, DataSourceBase::shared_ptr id) {&#10;&gt;     // this code is pretty standard (but also verbose) and&#10;&gt; copy/pasted from SequenceTypeInfo:&#10;&gt;&#10;&gt;     typename internal::AssignableDataSource&lt;T&gt;::shared_ptr data =&#10;&gt; boost::dynamic_pointer_cast&lt; internal::AssignableDataSource&lt;T&gt; &gt;( item&#10;&gt; );&#10;&gt;     if ( !data ) {&#10;&gt;            if ( !item-&gt;isAssignable() )&#10;&gt;                 log(Error) &lt;&lt; &quot;Can&#039;t return reference to members of&#10;&gt; type &quot;&lt;&lt; this-&gt;getTypeName() &lt;&lt;&quot; since given object is not&#10;&gt; assignable.&quot; &lt;&lt;endlog();&#10;&gt;            else&#10;&gt;                 log(Error) &lt;&lt; &quot;Consistency error: TypeInfo of type&#10;&gt; &quot;&lt;&lt; this-&gt;getTypeName() &lt;&lt;&quot; can&#039;t handle types of type &quot;&lt;&lt;&#10;&gt; item-&gt;getType() &lt;&lt;endlog();&#10;&gt;            return base::DataSourceBase::shared_ptr();&#10;&gt;       }&#10;&gt;      // see if we got an int given by operator[ ] or any other&#10;&gt; indexing function:&#10;&gt;      typename internal::DataSource&lt;int&gt;::shared_ptr id_indx =&#10;&gt; internal::DataSource&lt;int&gt;::narrow( id.get() );&#10;&gt;      if ( id_indx ) {&#10;&gt;           try {&#10;&gt;                 return&#10;&gt; internal::newFunctorDataSource(&amp;types::get_container_item&lt;T&gt;,&#10;&gt; internal::GenerateDataSource()(item.get(), id_indx.get() ) );&#10;&gt;           } catch(...) {&#10;&gt;                 log(Error) &lt;&lt; &quot;Wrench: Invalid index : &quot; &lt;&lt;&#10;&gt; id_indx-&gt;get() &lt;&lt;&quot;:&quot;&lt;&lt; id_indx-&gt;getTypeName() &lt;&lt; endlog();&#10;&gt;           }&#10;&gt;    // if not an index, fall back to retrieving &#039;force&#039;, &#039;torque&#039;:&#10;&gt;    return StructTypeInfo::getMember(item, id);&#10;&gt; }&#10;&gt;
>
> It's still verbose, but I believe most of this can be resolved using
> some helper functions which we don't have yet. If you have multiple
> types in the above case, you can template 'WrenchTypeInfo' too,
> similar to what we did before with VectorTemplateTypeInfo.
>
> Peter
>

getProperty<classT> functionality

On Fri, Aug 20, 2010 at 2:31 PM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2010/8/19 Peter Soetens <peter [..] ...>:
>> On Thu, Aug 19, 2010 at 11:57 AM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> 2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>>>>
>>>>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>>>>
>>>>>>>>>> as is explained in the documentation:
>>>>>>>>>
>>>>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>>>>> will check the type anyway.
>>>>>>>>
>>>>>>>> Am I using the wrong docs or are they not updated yet?
>>>>>>>
>>>>>>> Use the docs at
>>>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>>>>> ie the last beta.
>>>>>>>
>>>>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>>>>> SequenceTypeInfo?
>>>>>>>
>>>>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>>>>> out of the box, given that T is also known to the type system (use
>>>>>>> StructTypeInfo or
>>>>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>>>>
>>>>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>>>>> take care of this myself or does the SequenceTypeInfo checks the range
>>>>>> already?
>>>>>
>>>>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>>>>> of the helper classes functions etc like in 1.x.
>>>>>
>>>>> Maybe if you showed how your type looked like, I could give a more precise
>>>>> description of what needs to be done, or where to find such instructions.
>>>>
>>>> I'm updating the kdl-toolkit in order to work with RTT2.0, more
>>>> specifically the toolkit.cpp file. The toolkit defines additional
>>>> operators for frames, wrenches, etc, e.g.:
>>>> &#10;&gt;&gt;&gt;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;&gt;&gt;&gt;
>>>>
>>>> where Frame is an object.
>>>
>>> I've added my files in appendix for clarity. The class definitions are
>>> in frames.hpp. In toolkit.cpp I've added the serialize method in the
>>> boost::serialization namespace for Frames, Twists and Wrenches, as
>>> explained in the docs
>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>>> at section 2.2. The addTransport is, I guess, replaced by addProtocol.
>>> The compiler now complains about:
>>>
>>> "[ 80%] Building CXX object
>>> src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
>>> In file included from
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
>>>                 from
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
>>> In member function ‘RTT::base::AttributeBase*
>>> RTT::types::SequenceTypeInfo<T,
>>> has_ostream>::buildVariable(std::string, int) const [with T =
>>> KDL::Wrench, bool has_ostream = true]’:
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
>>>  instantiated from here
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
>>> error: no type named ‘value_type’ in ‘class KDL::Wrench’"
>>>
>>> Do I have to add this value_type type in the Wrench class definition?
>>> If so, how do I do this?
>>
>> I finally see your problem. SequenceTypeInfo is implemented to support
>> STL Sequences (vector, list etc). Wrench behaves more like a struct.
>> Your first trial at getting a type into the type system is adding it
>> as a StructTypeInfo. If that compiles well and you can use your Wrench
>> in the TaskBrowser (var Wrench w ; w.force.x = 3; etc) you can start
>> extending it with operators(+-* etc).
>
> I've renamed the toolkit file to typekit and started from scratch
> there, as it obviously needs major refactoring.
>
> Following http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
> , section 2.2, I've created a KDLTypekitPlugin with one type,
> KDL::Vector - files in appendix. The code compiles, but when I try to
> load the plugin with loadLibrary (), it gives me
>
> " (type 'ls' for context info)
> :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
>      Got :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
> 17.807 [ Info   ][DeploymentComponent::loadLibrary] Component package
> '/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so'
> not seen before.
> 17.813 [ Debug  ][DeploymentComponent::loadLibrary] Succesfully loaded
> orocos-kdltk-gnulinux
> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary] Unloading
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
> not a valid component library:
> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
> undefined symbol: createComponent
> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
> undefined symbol: getComponentType
>  = false"
>
> What am I doing wrong?

You must install your typekit in the types/ subdirectory. So for example if
RTT_COMPONENT_PATH=/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/
then the file liborocos-kdltk-gnulinux.so is in:
/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/types/

What you saw is that the DC tried to load the typekit as a component
which failed. I will add an extra check for this in the DC that it can
print the proper warning for misplaced plugins/typekits.

Peter
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

getProperty<classT> functionality

2010/8/20 Peter Soetens <peter [..] ...>:
> On Fri, Aug 20, 2010 at 2:31 PM, Steven Bellens
> <steven [dot] bellens [..] ...> wrote:
>> 2010/8/19 Peter Soetens <peter [..] ...>:
>>> On Thu, Aug 19, 2010 at 11:57 AM, Steven Bellens
>>> <steven [dot] bellens [..] ...> wrote:
>>>> 2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>>
>>>>>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>>>>>
>>>>>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>>>>>
>>>>>>>>>>> as is explained in the documentation:
>>>>>>>>>>
>>>>>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>>>>>> will check the type anyway.
>>>>>>>>>
>>>>>>>>> Am I using the wrong docs or are they not updated yet?
>>>>>>>>
>>>>>>>> Use the docs at
>>>>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>>>>>> ie the last beta.
>>>>>>>>
>>>>>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>>>>>> SequenceTypeInfo?
>>>>>>>>
>>>>>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>>>>>> out of the box, given that T is also known to the type system (use
>>>>>>>> StructTypeInfo or
>>>>>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>>>>>
>>>>>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>>>>>> take care of this myself or does the SequenceTypeInfo checks the range
>>>>>>> already?
>>>>>>
>>>>>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>>>>>> of the helper classes functions etc like in 1.x.
>>>>>>
>>>>>> Maybe if you showed how your type looked like, I could give a more precise
>>>>>> description of what needs to be done, or where to find such instructions.
>>>>>
>>>>> I'm updating the kdl-toolkit in order to work with RTT2.0, more
>>>>> specifically the toolkit.cpp file. The toolkit defines additional
>>>>> operators for frames, wrenches, etc, e.g.:
>>>>> &#10;&gt;&gt;&gt;&gt;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;&gt;&gt;&gt;&gt;
>>>>>
>>>>> where Frame is an object.
>>>>
>>>> I've added my files in appendix for clarity. The class definitions are
>>>> in frames.hpp. In toolkit.cpp I've added the serialize method in the
>>>> boost::serialization namespace for Frames, Twists and Wrenches, as
>>>> explained in the docs
>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>>>> at section 2.2. The addTransport is, I guess, replaced by addProtocol.
>>>> The compiler now complains about:
>>>>
>>>> "[ 80%] Building CXX object
>>>> src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
>>>> In file included from
>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
>>>>                 from
>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
>>>> In member function ‘RTT::base::AttributeBase*
>>>> RTT::types::SequenceTypeInfo<T,
>>>> has_ostream>::buildVariable(std::string, int) const [with T =
>>>> KDL::Wrench, bool has_ostream = true]’:
>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
>>>>  instantiated from here
>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
>>>> error: no type named ‘value_type’ in ‘class KDL::Wrench’"
>>>>
>>>> Do I have to add this value_type type in the Wrench class definition?
>>>> If so, how do I do this?
>>>
>>> I finally see your problem. SequenceTypeInfo is implemented to support
>>> STL Sequences (vector, list etc). Wrench behaves more like a struct.
>>> Your first trial at getting a type into the type system is adding it
>>> as a StructTypeInfo. If that compiles well and you can use your Wrench
>>> in the TaskBrowser (var Wrench w ; w.force.x = 3; etc) you can start
>>> extending it with operators(+-* etc).
>>
>> I've renamed the toolkit file to typekit and started from scratch
>> there, as it obviously needs major refactoring.
>>
>> Following http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>> , section 2.2, I've created a KDLTypekitPlugin with one type,
>> KDL::Vector - files in appendix. The code compiles, but when I try to
>> load the plugin with loadLibrary (), it gives me
>>
>> " (type 'ls' for context info)
>> :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
>>      Got :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
>> 17.807 [ Info   ][DeploymentComponent::loadLibrary] Component package
>> '/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so'
>> not seen before.
>> 17.813 [ Debug  ][DeploymentComponent::loadLibrary] Succesfully loaded
>> orocos-kdltk-gnulinux
>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary] Unloading
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>> not a valid component library:
>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>> undefined symbol: createComponent
>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>> undefined symbol: getComponentType
>>  = false"
>>
>> What am I doing wrong?
>
> You must install your typekit in the types/ subdirectory. So for example if
> RTT_COMPONENT_PATH=/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/
> then the file liborocos-kdltk-gnulinux.so is in:
> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/types/

Yes, that works, thanks. I've implemented my vector, frame, rotation,
twist and wrench classes now as StructTypeInfo and I am able to use
them in the TaskBrowser. (var vector t = vector(1,2,3). t.x, etc).
Some questions about this:

- when do I use the TemplateTypeInfo and when the StructTypeInfo?
- how can I decompose e.g. a KDL::vector: right now the TaskBrowser
only says "(vector)", but I want it to display the content itself.
Before, Ruben wrote additional functions for this. Is this still the
way to do it?

Steven

>
> What you saw is that the DC tried to load the typekit as a component
> which failed. I will add an extra check for this in the DC that it can
> print the proper warning for misplaced plugins/typekits.
>
> Peter
>

getProperty<classT> functionality

On Mon, Aug 23, 2010 at 10:57 AM, Steven Bellens
<steven [dot] bellens [..] ...> wrote:
> 2010/8/20 Peter Soetens <peter [..] ...>:
>> On Fri, Aug 20, 2010 at 2:31 PM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> 2010/8/19 Peter Soetens <peter [..] ...>:
>>>> On Thu, Aug 19, 2010 at 11:57 AM, Steven Bellens
>>>> <steven [dot] bellens [..] ...> wrote:
>>>>> 2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
>>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>>> On Wed, Aug 18, 2010 at 11:36 AM, Steven Bellens
>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>> 2010/8/18 Peter Soetens <peter [..] ...>:
>>>>>>>>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>>>>>>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>>>>>>>>> <steven [dot] bellens [..] ...> wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>>>>>>>>
>>>>>>>>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>>>>>>>>
>>>>>>>>>>>> as is explained in the documentation:
>>>>>>>>>>>
>>>>>>>>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>>>>>>>>> will check the type anyway.
>>>>>>>>>>
>>>>>>>>>> Am I using the wrong docs or are they not updated yet?
>>>>>>>>>
>>>>>>>>> Use the docs at
>>>>>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>>>>>>>>> ie the last beta.
>>>>>>>>>
>>>>>>>>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>>>>>>>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>>>>>>>>> SequenceTypeInfo?
>>>>>>>>>
>>>>>>>>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>>>>>>>>> out of the box, given that T is also known to the type system (use
>>>>>>>>> StructTypeInfo or
>>>>>>>>> TemplateTypeInfo or any of the other templates according to the needs of T)
>>>>>>>>
>>>>>>>> I used to pass a RangeIndexChecker to the struct, do I still need to
>>>>>>>> take care of this myself or does the SequenceTypeInfo checks the range
>>>>>>>> already?
>>>>>>>
>>>>>>> SequenceTypeInfo takes care of *everything*. You don't need to add any
>>>>>>> of the helper classes functions etc like in 1.x.
>>>>>>>
>>>>>>> Maybe if you showed how your type looked like, I could give a more precise
>>>>>>> description of what needs to be done, or where to find such instructions.
>>>>>>
>>>>>> I'm updating the kdl-toolkit in order to work with RTT2.0, more
>>>>>> specifically the toolkit.cpp file. The toolkit defines additional
>>>>>> operators for frames, wrenches, etc, e.g.:
>>>>>> &#10;&gt;&gt;&gt;&gt;&gt;&gt; add( newBinaryOperator( &quot;[]&quot;, stdvector_index&lt;Frame&gt;() ) );&#10;&gt;&gt;&gt;&gt;&gt;&gt;
>>>>>>
>>>>>> where Frame is an object.
>>>>>
>>>>> I've added my files in appendix for clarity. The class definitions are
>>>>> in frames.hpp. In toolkit.cpp I've added the serialize method in the
>>>>> boost::serialization namespace for Frames, Twists and Wrenches, as
>>>>> explained in the docs
>>>>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>>>>> at section 2.2. The addTransport is, I guess, replaced by addProtocol.
>>>>> The compiler now complains about:
>>>>>
>>>>> "[ 80%] Building CXX object
>>>>> src/bindings/rtt/CMakeFiles/orocos-kdltk-gnulinux.dir/toolkit.cpp.o
>>>>> In file included from
>>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/VectorTemplateComposition.hpp:39,
>>>>>                 from
>>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:44:
>>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:
>>>>> In member function ‘RTT::base::AttributeBase*
>>>>> RTT::types::SequenceTypeInfo<T,
>>>>> has_ostream>::buildVariable(std::string, int) const [with T =
>>>>> KDL::Wrench, bool has_ostream = true]’:
>>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/kdl-svn/src/bindings/rtt/toolkit.cpp:528:
>>>>>  instantiated from here
>>>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/rtt/rtt_2.0/install/include/rtt/types/SequenceTypeInfo.hpp:79:
>>>>> error: no type named ‘value_type’ in ‘class KDL::Wrench’"
>>>>>
>>>>> Do I have to add this value_type type in the Wrench class definition?
>>>>> If so, how do I do this?
>>>>
>>>> I finally see your problem. SequenceTypeInfo is implemented to support
>>>> STL Sequences (vector, list etc). Wrench behaves more like a struct.
>>>> Your first trial at getting a type into the type system is adding it
>>>> as a StructTypeInfo. If that compiles well and you can use your Wrench
>>>> in the TaskBrowser (var Wrench w ; w.force.x = 3; etc) you can start
>>>> extending it with operators(+-* etc).
>>>
>>> I've renamed the toolkit file to typekit and started from scratch
>>> there, as it obviously needs major refactoring.
>>>
>>> Following http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/doc-xml...
>>> , section 2.2, I've created a KDLTypekitPlugin with one type,
>>> KDL::Vector - files in appendix. The code compiles, but when I try to
>>> load the plugin with loadLibrary (), it gives me
>>>
>>> " (type 'ls' for context info)
>>> :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
>>>      Got :loadLibrary("/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so")
>>> 17.807 [ Info   ][DeploymentComponent::loadLibrary] Component package
>>> '/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so'
>>> not seen before.
>>> 17.813 [ Debug  ][DeploymentComponent::loadLibrary] Succesfully loaded
>>> orocos-kdltk-gnulinux
>>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary] Unloading
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>>> not a valid component library:
>>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>>> undefined symbol: createComponent
>>> 17.813 [ ERROR  ][DeploymentComponent::loadLibrary]
>>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/liborocos-kdltk-gnulinux.so:
>>> undefined symbol: getComponentType
>>>  = false"
>>>
>>> What am I doing wrong?
>>
>> You must install your typekit in the types/ subdirectory. So for example if
>> RTT_COMPONENT_PATH=/home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/
>> then the file liborocos-kdltk-gnulinux.so is in:
>> /home/steven/src/svn/cturtle/install/stacks/kul-ros-pkg/orocos/kdl/kdl_1.0/lib/types/
>
> Yes, that works, thanks. I've implemented my vector, frame, rotation,
> twist and wrench classes now as StructTypeInfo and I am able to use
> them in the TaskBrowser. (var vector t = vector(1,2,3). t.x, etc).
> Some questions about this:
>
> - when do I use the TemplateTypeInfo and when the StructTypeInfo?

TemplateTypeInfo is more lowlevel/basic (aka 'plumbing') and serves
as a base class for all more concrete type info classes. StructTypeInfo
is one of these but is only useful if you have boost::serialization
functions for your type.

> - how can I decompose e.g. a KDL::vector: right now the TaskBrowser
> only says "(vector)", but I want it to display the content itself.

Like in TemplateTypeInfo, pass 'true' as the second template argument ,
so: StructTypeInfo<KDL::vector,true>

> Before, Ruben wrote additional functions for this. Is this still the
> way to do it?

It needs operator<< and operator>>. Or you can override the toString
function of the StructTypeInfo class (pass ...,false> in that case).

I had a patch where the TB has a generic display function and
would display "vector { x= 0.0, y=0.0, z=0.0 }" in case the type does
not tell how to be displayed. The patch didn't make it into master yet.

Peter
--
Orocos-Dev mailing list
Orocos-Dev [..] ...
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev

getProperty<classT> functionality

2010/8/18 Steven Bellens <steven [dot] bellens [..] ...>:
> 2010/8/18 Peter Soetens <peter [..] ...>:
>> On Wed, Aug 18, 2010 at 10:05 AM, Steven Bellens
>> <steven [dot] bellens [..] ...> wrote:
>>> 2010/8/17 Peter Soetens <peter [..] ...>:
>>>> On Tue, Aug 17, 2010 at 3:55 PM, Steven Bellens
>>>> <steven [dot] bellens [..] ...> wrote:
>>>>> Hi,
>>>>>
>>>>> I'm trying to use the getProperty method in RTT 2.0 in the following way:
>>>>>
>>>>> subbag = bag.getProperty<PropertyBag>("Trans_Vel");
>>>>>
>>>>> as is explained in the documentation:
>>>>
>>>> Outdated docs. We dropped the template parameter since the 'subbag'
>>>> will check the type anyway.
>>>
>>> Am I using the wrong docs or are they not updated yet?
>>
>> Use the docs at
>> http://people.mech.kuleuven.be/~orocos/pub/devel/rtt/v1.99.4/doc/
>> ie the last beta.
>>
>>> I'm struggling with the TemplateIndexTypeInfo struct now, which
>>> apparently is not in RTT 2.0 anymore. Is it replaced by
>>> SequenceTypeInfo?
>>
>> Yes. std::vector<T> can be put in a SequenceTypeInfo, and all should work
>> out of the box, given that T is also known to the type system (use
>> StructTypeInfo or
>> TemplateTypeInfo or any of the other templates according to the needs of T)
>
> I used to pass a RangeIndexChecker to the struct, do I still need to
> take care of this myself or does the SequenceTypeInfo checks the range
> already?

The stdvector_index struct and get_size are removed in RTT 2.0? Is
there another functionality implemented for this?

>
> Steven
>
>>
>> Peter
>>
>