-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Hi,
I am trying to convert pocolog files to some other format (probably something like MessagePack). In order to do that I read how the CSV output is generated in typelib. I might be wrong but I think there is a bug:
I am trying to read a RigidBodyState from memory in typelib's seralization format. A RigidBodyState consists of a timestamp and two strings at the beginning. Strings are containers of 1 byte signed integers. The following lines are extracted from the XML type definition in the logfile:
<compound name="/base/samples/RigidBodyState_m" size="416" >
<field name="time" type="/base/Time" offset="0">...</field>
<field name="sourceFrame" type="/std/string" offset="8">...</field>
<field name="targetFrame" type="/std/string" offset="16">...</field>
...
</compound>It seems like offset should be an indicator of where the serialized field is stored in the serialized compound. This is not possible, of course, because strings can have any length, even in the same logfile. That alone would be OK, if the real length of a string would be used to compute where the next field starts in the serialized representation of the RigidBodyState. Hoever, this information is not used, instead, the offset will be used directly:
virtual bool visit_ (Compound const& type, Field const& field)
{
m_stack.push_back( m_stack.back() + field.getOffset() );
bool ret = m_visitor.visit_(Value(m_stack.back(), field.getType()), type, field);
m_stack.pop_back();
return ret;
}I don't know how that should work. Do you have any idea? Is there a good way to work around this issue? Is there a way to fix this? I would be happy to contribute.