Skip to content

blob provides a new message type blob/Blob for binary data.

Notifications You must be signed in to change notification settings

CodeFinder2/blob_tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blob_tools

blob_tools provides a new message type blob_tools/Blob for binary data.

Currently, only roscpp is supported. Other client libraries like rospy will serialize/deserialize blob data as uint8[], as defined in the message definition.

This can also be used to have union-like message fields where one field of type is blob_tools/Blob can be any valid ROS message type (including custom types) and the type must be remembered in an additonal member, e.g.:

blob_tools/Blob data # either a 'string' or a 'uint32', stored in 'type'

uint8 type # either TYPE_STRING or TYPE_UINT32
uint8 TYPE_STRING = 1
uint8 TYPE_UINT32 = 2

Installation

cd your_catkin_ws/src
git clone [email protected]:CodeFinder2/blob_tools.git

Usage Example

MyMessage.msg:

blob_tools/Blob map_blob      # a serialized (and compressed) nav_msgs/OccupancyGridMap

Publisher:

{
    ...
    MyMessage temp;
    nav_msgs::OccupancyGridMap my_map;
    ...
    temp.map_blob.serialize(my_map);
    temp.map_blob.setCompressed(true); // enable bzip2 compression (apt install libbz2-dev)
    ...
    publisher.publish(temp);
}

Subscriber:

void callback(const MyMessageConstPtr &msg)
{
    // WARNING: instantiation of the "wrong" data type may result in non-sense data and/or StreamOverrunExceptions
    // blob/Blob is not type-safe!
    nav_msgs::OccupancyGridMapPtr my_map = msg->map_blob.instantiate<nav_msgs::OccupancyGridMap>();

    if (my_map) {
        ....
    }
}

About

blob provides a new message type blob/Blob for binary data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 94.8%
  • CMake 5.2%