0
$\begingroup$

Rosanswers logo

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.


Originally posted by LawrieGriffiths on ROS Answers with karma: 131 on 2012-07-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by piyushk with karma: 2871 on 2012-07-27

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by damonkohler on 2012-08-01:
Providing ChannelBuffers directly is more performant and they provide a useful interface for working with blobs.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.