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:
grid.setData(data);
to:
ChannelBuffer buffer = ChannelBuffers.copiedBuffer(data);
grid.setData(buffer);
But now i get this exception when i run the node:
Exception in thread "pool-1-thread-3" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:76)
at org.ros.internal.message.field.ChannelBufferField.setValue(ChannelBufferField.java:55)
at org.ros.internal.message.MessageProxyInvocationHandler.invoke(MessageProxyInvocationHandler.java:46)
at org.ros.internal.message.$Proxy2.setData(Unknown Source)
at org.lejos.ros.nodes.PublishOccupancyMap.onStart(PublishOccupancyMap.java:141)
at org.ros.internal.node.DefaultNode$5.run(DefaultNode.java:506)
at org.ros.internal.node.DefaultNode$5.run(DefaultNode.java:503)
at org.ros.concurrent.EventDispatcher.loop(EventDispatcher.java:43)
at org.ros.concurrent.CancellableLoop.run(CancellableLoop.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
What is wrong with my code?
Originally posted by camilla on ROS Answers with karma: 255 on 2012-11-02
Post score: 0