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:

 subbag = bag.getProperty("Trans_Vel");

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:
>
>

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

>
> 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.:

add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );

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.:
>

> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
> 

>
> 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.:
>>

>> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
>> 

>>
>> 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:

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

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.:
>>>

>>> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
>>> 

>>>
>>> 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:
>
>

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

>
> 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.:
>>>>

>>>> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
>>>> 

>>>>
>>>> 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.:
>>>>>

>>>>> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
>>>>> 

>>>>>
>>>>> 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.:
>>>>>>

>>>>>> add( newBinaryOperator( "[]", stdvector_index<Frame>() ) );
>>>>>> 

>>>>>>
>>>>>> 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
>>
>