Using orogen generated typekit with typegen

Ruben Smits <[email protected]> Thu, 16 Apr 2015 12:16:47 +0200
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <CAN8Phbkd9wQA8p01JAff6aKBC=5yncxBBoKtXdxqq1HMtNSVAQ@mail.gmail.com>
--===============0083565015==
Content-Type: multipart/alternative; boundary=20cf301d3cf424de310513d4c477

--20cf301d3cf424de310513d4c477
Content-Type: text/plain; charset=UTF-8

Hi all,

In a first orocos package I'm trying to use a boost::posix_time::ptime as
part of one of my structs.

Since orogen/typegen/gccxml cannot interprete this type, I've created a
second package that contains a typekit generated with orogen that uses
Opaques and wrapper types to handle this. That typekit happily builds in
it's own package, I can start the deployer and use this type. So far so
good.

Now in my first package I'm using typegen to generate the typekit of the
first package structs (using boost::posix_time::ptime):

orocos_typegen_headers(Structs.hpp DEPENDS orocos_kdl
test-typekit-${OROCOS_TARGET})

This executes something similar like this:
typegen --output=/tmp --import=orocos_kdl --import=test-typekit-gnulinux
foo Structs.hpp

and results in the following error:
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1242:in
`orogen_include_of_type': undefined method `<=' for nil:NilClass
(NoMethodError)
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1270:in
`compute_orogen_include_on_type'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:714:in
`rescue in find_type'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:710:in
`find_type'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1496:in
`block in normalize_registry'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1494:in
`each'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1494:in
`normalize_registry'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1859:in
`generate'
from /home/rsmits/orocos_ws/install_isolated/bin/typegen:116:in `<main>'

I've instrumented typelib a little bit to start debugging:

diff --git a/typelib/registry.cc b/typelib/registry.cc
index a986566..2ec3273 100644
--- a/typelib/registry.cc
+++ b/typelib/registry.cc
@@ -293,6 +293,7 @@ namespace Typelib

     const Type* Registry::get(const std::string& name) const
     {
+        std::cout<<"Getting type of "<<name<<std::endl;
         NameMap::const_iterator it = m_current.find(name);
         if (it != m_current.end())
             return it->second.type;
@@ -323,6 +324,7 @@ namespace Typelib

     void Registry::add(std::string const& name, Type* new_type, bool
persistent, std::string const& s
     {
+        std::cout<<"Adding type "<<name<<std::endl;
         if (! isValidTypename(name, true))
             throw BadName(name);

And I see that the types from my orogen generated typekit are definitely
loaded:

...
Getting type of /boost/posix_time/ptime
Getting type of /boost/posix_time/ptime
Getting type of /boost/posix_time/ptime
Adding type /boost/posix_time/ptime
Getting type of /boost/posix_time/ptime
Getting type of /boost/posix_time/ptime
Adding type /boost/posix_time/ptime
Getting type of /boost/posix_time/ptime
Getting type of /boost/posix_time/time_duration
Getting type of /boost/posix_time/time_duration
Getting type of /boost/posix_time/time_duration
Adding type /boost/posix_time/time_duration
Getting type of /boost/posix_time/time_duration
Getting type of /boost/posix_time/time_duration
Adding type /boost/posix_time/time_duration
Getting type of /boost/posix_time/time_duration
...

I have no idea what the problem is here.

As a second trial I tried to generate the typekit with orogen instead:

*big_mockup.orogen:*
````
name 'big_mockup'
version '0.1'

import_types_from 'test'

import_types_from "Structs.hpp"
````

Again I see that my boost time typekit get's loaded, it even detects that
it should use the wrapper type somehow but than this happens:
And now I get a different error:

===== Internal error =======
Please report the following error to the orogen developers
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/typelib/registry.rb:54:in
`do_minimal': there is not type '/wrappers/Time' in this registry
(RuntimeError)
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/typelib/registry.rb:54:in
`minimal'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1496:in
`block in normalize_registry'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1494:in
`each'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1494:in
`normalize_registry'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1859:in
`generate'
from
/home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/project.rb:676:in
`generate'
from /home/rsmits/orocos_ws/install_isolated/bin/orogen:171:in `<main>'


I'm using the toolchain-2.8 branches of typelib (based on master at
68658739 ) and orogen (based on master 9bb6ed8901da2d)

Could someone shed a light on this?

R.

-- 
Ruben Smits, Roboticist - Founder
+32 479 511 786
Intermodalics - Kapeldreef 60, 3001 Heverlee - BELGIUM
www.intermodalics.eu

--20cf301d3cf424de310513d4c477
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi all,<div><br></div><div>In a first orocos package I&#39=
;m trying to use a boost::posix_time::ptime as part of one of my structs.=
=C2=A0</div><div><br></div><div>Since orogen/typegen/gccxml cannot interpre=
te this type, I&#39;ve created a second package that contains a typekit gen=
erated with orogen that uses Opaques and wrapper types to handle this. That=
 typekit happily builds in it&#39;s own package, I can start the deployer a=
nd use this type. So far so good.</div><div><br></div><div>Now in my first =
package I&#39;m using typegen to generate the typekit of the first package =
structs (using boost::posix_time::ptime):</div><div><br></div><div>orocos_t=
ypegen_headers(Structs.hpp DEPENDS orocos_kdl test-typekit-${OROCOS_TARGET}=
)</div><div><br></div><div>This executes something similar like this:</div>=
<div>typegen --output=3D/tmp --import=3Dorocos_kdl --import=3Dtest-typekit-=
gnulinux foo Structs.hpp<br></div><div><br></div><div>and results in the fo=
llowing error:</div><div><div>/home/rsmits/orocos_ws/install_isolated/lib/r=
uby/1.9.1/orogen/gen/typekit.rb:1242:in `orogen_include_of_type&#39;: undef=
ined method `&lt;=3D&#39; for nil:NilClass (NoMethodError)</div><div><span =
class=3D"" style=3D"white-space:pre">	</span>from /home/rsmits/orocos_ws/in=
stall_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1270:in `compute_orogen=
_include_on_type&#39;</div><div><span class=3D"" style=3D"white-space:pre">=
	</span>from /home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/=
gen/typekit.rb:714:in `rescue in find_type&#39;</div><div><span class=3D"" =
style=3D"white-space:pre">	</span>from /home/rsmits/orocos_ws/install_isola=
ted/lib/ruby/1.9.1/orogen/gen/typekit.rb:710:in `find_type&#39;</div><div><=
span class=3D"" style=3D"white-space:pre">	</span>from /home/rsmits/orocos_=
ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1496:in `block in =
normalize_registry&#39;</div><div><span class=3D"" style=3D"white-space:pre=
">	</span>from /home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/oroge=
n/gen/typekit.rb:1494:in `each&#39;</div><div><span class=3D"" style=3D"whi=
te-space:pre">	</span>from /home/rsmits/orocos_ws/install_isolated/lib/ruby=
/1.9.1/orogen/gen/typekit.rb:1494:in `normalize_registry&#39;</div><div><sp=
an class=3D"" style=3D"white-space:pre">	</span>from /home/rsmits/orocos_ws=
/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1859:in `generate&#3=
9;</div><div><span class=3D"" style=3D"white-space:pre">	</span>from /home/=
rsmits/orocos_ws/install_isolated/bin/typegen:116:in `&lt;main&gt;&#39;</di=
v></div><div><br></div><div>I&#39;ve instrumented typelib a little bit to s=
tart debugging:</div><div><br></div><div><div>diff --git a/typelib/registry=
.cc b/typelib/registry.cc</div><div>index a986566..2ec3273 100644</div><div=
>--- a/typelib/registry.cc</div><div>+++ b/typelib/registry.cc</div><div>@@=
 -293,6 +293,7 @@ namespace Typelib</div><div>=C2=A0</div><div>=C2=A0 =C2=
=A0 =C2=A0const Type* Registry::get(const std::string&amp; name) const</div=
><div>=C2=A0 =C2=A0 =C2=A0{</div><div>+ =C2=A0 =C2=A0 =C2=A0 =C2=A0std::cou=
t&lt;&lt;&quot;Getting type of &quot;&lt;&lt;name&lt;&lt;std::endl;</div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0NameMap::const_iterator it =3D m_curre=
nt.find(name);</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (it !=3D m_cu=
rrent.end())=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0return it-&gt;second.type;</div><div>@@ -323,6 +324,7 @@ namespace Typel=
ib</div><div>=C2=A0</div><div>=C2=A0 =C2=A0 =C2=A0void Registry::add(std::s=
tring const&amp; name, Type* new_type, bool persistent, std::string const&a=
mp; s</div><div>=C2=A0 =C2=A0 =C2=A0{</div><div>+ =C2=A0 =C2=A0 =C2=A0 =C2=
=A0std::cout&lt;&lt;&quot;Adding type &quot;&lt;&lt;name&lt;&lt;std::endl;<=
/div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (! isValidTypename(name, tru=
e))</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0throw BadName=
(name);</div></div><div><br></div><div>And I see that the types from my oro=
gen generated typekit are definitely loaded:</div><div><br></div><div>...</=
div><div><div>Getting type of /boost/posix_time/ptime</div><div>Getting typ=
e of /boost/posix_time/ptime</div><div>Getting type of /boost/posix_time/pt=
ime</div><div>Adding type /boost/posix_time/ptime</div><div>Getting type of=
 /boost/posix_time/ptime</div><div>Getting type of /boost/posix_time/ptime<=
/div><div>Adding type /boost/posix_time/ptime</div><div>Getting type of /bo=
ost/posix_time/ptime</div><div>Getting type of /boost/posix_time/time_durat=
ion</div><div>Getting type of /boost/posix_time/time_duration</div><div>Get=
ting type of /boost/posix_time/time_duration</div><div>Adding type /boost/p=
osix_time/time_duration</div><div>Getting type of /boost/posix_time/time_du=
ration</div><div>Getting type of /boost/posix_time/time_duration</div><div>=
Adding type /boost/posix_time/time_duration</div><div>Getting type of /boos=
t/posix_time/time_duration</div></div><div>...</div><div><br></div><div>I h=
ave no idea what the problem is here.</div><div><br></div><div>As a second =
trial I tried to generate the typekit with orogen instead:</div><div><br></=
div><div><div><u>big_mockup.orogen:</u></div><div>````</div><div>name &#39;=
big_mockup&#39;</div><div>version &#39;0.1&#39;</div><div><br></div><div>im=
port_types_from &#39;test&#39;</div><div><br></div><div>import_types_from &=
quot;Structs.hpp&quot;</div></div><div>````</div><div><br></div><div>Again =
I see that my boost time typekit get&#39;s loaded, it even detects that it =
should use the wrapper type somehow but than this happens:</div><div>And no=
w I get a different error:</div><div><br></div><div><div>=3D=3D=3D=3D=3D In=
ternal error =3D=3D=3D=3D=3D=3D=3D</div><div>Please report the following er=
ror to the orogen developers</div><div>/home/rsmits/orocos_ws/install_isola=
ted/lib/ruby/1.9.1/typelib/registry.rb:54:in `do_minimal&#39;: there is not=
 type &#39;/wrappers/Time&#39; in this registry (RuntimeError)</div><div><s=
pan class=3D"" style=3D"white-space:pre">	</span>from /home/rsmits/orocos_w=
s/install_isolated/lib/ruby/1.9.1/typelib/registry.rb:54:in `minimal&#39;</=
div><div><span class=3D"" style=3D"white-space:pre">	</span>from /home/rsmi=
ts/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1496:in =
`block in normalize_registry&#39;</div><div><span class=3D"" style=3D"white=
-space:pre">	</span>from /home/rsmits/orocos_ws/install_isolated/lib/ruby/1=
.9.1/orogen/gen/typekit.rb:1494:in `each&#39;</div><div><span class=3D"" st=
yle=3D"white-space:pre">	</span>from /home/rsmits/orocos_ws/install_isolate=
d/lib/ruby/1.9.1/orogen/gen/typekit.rb:1494:in `normalize_registry&#39;</di=
v><div><span class=3D"" style=3D"white-space:pre">	</span>from /home/rsmits=
/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/typekit.rb:1859:in `g=
enerate&#39;</div><div><span class=3D"" style=3D"white-space:pre">	</span>f=
rom /home/rsmits/orocos_ws/install_isolated/lib/ruby/1.9.1/orogen/gen/proje=
ct.rb:676:in `generate&#39;</div><div><span class=3D"" style=3D"white-space=
:pre">	</span>from /home/rsmits/orocos_ws/install_isolated/bin/orogen:171:i=
n `&lt;main&gt;&#39;</div></div><div><br></div><div><br></div><div>I&#39;m =
using the toolchain-2.8 branches of typelib (based on master at 68658739 ) =
and orogen (based on master 9bb6ed8901da2d)</div>

<div><br></div><div>Could someone shed a light on this?</div><div><br></div=
><div>R.<br clear=3D"all"><div><br></div>-- <br><div class=3D"gmail_signatu=
re"><div dir=3D"ltr"><div><div dir=3D"ltr">Ruben Smits, Roboticist - Founde=
r<br>+32 479 511 786<br>Intermodalics - Kapeldreef 60, 3001 Heverlee - BELG=
IUM<br><a href=3D"http://www.intermodalics.eu" target=3D"_blank">www.interm=
odalics.eu</a><br></div></div></div></div>
</div></div>

--20cf301d3cf424de310513d4c477--

--===============0083565015==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============0083565015==--