Message size

asked 2014-05-04 17:57:39 -0600

crpizarr gravatar image

updated 2014-05-05 08:13:58 -0600

Is there a way to get the size of a statically defined message (i mean, without lists)? I have something like this:

# msg1.msg
bool var1
uint8 var2

And I want to get (in Python) the size of the message in bytes, which would be 2 (bytes).

I' ve tried with the __sizeof__ method, but it returns 40 instead of 2.

Thanks

edit retag flag offensive close merge delete

Comments

I am having a custom message (uint64 and uint16 (roscpp))..the sizeof() these two is 10 (8+2) which seems pretty ok. But when I print the sizeof() the message is shows 12... Does anybody know how to calculate the sizeof messages and/or where these 2 funny byte's come from? Thanks

mrtwister gravatar image mrtwister  ( 2016-02-20 12:50:20 -0600 )edit

mrtwister, I would guess that the 2 extra bytes may be a checksum.

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2016-12-12 13:10:18 -0600 )edit