Converting .bt files

523 views
Skip to first unread message

Christian Dornhege

unread,
Feb 17, 2013, 11:52:54 AM2/17/13
to oct...@googlegroups.com
Hi,

it seems as the .bt file format has changed in time.

I have two files here, a newer one that seems to have a header like:
# Octomap OcTree binary file
# (feel free to add / change comments, but leave the first line as it is!)
#

and an old one with a hex header that seems to start with some int32 id
and a double resolution.


The installed octovis loads both fine. I need to convert the
new style file to the old format to use with my legacy software.

I unsuccessfully tried some hexedit fiddling by just copying the header.

Is there some converter tool to convert between the formats?

Alternatively is there a description of both file formats?
Is only the header changed or also the internal 2 byte node format?

Best regards,
Christian Dornhege

Armin Hornung

unread,
Feb 18, 2013, 4:59:39 AM2/18/13
to oct...@googlegroups.com
Hi Christian,



it seems as the .bt file format has changed in time.

I have two files here, a newer one that seems to have a header like:
# Octomap OcTree binary file
# (feel free to add / change comments, but leave the first line as it is!)
#

and an old one with a hex header that seems to start with some int32 id and a double resolution.

The file format was changed in the 1.4 release (see changelog). The new format is more portable and safer to read/write with an explicit header, while allowing a general Factory-pattern read/write implementation.




The installed octovis loads both fine. I need to convert the
new style file to the old format to use with my legacy software.

I unsuccessfully tried some hexedit fiddling by just copying the header.

Is there some converter tool to convert between the formats?
You can use the "convert_octree" binary, but it only works one-way from the old into the new format, since eventually support for the old one will be dropped. Is there no way to update your legacy code to use OctoMap >= 1.4?




Alternatively is there a description of both file formats?
Is only the header changed or also the internal 2 byte node format?

Have a look at the implementation of AbstractOccupancyOcTree::writeBinaryConst() for the new file format. It's really just a plain-text header with the tree information like class name, size, resolution and then the binary data representing the tree structure.

For the old one, have a look at AbstractOccupancyOcTree::readBinaryLegacyHeader(). The "binary header" in there is an int for the tree id (only "3" works!), a double for the resolution, and an unsigned int for the size. This is directly followed by the binary tree data. The internal 2 byte node format hasn't changed.

I hope that helps!
Armin
-- 
Armin Hornung
Humanoid Robots Lab, Albert-Ludwigs-Universität Freiburg
Contact: http://www.informatik.uni-freiburg.de/~hornunga

Christian Dornhege

unread,
Feb 18, 2013, 7:47:50 AM2/18/13
to oct...@googlegroups.com
Hi Armin,

>> The installed octovis loads both fine. I need to convert the
>> new style file to the old format to use with my legacy software.
>>
>> I unsuccessfully tried some hexedit fiddling by just copying the header.
>>
>> Is there some converter tool to convert between the formats?
> You can use the "convert_octree" binary, but it only works one-way from
> the old into the new format, since eventually support for the old one
> will be dropped. Is there no way to update your legacy code to use
> OctoMap >= 1.4?

Not right now. I'll need to port some features upstream.

>> Alternatively is there a description of both file formats?
>> Is only the header changed or also the internal 2 byte node format?
>
> Have a look at the implementation of
> AbstractOccupancyOcTree::writeBinaryConst() for the new file format.
> It's really just a plain-text header with the tree information like
> class name, size, resolution and then the binary data representing the
> tree structure.
>
> For the old one, have a look at
> AbstractOccupancyOcTree::readBinaryLegacyHeader(). The "binary header"
> in there is an int for the tree id (only "3" works!), a double for the
> resolution, and an unsigned int for the size. This is directly followed
> by the binary tree data. The internal 2 byte node format hasn't changed.
>
> I hope that helps!

Yes! Rewriting the header by hand in a hex editor worked fine. I had
just forgotten about the size before.

Thanks,
Christian


> Armin
>
> --
> Armin Hornung
> Humanoid Robots Lab, Albert-Ludwigs-Universit�t Freiburg
> Contact:http://www.informatik.uni-freiburg.de/~hornunga
>
> --
> You received this message because you are subscribed to the Google
> Groups "OctoMap developers and users discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to octomap+u...@googlegroups.com.
> To post to this group, send email to oct...@googlegroups.com.
> Visit this group at http://groups.google.com/group/octomap?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages