<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi,</p>
<p>Typelib cannot serialize private data or special data types etc,
only POD types.<br>
</p>
<p>The standard way to solve this would be using opaque types, where
you specify another (POD) type where the data is copied to and
which is then send via port.<br>
</p>
<p>This involves a copy (no memory allocation) from the internal
type to the type actually send and vice versa. (see
<a class="moz-txt-link-freetext" href="https://github.com/rock-core/base-orogen-types/blob/master/base.orogen">https://github.com/rock-core/base-orogen-types/blob/master/base.orogen</a>
as a reference), but this is quite similar to a custom
serialization in the end, but then the newly filled struct is
serialized again by typelib.<br>
</p>
<p>When you don't need introspection on port data level (aka. look
at values using rock-display) you also have the option to send
custom serialized data using /std/vector<char> as type for
the port and serialize manually. But doing this you loose type
savety on port connection level.<br>
</p>
<p>I'd go for using opaques with structs that contain a
std::vector<uint8_t> as data buffer for each
(self-)serialized type and perhaps some meta-information for
rock-display and then use custom serialization to fill the buffer.
By using one struct per type you can keep type savety for
connections and also minimize copying data as each value in the
struct is only serialized once some by typekit and some by your
serialization (Execpt perhaps additional metadata for
rock-display).</p>
<p>If you have a lot of types affected, have a look on Saschas
approach on using a opaque generating orogen plugin. The plugin
automatically generates opaques using boost serialization, the
transport type is type serialized by typekit, but has a large
binary buffer, so the serialization for typekit is minimal and the
boost serialization data had not to be serialized again.
</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/envire/envire-orogen-envire_orogen">https://github.com/envire/envire-orogen-envire_orogen</a></p>
<p>used here:<br>
</p>
<p>
</p>
<p><a class="moz-txt-link-freetext" href="https://github.com/envire/envire-orogen-envire_maps/blob/master/envire_maps.orogen">https://github.com/envire/envire-orogen-envire_maps/blob/master/envire_maps.orogen</a></p>
<p>When using custom serialization and you need introspection you
can still write vizkit plugins for the port type and do a
de-serialization in the visualizer, only the "off the shelf
vizualization" with rock-dispaly doesn't work.<br>
</p>
<p>Hope you are well,</p>
<p>Steffen<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 08.03.21 um 18:59 schrieb Goldhoorn
Matthias (XC-AD/EFB1-NA):<br>
</div>
<blockquote type="cite"
cite="mid:71b45bc57f3b7c4076dc63acb1d568a45ed7eb5b.camel@bosch.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<div>Hello Rock-Devs,</div>
<div><br>
</div>
<div>long time not seen :).</div>
<div>I currently play around with typekit and orogen in one of our
projects.</div>
<div>I did the basic build system integration and if we continue
using it, i might need to extend orogen (castxml handling) with
cmake support soon, but this is a differnt story.</div>
<div><br>
</div>
<div>So, I currently struggle to create bindings/serialization
helper for some special types we use:</div>
<div><br>
</div>
<div>1) Typelib[WARN]:
/home/a/workspace/athena/build/vfc/include/vfc/memory/vfc_fixedblock_allocator.hpp:198:
cannot create the
/vfc/TFixedBlockAllocator<SOMETHING>/storage_type typedef,
as it points to which is ignored</div>
<div>2) Typelib[WARN]:
/home/a/workspace/athena/build/vfc/include/vfc/memory/vfc_fixedblock_allocator.hpp:89:
ignoring /vfc/TFixedBlockAllocator<SOMETHING,200> since
its field m_memblock is of the ignored type
/vfc/TFixedBlockAllocator<SOMETHING,200>/storage_type</div>
<div>3) Typelib[WARN]:
/home/a/workspace/athena/build/vfc/include/vfc/container/vfc_fixedvector.hpp:453:
ignoring
/vfc/TFixedVector<SOMETHING,200,SOMETHING,200>>/storage_type
as it has a non-public access specifier: private</div>
<div>4) Typelib[WARN]:
/home/a/workspace/athena/build/vfc/include/vfc/container/vfc_fixedvector.hpp:93:
ignoring
/vfc/TFixedVector<SOMETHING,200,/vfc/TFixedBlockAllocator<SOMETHING,200>>
since its field m_memory is of the ignored type
/vfc/TFixedVector<SOMETHING,200,/vfc/TFixedBlockAllocator<SOMETHING,200>>/storage_type</div>
<div><br>
</div>
<div>And i see several issues in:</div>
<div>1) there is a "points to <MISSING?> which is ignored"
so obvisously here is something wrong in the error message (and
i havwe to trace down the /storage_type which i have no clue
where its comming from</div>
<div>2,3) private fields, normal error, see below....</div>
<div>4) simliar to one </div>
<div><br>
</div>
<div>To solve the issues I thought provide a own
serialization/deserialization method to prevent the usage inside
RTT.</div>
<div><br>
</div>
<div>I wanted to go for a "specialize" of the types. However
adding the the following specialize to my .orogen project:</div>
<div><br>
</div>
<hr size="2" noshade="noshade" align="left">
<div style="margin-left: 3ch;">
<pre>Typelib.specialize '/vfc/TFixedBlockAllocator<>' do</pre>
</div>
<pre> include Typelib::ContainerType::StdVector #something should hopefully not YET madder, to be written later</pre>
<pre> end</pre>
<pre>
</pre>
<pre> Typelib.specialize '/vfc/TFixedVector<>' do</pre>
<pre> include Typelib::ContainerType::StdVector #something should hopefully not YET madder, to be written later</pre>
<pre> end</pre>
<div><br>
</div>
<hr size="2" noshade="noshade" align="left">
<div>does not have any effect. Same as if i would add it to
typelib directly:</div>
<div><br>
</div>
<div style="margin-left: 3ch;"><br>
<hr size="2" noshade="noshade" align="left">
<pre>diff --git a/bindings/ruby/lib/typelib/standard_convertions.rb b/bindings/ruby/lib/typelib/standard_convertions.rb</pre>
<pre>index fb3e3fb..f917070 100644</pre>
<pre>--- a/bindings/ruby/lib/typelib/standard_convertions.rb</pre>
<pre>+++ b/bindings/ruby/lib/typelib/standard_convertions.rb</pre>
<pre>@@ -59,6 +59,10 @@ def concat(other_string)</pre>
<pre> include Typelib::ContainerType::StdVector</pre>
<pre> end</pre>
<pre> </pre>
<pre>+ specialize '/vfc/TFixedVector<>' do</pre>
<pre>+ include Typelib::ContainerType::FixedVector #something should hopefully not YET madder, to be written later</pre>
<pre>+ end</pre>
<pre>+</pre>
<pre> ####</pre>
<pre> # C string handling</pre>
<pre> if String.instance_methods.include? :ord</pre>
<div><br>
</div>
<hr size="2" noshade="noshade" align="left">
</div>
<div><br>
</div>
<div>So my questions are:</div>
<div>* Since i am out of rock, am i going the right way, why the
specialize is not taken into account?</div>
<div>** Cant it bypass the private fields, do i have to change my
underlaying core datatypes (if so are there other ways which are
copy free?, I would like to prevent going down this path)</div>
<div>* Can I prevent a copy this way, or will the data strucutres
be copied if i go for a "specialize"?I</div>
<div>Thanks for your help</div>
<div><br>
</div>
<div>Best and stay safe,</div>
<div>Matthias</div>
<div style="margin-left: 3ch;">
<div style="margin-left: 3ch;">
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Rock-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Rock-dev@dfki.de">Rock-dev@dfki.de</a>
<a class="moz-txt-link-freetext" href="https://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev">https://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Steffen Planthaber
Besuchsadresse der Nebengeschäftstelle:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany
Postadresse der Hauptgeschäftsstelle Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 1
28359 Bremen, Germany
Tel.: +49 421 178 45-4125
Zentrale: +49 421 178 45-0
Fax: +49 421 178 45-4150 (Faxe bitte namentlich kennzeichnen)
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:Steffen.Planthaber@dfki.de">Steffen.Planthaber@dfki.de</a>
Weitere Informationen: <a class="moz-txt-link-freetext" href="http://www.dfki.de/robotik">http://www.dfki.de/robotik</a>
-------------------------------------------------------------
Deutsches Forschungszentrum für Künstliche Intelligenz GmbH
Trippstadter Strasse 122, 67663 Kaiserslautern, Germany
Geschäftsführung:
Prof. Dr. Antonio Krüger
Vorsitzender des Aufsichtsrats:
Dr. Gabriël Clemens
Amtsgericht Kaiserslautern, HRB 2313
-------------------------------------------------------------</pre>
</body>
</html>