Ask Your Question
0

custom field type for ROS msg

asked 2018-07-25 11:42:30 -0500

mohthepro gravatar image

updated 2018-07-27 13:11:20 -0500

We're trying to read a radar udp packet and one of the data types is of a RadarDetection[] type which is not supported by ROS (because its a custom type) the size of each index is 224 bits, one solution Im thinking of is :

-creating a message that contains int64[4] RadarDetection_custom and then use that message as a field type to represent the RadarDetection type but with 256 bits instead 224

I am not confident that this solution will work and I was wondering if there is a better solution than this

edit retag flag offensive close merge delete

Comments

Could you reformat your question with more punctuation and more information about the data you want to send? You should also check your numbers. int64[3] would only hold 192 bits, not 256, and where did "215" come from?

Geoff gravatar imageGeoff ( 2018-07-25 18:39:21 -0500 )edit

Sorry I meant int64[4], and I reformatted the question to make it easier to read, the 215 bits is just the size of the field type that I am receiving from the radar's UDP packets, I dont know why the radar manufacturers made it like so

mohthepro gravatar imagemohthepro ( 2018-07-26 09:35:55 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-07-25 18:58:13 -0500

Geoff gravatar image

updated 2018-07-25 19:00:24 -0500

An array of int8 28 values long will give you 224 bits. This is the usual approach to storing a binary blob such as your RadarDetection type. It will be presented as a boost::array of int8_t, which you can get the raw pointer to and read into your data type. See the msg data types page for more information.

edit flag offensive delete link more

Comments

is there any difference between int8[28] and what I suggested with int64[4] other than less wasted space?

mohthepro gravatar imagemohthepro ( 2018-07-26 10:05:29 -0500 )edit

In some ways no. In fact they will probably take exactly the same space in memory due to the way compilers work. However semantically int64 implies a particular encoding that the data probably doesn't have whereas an array of bytes is the standard encoding of raw binary data.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-07-26 17:18:23 -0500 )edit

So it's a convention really but your code will be more meaningful to other developers of you use a buffer of bytes.

PeteBlackerThe3rd gravatar imagePeteBlackerThe3rd ( 2018-07-26 17:20:23 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2018-07-25 11:42:30 -0500

Seen: 80 times

Last updated: Jul 27 '18