[Discourse.ros.org] [Client Libraries/rosjava] Sending a Byte Array Message

14 views
Skip to first unread message

Gabriel Giani

unread,
Aug 30, 2017, 6:38:00 AM8/30/17
to ros-si...@googlegroups.com
Gabriel_Giani
August 30

Hi

I’m looking to send a byte multi array message from rosjava.

I’m using this structure but the apps in Android stop automatically when execute nuevo.setdata(eee).

std_msgs.ByteMultiArray nuevo = pubremotecontrol.newMessage();
ChannelBuffer eee= ChannelBuffers.dynamicBuffer();
eee.writeInt(4);
eee.writeBytes(new byte[] {0x22,0x32,0x22,0x11});

                                                           //copiedBuffer(new byte[] {0x22,0x32,0x22,0x11});
                                                   nuevo.setData(eee);
                                                   pubremotecontrol.publish(nuevo);

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Ernesto Corbellini

unread,
Aug 30, 2017, 9:36:10 AM8/30/17
to ros-si...@googlegroups.com
ecorbellini
August 30

Hi Gabriel,
Can you paste the error message from logcat?
Also you can check this example to compare.

Gabriel Giani

unread,
Aug 30, 2017, 11:41:59 AM8/30/17
to ros-si...@googlegroups.com
Gabriel_Giani
August 30

08-30 16:28:00.651 16610-16610/? E/Zygote: MountEmulatedStorage()
08-30 16:28:00.651 16610-16610/? E/Zygote: v2
08-30 16:28:00.656 16610-16610/? E/SELinux: [DEBUG] get_category: variable seinfo: default sensitivity: NULL, cateogry: NULL
08-30 16:28:04.626 16610-16697/com.baro.barosystem.barocar E/Resources: RunTimeException
android.content.res.Resources$NotFoundException: Resource ID #0x7f02005a
at android.content.res.Resources.getValue(Resources.java:2345)
at android.content.res.Resources.startRC(Resources.java:1059)
at android.app.ActivityThread$mRunnable.run(ActivityThread.java:2517)
at java.lang.Thread.run(Thread.java:818)
08-30 16:28:08.256 16610-16819/com.baro.barosystem.barocar E/AndroidRuntime: FATAL EXCEPTION: pool-2-thread-18
Process: com.baro.barosystem.barocar, PID: 16610
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 java.lang.reflect.Proxy.invoke(Proxy.java:397)
at org.ros.internal.message.$Proxy2.setData(Unknown Source)
at com.baro.barosystem.barocar.RosAlive$1.loop(RosAlive.java:109)
at org.ros.concurrent.CancellableLoop.run(CancellableLoop.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)

Reply all
Reply to author
Forward
0 new messages