ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Defining Custom Message Types for Rosjava Android

asked 2013-02-11 04:21:42 -0500

Srogacki gravatar image

Hello!

I am writing an android app in JellyBean to subscribe to a rostopic. I am publishing a custom message type from an ubuntu virtual machine using groovy. I have successfully published and subscribed to the message between 2 VMs, but have issues when receiving the message type on my tablet.

I correctly configured the .msg files in my ros package, but am unsure how to define classes within my app as descriptors for ros messages.

Does anyone have information on configuration and declaration of custom messages in an android app using rosjava?

Thanks!

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-11 22:52:08 -0500

updated 2013-02-12 14:54:13 -0500

After you have correctly made your .msg files in your package, you will need to rebuild at least rosjava with ./gradle as shown in the documentation.

This will automatically include your custom message in the javalibrary, rosjava_messages-0.0.0-SNAPSHOT.jar, which will need to be included into your Java project.

Be careful as if you include a java library file directly in your /libs folder of your project it will conflict with other copies of that file, such as can be the case if the gingerbread_mr2 library is also referenced. If you are developing in java to use android core, then I suggest that you should also rebuild android_core as per the documentation, and just reference the gingerbread_mr2 project as a library in the project_properties->android_settings tab (if using eclipse)

You can them import them into your code like any other message. Just use:

import my_msg_pkg.msg

replacing "my_msg_pkg" with the package your message is defined in and "msg" as your message type.

edit flag offensive delete link more

Comments

awesome! thanks.

Srogacki gravatar image Srogacki  ( 2013-02-15 03:51:15 -0500 )edit

Hello

I am having the same issue as I successfully built my messages in my rosjava package, but now I am not able to link the rosjava package that contains the messages to my Android application. When I add compile project (':my_package') it tells me that the package cannot be found. Any hint?

Anis gravatar image Anis  ( 2015-02-14 13:25:14 -0500 )edit
0

answered 2013-03-19 02:33:45 -0500

maoqizhen gravatar image

I saw on the Internet that the java library is just a reference to ros package, if on 2 PCs java program can execute corresponding ros nodes, but on android platform , there is no ros node available, how can this be executed. I mean, maybe ros nodes are in C++, and java can just run that on ros, but on android, how can java run these packages?

edit flag offensive delete link more

Comments

This might need to be a new question as its not related to custom messages under rosjava. Its true though that the node construct in Android is significantly different than in a PC. In particular each node will run on its own thread in a single activity. Add a question and we can elaborate.

PeterMilani gravatar image PeterMilani  ( 2013-03-19 19:15:30 -0500 )edit
0

answered 2018-11-13 02:17:46 -0500

Champen23 gravatar image

Is this method still viable or is it outdated?

edit flag offensive delete link more
0

answered 2017-09-01 06:58:40 -0500

barovehicles gravatar image

Anyone have a sample to create a publisher using rosjava with bytemultiarray? Really rosjava don't have examples in any place. The documentation is too poor.

edit flag offensive delete link more

Comments

You should ask a new question rather than posting an answer to another question. http://wiki.ros.org/Support#Do_Not

jayess gravatar image jayess  ( 2017-09-01 11:12:17 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-02-11 04:21:42 -0500

Seen: 2,327 times

Last updated: Sep 01 '17