[Rock-dev] Typelib Marshaling
Janosch Machowinski
Janosch.Machowinski at dfki.de
Tue Sep 1 17:12:00 CEST 2015
I'm really puzzled about this one..
I already took a look into the rtt_typelib package.
The correct thing seems to be to call
handle.transport->setTypelibSample(handle.transportHandle,
sample.data.data(), false);
but the it gives me a std:bad_alloc when it tries to
allocate the 'typlib' type (in this case base::samples::Frame) in
orogen_transports::OpaqueTypelibMarshaller<base::samples::frame::Frame,
RTT::extras::ReadOnlyPointer<base::samples::frame::Frame>,
0>::setTypelibSample(orogen_transports::TypelibMarshallerBase::Handle*,
unsigned char*, bool)
Any Ideas ?
Janosch
Am 01.09.2015 um 15:16 schrieb Sylvain Joyeux:
> Have a look at opaque handling in the mqueue transport, that should
> show you how to do it.
>
> Sylvain
>
> On Tue, Sep 1, 2015 at 9:16 AM, Janosch Machowinski
> <Janosch.Machowinski at dfki.de <mailto:Janosch.Machowinski at dfki.de>> wrote:
>
> Hey,
> we are using the typelib marshaler to implement a
> second network transport. For Mashaling we use this code :
> while (static_cast<RTT::base::InputPortInterface
> *>(handle.port)->read(handle.sample, false) == RTT::NewData)
> gotNewData = true;
>
> if (gotNewData) {
> Communication::DataContainer data;
>
> handle.transport->refreshTypelibSample(handle.transportHandle);
> handle.transport->marshal(data.buffer,
> handle.transportHandle);
> which works fine.
>
> In case that the port contains a RoPtr<base::samples::Frame> we get an
> std::bad_alloc on
> unmashaling using this code :
>
> handle.transport->unmarshal(data.buffer,
> handle.transportHandle);
>
> The Handle here looks like this :
> class PortHandle
> {
> public:
> std::string name;
> orogen_transports::TypelibMarshallerBase *transport;
> RTT::base::DataSourceBase::shared_ptr sample;
> orogen_transports::TypelibMarshallerBase::Handle
> *transportHandle;
> RTT::base::PortInterface *port;
> };
> And is set up using this code :
> RTT::types::TypeInfo const *type = port->getTypeInfo();
> curHandle.transport =
> dynamic_cast<orogen_transports::TypelibMarshallerBase
> *>(type->getProtocol(orogen_transports::TYPELIB_MARSHALLER_ID));
> if (! curHandle.transport) {
> return false;
> }
>
> curHandle.transportHandle =
> curHandle.transport->createSample();
> curHandle.sample =
> curHandle.transport->getDataSource(curHandle.transportHandle);
>
> Any ideas what is wrong ? I suspect, that I need to initialize the
> orocos sample somehow on the
> receiving end, before unmarhsaling the data...
> Greetings
> Janosch
>
> --
> Dipl. Inf. Janosch Machowinski
> SAR- & Sicherheitsrobotik
>
> Universität Bremen
> FB 3 - Mathematik und Informatik
> AG Robotik
> Robert-Hooke-StraÃe 1
> 28359 Bremen, Germany
>
> Zentrale: +49 421 178 45-6611 <tel:%2B49%20421%20178%2045-6611>
>
> Besuchsadresse der Nebengeschäftstelle:
> Robert-Hooke-StraÃe 5
> 28359 Bremen, Germany
>
> Tel.: +49 421 178 45-6614 <tel:%2B49%20421%20178%2045-6614>
> Empfang: +49 421 178 45-6600 <tel:%2B49%20421%20178%2045-6600>
> Fax: +49 421 178 45-4150 <tel:%2B49%20421%20178%2045-4150>
> E-Mail: jmachowinski at informatik.uni-bremen.de
> <mailto:jmachowinski at informatik.uni-bremen.de>
>
> Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
>
> _______________________________________________
> Rock-dev mailing list
> Rock-dev at dfki.de <mailto:Rock-dev at dfki.de>
> http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev
>
>
--
Dipl. Inf. Janosch Machowinski
SAR- & Sicherheitsrobotik
Universität Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-StraÃe 1
28359 Bremen, Germany
Zentrale: +49 421 178 45-6611
Besuchsadresse der Nebengeschäftstelle:
Robert-Hooke-StraÃe 5
28359 Bremen, Germany
Tel.: +49 421 178 45-6614
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
E-Mail: jmachowinski at informatik.uni-bremen.de
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
-------------- nächster Teil --------------
Ein Dateianhang mit HTML-Daten wurde abgetrennt...
URL: http://www.dfki.de/pipermail/rock-dev/attachments/20150901/15c1ec8b/attachment-0001.htm
More information about the Rock-dev
mailing list