Convert Protobuf Message to ROS Message
Hi,
i just got the issue, that my incoming message (via an external libary) is in Protobuf 2.5 format.
i got those .proto files and let them generate in catkin_make
now i need a gateway function cause already existing nodes need the data as ros message those are generated via the .msg files
the .proto files have the same internal stuff than the .msg file
as example the .proto file:
package Grid
message MsgExample
{
optional float f_A = 10 [default = - 66666.0];
optional float f_B = 20 [default = - 55555.0];
optional int32 i_A = 1 [default = 0];
and my ros message looks like:
#MsgExample
float32 f_A
float32 f_B
int32 i_A
is it possible to directly copy the to each other?
not only one by one, cause in some cases these are really big number of different variables inside of a message.
at the moment i have to do for every message
ros_message::MsgExample myRosMessage;
Grid::MsgExample myProtoMessage
// this data i get from a callback (not important for my question where the data coming from)
myRosMessage.f_A = myProtoMessage .f_a();
myRosMessage.f_B = myProtoMessage .f_b();
myRosMessage.i_A = myProtoMessage .i_a();
to publish the ros message later
is need something to directy publish the protobuf message as ros message or to only do it with one operation like
myRosMessage = myProtoMessage
is this possible?
thanks for your help and intrest best regards Rene Gaertner