Re: Using orogen generated typekit with typegen

Sylvain Joyeux <[email protected]> Thu, 16 Apr 2015 11:57:32 -0300
Newsgroups gmane.science.robotics.orocos.devel
Message-ID <CAFENT7+8ng8oHtchYrM8D5BxK9Si6o+dwF8Zg21F+saSvW+Hgg@mail.gmail.com>
The first thing I asked myself was "why is it not working there but is
obviously working in Rock"

The answer is: it works if you have a task context using the
opaque-using type in orogen. It fails if you don't. I'll have a look
as to why, but in the meantime, just add

task_context 'Workaround' do
  property 'p0', '/the/type/which/uses/posix/time'
end

to the second orogen project.

2015-04-16 7:16 GMT-03:00 Ruben Smits <[email protected]>:
> 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
>
> --
> Orocos-Dev mailing list
> [email protected]
> http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev
>
-- 
Orocos-Dev mailing list
[email protected]
http://lists.mech.kuleuven.be/mailman/listinfo/orocos-dev