ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I solved the problem:
The ByteArrayMessage::serialize function is called as soon as a subscriber subscribes to the topic published by the GenericPublisher. The publisher than has to write the data from buffer_ to the write_ptr given by the subscriber.
Thus the function looks like this:
const uint8_t* ByteArrayMessage::serialize(uint8_t *write_ptr, uint32_t seq) const
{
ros::serialization::OStream stream(write_ptr, 1000000000);
for (size_t i = 0; i < length_; i++)
{
stream.next(buffer_[i]);
}
return stream.getData();
}
I don't need the Serializer struct.
Thanks for your help!