Ask Your Question

rosjava ChannelBuffer parameter

asked 2012-07-27 00:16:19 -0500

LawrieGriffiths gravatar image

I updated rosjava today (July 27th) and am now getting a compilation error in a node that creates an OccupancyGrid message.

The method setData in the OccupancyGrid class used to have a byte[] parameter, but the parameter is now a ChannelBuffer.

How do I create a ChannelBuffer with my occupancy grid data?

ChannelBuffer looks like an internal class and not one that should be a parameter to a public method.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-07-27 12:20:42 -0500

You can read up more on Channel Buffer accessors here and about creating channel buffers here

Depending on your code, there might be more efficient methods of initializing the channel buffer. If your byte[] array is already prepared, you could do something as simple as:

ChannelBuffer buffer = ChannelBuffers.copiedBuffer(byte_array);

ChannelBuffer is not an internal class. rosjava maintainers should be able to answer better as to why byte arrays were changed to this.

edit flag offensive delete link more


Providing ChannelBuffers directly is more performant and they provide a useful interface for working with blobs.

damonkohler gravatar image damonkohler  ( 2012-08-01 16:49:08 -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


Asked: 2012-07-27 00:16:19 -0500

Seen: 592 times

Last updated: Jul 27 '12