ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Occupancy grid ChannelBuffer

asked 2012-11-02 01:28:13 -0500

camilla gravatar image

updated 2014-01-28 17:14:08 -0500

ngrennan gravatar image

I was 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. So I changed the code from:



ChannelBuffer buffer = ChannelBuffers.copiedBuffer(data);

But now i get this exception when i run the node:

Exception in thread "pool-1-thread-3" java.lang.IllegalArgumentException
    at org.ros.internal.message.field.ChannelBufferField.setValue(
    at org.ros.internal.message.MessageProxyInvocationHandler.invoke(
    at org.ros.internal.message.$Proxy2.setData(Unknown Source)
    at org.lejos.ros.nodes.PublishOccupancyMap.onStart(
    at org.ros.internal.node.DefaultNode$
    at org.ros.internal.node.DefaultNode$
    at org.ros.concurrent.EventDispatcher.loop(
    at java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.util.concurrent.ThreadPoolExecutor$

What is wrong with my code?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-11-12 22:54:03 -0500

damonkohler gravatar image


You need to set the byte order of your ChannelBuffer to little endian. Be careful that you copy the data correctly as well.

edit flag offensive delete link more

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-11-02 01:28:13 -0500

Seen: 560 times

Last updated: Nov 12 '12