[Rock-dev] weired typelib related error

Janosch Machowinski Janosch.Machowinski at dfki.de
Fri Jun 8 11:27:27 CEST 2012


On 04.06.2012 10:53, Sylvain Joyeux wrote:
> On 06/01/2012 01:28 PM, Janosch Machowinski wrote:
>> Hey,
>> I get an error in case I try to access an uninitialized map of
>> Base::Spline from ruby:
>> /home/scotch/rock1.9/base/types_ruby/lib/base/typelib_plugin.rb:50:in
>> `initialize': dimension must be strictly positive (RuntimeError)
>>           from
>> /home/scotch/rock1.9/base/types_ruby/lib/base/typelib_plugin.rb:50:in 
>> `new'
>>           from
>> /home/scotch/rock1.9/base/types_ruby/lib/base/typelib_plugin.rb:50:in
>> `block in<top (required)>'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:2589:in `to_ruby'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1388:in `block in
>> each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1379:in `block in
>> raw_each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1378:in `times'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1378:in 
>> `raw_each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1387:in `each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1421:in `map'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1421:in `block in
>> extend_for_custom_convertions'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:2589:in `to_ruby'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1228:in 
>> `get_field'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1039:in `block (3
>> levels) in custom_convertion_module'
>>           from
>> /home/scotch/rock1.9/install/share/typelib/ruby/corridor_plan.rb:105:in
>> `block in split'
>>           from
>> /home/scotch/rock1.9/install/share/typelib/ruby/corridor_plan.rb:97:in
>> `times'
>>           from
>> /home/scotch/rock1.9/install/share/typelib/ruby/corridor_plan.rb:97:in
>> `split'
>>           from
>> /home/scotch/rock1.9/install/share/typelib/ruby/corridor_plan.rb:136:in
>> `block in split_annotation_segments'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1727:in `block in
>> each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1726:in `do_each'
>>           from
>> /home/scotch/rock1.9/install/lib/ruby/1.9.1/typelib.rb:1726:in `each'
>>           from
>> /home/scotch/rock1.9/install/share/typelib/ruby/corridor_plan.rb:127:in
>> `split_annotation_segments'
>>           from ./filter_plan:213:in `filter_plan'
>>           from ./filter_plan:256:in `<main>'
>>
>> The error message actually comes from the constructor of 
>> base::SplineBase.
>> The give 'value' parameter to
>> /home/scotch/rock1.9/base/types_ruby/lib/base/typelib_plugin.rb:50
>> is :
>> {
>>     geometric_resolution=0.0,
>>     dimension=0,
>>     curve_order=0,
>>     kind=:DEGENERATE,
>>     knots=[
>>
>>     ],
>>     vertices=[
>>
>>     ]}
>>
>> The problem is that dimension is zero. My problem now is that I have 
>> no idea
>> who generates the 'value' and why it is non valid.
>> As a workaround I just force dimension to one in typelib_plugin.rb which
>> works,
>> but is obviously the wrong fix.
>> Any ideas ?
>
> You are trying to access, from Ruby, a typelib value that never got 
> properly initialized. Since typelib values are simply storing data, 
> they have no validation. However, once you try to access it from ruby, 
> it gets converted to the Spline / Spline3 class which does validate 
> (and in your case fails).
>
> If you want to create a new spline in Ruby, just use 
> Base::Geometry::Spline.new and/or Base::Geometry::Spline3.new.
>
> The fact that one cannot define an initializer for typelib values is a 
> missing feature ...
>
> Sylvain

I would like to point out, that this is your code and that I can not 
'control' the creation of the spline.
It randomly fails at
11:16:30.059 (Roby)   
/home/imoby/dev-m3/install/share/typelib/ruby/corridor_plan.rb:100:in 
`block in split',
The problem is the access of new_corridor.boundary_curves it seems that 
as soon as one tries to assign
a value to it the constructor for the spline gets called. Which is 
weired, boundary_curves is a static array,
the elements should be constructed when new_corridor gets constructed.
     Janosch


-- 
  Dipl. Inf. Janosch Machowinski
  SAR-&  Sicherheitsrobotik

  DFKI Bremen
  Robotics Innovation Center
  Robert-Hooke-Straße 5
  28359 Bremen, Germany

  Phone: +49 (0)421 178 45-6614
  Fax:   +49 (0)421 178 45-4150
  E-Mail: robotik at dfki.de

  Weitere Informationen: http://www.dfki.de/robotik
  -----------------------------------------------------------------------
  Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
  Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
  Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
  (Vorsitzender) Dr. Walter Olthoff
  Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
  Amtsgericht Kaiserslautern, HRB 2313
  Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
  USt-Id.Nr.:    DE 148646973
  Steuernummer:  19/673/0060/3
  -----------------------------------------------------------------------



More information about the Rock-dev mailing list