orocos-toolchain / orogen

Code generator for components and type handling in Rock - the Robot Construction Kit - and the Orocos Toolchain
http://rock-robotics.org
Other
4 stars 35 forks source link

Overwritten TypeInfo for standard types? #25

Closed meyerj closed 5 years ago

meyerj commented 9 years ago

Some standard types from the RTT typekit (bool, int, float, double etc.) do not print anymore in the TaskBrowser after a typekit generated by typegen has been imported.

Example:

Deployer [S]> var bool b1
 = false               

Deployer [S]> var int i1
 = 0                   

Deployer [S]> import("foo")
4.473 [ Info   ][Thread] Creating Thread for scheduler=ORO_SCHED_OTHER, priority=1, CPU affinity=0, with name='GlobalEngine'
4.473 [ Debug  ][Thread] Setting CPU affinity to 0
4.473 [ Info   ][GlobalEngine] Thread created with scheduler type 'ORO_SCHED_OTHER', priority 0, cpu affinity 15 and period 0 (PID= 29398 ).
4.474 [ Info   ][ComponentLoader::import(path_list)] Importing directory foo ...
4.474 [ Debug  ][ComponentLoader::import(path_list)] Scanning file foo/include ...not a regular file: ignored.
4.474 [ Debug  ][ComponentLoader::import(path_list)] Scanning file foo/src ...not a regular file: ignored.
4.474 [ Debug  ][ComponentLoader::import(path_list)] Scanning file foo/package.xml ...not a .so library: ignored.
4.474 [ Debug  ][ComponentLoader::import(path_list)] Scanning file foo/CMakeLists.txt ...not a .so library: ignored.
4.474 [ Debug  ][ComponentLoader::import(path_list)] Looking for plugins or typekits in directory foo ...
4.474 [ Debug  ][ComponentLoader::import(path_list)] No such directory: "foo/types"
4.474 [ Debug  ][ComponentLoader::import(path_list)] No such directory: "foo/plugins"
4.474 [ Debug  ][ComponentLoader::import(path_list)] No such directory: "foo/gnulinux"
4.474 [ Info   ][ComponentLoader::import(path_list)] Importing directory /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo ...
4.474 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/plugins ...not a regular file: ignored.
4.475 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/libfoo-gnulinux.so ...Succesfully loaded foo
4.475 [ Info   ][ComponentLoader::import(path_list)] Loaded component type 'Foo'
4.475 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types ...not a regular file: ignored.
4.475 [ Debug  ][ComponentLoader::import(path_list)] Looking for plugins or typekits in directory /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo ...
4.475 [ Info   ][ComponentLoader::import(path_list)] Loading typekit libraries from directory /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types ...
4.483 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types/libfoo-transport-mqueue-gnulinux.so ...Found library libfoo-transport-mqueue-gnulinux.so
4.486 [ Info   ][TypekitRepository::Import] Loading Transport MQueue:///orogen/foo.
4.486 [ Debug  ][TypekitRepository::Import] Transport MQueue did not install a fallback handler for 'unknown_t'.
4.486 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT TypeKit/Transport '/orogen/foo/MQueue' from 'foo-transport-mqueue'
4.486 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types/libfoo-transport-typelib-gnulinux.so ...Found library libfoo-transport-typelib-gnulinux.so
4.486 [ Info   ][TypekitRepository::Import] Loading Transport Typelib:///orogen/foo.
4.487 [ Debug  ][TypekitRepository::Import] Transport Typelib did not install a fallback handler for 'unknown_t'.
4.488 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT TypeKit/Transport '/orogen/foo/TYPELIB' from 'foo-transport-typelib'
4.490 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types/libfoo-transport-corba-gnulinux.so ...Found library libfoo-transport-corba-gnulinux.so
4.490 [ Info   ][TypekitRepository::Import] Loading Transport CORBA:///orogen/foo.
4.490 [ Debug  ][TypekitRepository::Import] Transport CORBA did not install a fallback handler for 'unknown_t'.
4.490 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT TypeKit/Transport '/orogen/foo/CORBA' from 'foo-transport-corba'
4.517 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/types/libfoo-typekit-gnulinux.so ...Found library libfoo-typekit-gnulinux.so
4.517 [ Info   ][TypekitRepository::Import] Loading Typekit /orogen/foo.
4.517 [ Debug  ][TypekitRepository::Import] Registered Type '/FooData' to the Orocos Type System.
4.517 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /FooData
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /FooData
4.518 [ Info   ][TypekitRepository::Import] Registered new 'CORBA' transport for /FooData
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/bool' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type bool
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /bool
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /bool
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/double' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type double
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /double
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /double
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/float' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type float
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /float
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /float
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/int16_t' to the Orocos Type System.
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /int16_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /int16_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'CORBA' transport for /int16_t
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/int32_t' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type int
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /int32_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /int32_t
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/std/string' to the Orocos Type System.
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /std/string
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /std/string
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/std/vector</double>' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type array
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /std/vector</double>
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /std/vector</double>
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/uint16_t' to the Orocos Type System.
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /uint16_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /uint16_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'CORBA' transport for /uint16_t
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/uint32_t' to the Orocos Type System.
4.518 [ Debug  ][TypekitRepository::Import] A protocol with id 2 was already added for type uint
4.518 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /uint32_t
4.518 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /uint32_t
4.518 [ Debug  ][TypekitRepository::Import] Registered Type '/uint8_t' to the Orocos Type System.
4.519 [ Info   ][TypekitRepository::Import] Registered new 'MQueue' transport for /uint8_t
4.519 [ Info   ][TypekitRepository::Import] Registered new 'Typelib' transport for /uint8_t
4.519 [ Info   ][TypekitRepository::Import] Registered new 'CORBA' transport for /uint8_t
4.519 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT TypeKit/Transport '/orogen/foo' from 'foo-typekit'
4.519 [ Info   ][ComponentLoader::import(path_list)] Loading plugin libraries from directory /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/plugins ...
4.519 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/plugins/libfoo-plugin-gnulinux.so ...Found library libfoo-plugin-gnulinux.so
Plugin of foo loaded in process.
4.519 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT Plugin 'foo-example-plugin' from 'foo-plugin'
4.520 [ Debug  ][ComponentLoader::import(path_list)] Scanning file /opt/orocos/indigo/tmp/install/lib/orocos/gnulinux/foo/plugins/libfoo-service-gnulinux.so ...Found library libfoo-service-gnulinux.so
4.520 [ Info   ][ComponentLoader::import(path_list)] Loaded RTT Service 'myservice' from 'foo-service'
4.520 [ Info   ][ComponentLoader::import(path_list)] Importing directory ./foo ...
4.520 [ Debug  ][ComponentLoader::import(path_list)] Scanning file ./foo/include ...not a regular file: ignored.
4.520 [ Debug  ][ComponentLoader::import(path_list)] Scanning file ./foo/src ...not a regular file: ignored.
4.520 [ Debug  ][ComponentLoader::import(path_list)] Scanning file ./foo/package.xml ...not a .so library: ignored.
4.520 [ Debug  ][ComponentLoader::import(path_list)] Scanning file ./foo/CMakeLists.txt ...not a .so library: ignored.
4.520 [ Debug  ][ComponentLoader::import(path_list)] Looking for plugins or typekits in directory ./foo ...
4.520 [ Debug  ][ComponentLoader::import(path_list)] No such directory: "./foo/types"
4.520 [ Debug  ][ComponentLoader::import(path_list)] No such directory: "./foo/plugins"
 = (bool)              

Deployer [S]> .types
Available data types:  FooData bool double float int16_t int32_t std.string std.vector<double> uint16_t uint32_t uint8_t ConnPolicy FlowStatus PropertyBag SendHandle SendStatus TaskContext array bool char double float int ints rt_string string strings uint void
Deployer [S]> var bool b2
 = (bool)              

Deployer [S]> var int i2
 = (int)               

Deployer [S]> var string s2
 =                     

Deployer [S]> var std.string s3
 =                     

Deployer [S]>

The typekit is the default typekit generated with orocreate-pkg, where the struct FooData only contains a vector of doubles. I am testing with the current toolchain-2.8 branches of all toolchain repositories.

meyerj commented 9 years ago

@psoetens and I looked into this problem on Wednesday. The printing problem has been fixed in https://github.com/orocos-toolchain/rtt/commit/a4659bb8b06a3e5e200e6501612dbb024a95b716 and https://github.com/orocos-toolchain/rtt/commit/8cc95bc391fe9a48ed0cbfa30670f58f556ffe64. The reason why the values were not printed is that orogen installs the typekit with a TemplateTypeInfo<T, use_stream> with the use_stream parameter set to its default value false and without the patches in rtt the stream factory was therefore overwritten, even if another typekit provides streaming operators.

However, that still does not explain why the typekit generated with the toolchain-2.8 branch (which is based on commit b0c55a10e612e7e9cdcb5e3d6b21db88374ed9e1 in the master branch) registers new TypeInfos for the primitive types /bool, /double and so on. With the latest revision in master merged into toolchain-2.8 (v2.8.0-rc1) the result is different and the typekit only registers the /FooData and /std/vector</double> types, as expected.

There seems to be a difference depending on whether RTT has been compiled with scripting enabled or disabled.