Ask Your Question

Any tutorials available for creating custom message for android ros

asked 2018-01-11 18:28:19 -0500

jbeard gravatar image

updated 2018-01-18 10:13:44 -0500

I am creating a publisher and subscriber node in Android. Currently it works very well with the included ROSjava standard messages. However, I would like to create a custom message type. Hoping there is a tutorial or sample project I can study.

Updated to add my solution in case it helps others: I did follow this tutorial per @jubeira post. The most important thing that I found impacted my success was the sourcing of rosjava.

Written in the text below Step 2 is

Remember to source your Rosjava installation workspace first to have the command line tools available (e.g. source ~/rosjava/devel/setup.bash).

What I found was that if rosjava was deb installed I had problems. I am very new to working with ROS and linux so that may be obvious what to do for other folks, but that's what I found that made things work for me.

edit retag flag offensive close merge delete


Could you please post your update as a solution instead?

jayess gravatar image jayess  ( 2018-01-18 11:22:28 -0500 )edit

@jayess Do you mean post as an answer below or is there a solution option I am missing? Forgive me, very new to forum.

jbeard gravatar image jbeard  ( 2018-01-18 11:31:51 -0500 )edit

Yes, post as answer. If you come up with a solution for your problem you should post it as an answer. It's ok if there's already other answers.

jayess gravatar image jayess  ( 2018-01-18 11:34:13 -0500 )edit

hola @jubeira estoy trabajando con rosjava y necesito pasar mensajes personalizados, llegaste ha hacer ese tutorial?

Ro gravatar image Ro  ( 2019-12-11 09:20:10 -0500 )edit

Hola Ro, probaste los pasos que describi en la respuesta anterior? Generar los mensajes no tiene ningun paso distinto en Java; solo hay que tener genjava disponible en el workspace en el momento de buildear el paquete que contiene los mensajes.

jubeira gravatar image jubeira  ( 2019-12-16 10:49:16 -0500 )edit

Guys, could you please not post in languages other than English? Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2019-12-16 10:53:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-01-12 14:54:10 -0500

jubeira gravatar image

updated 2018-01-13 15:33:48 -0500

Hi @jbeard!

The method I prefer is using Catkin, and placing the messages in a separate package. I will assume you have a workspace with your rosjava/ Android project. Let me explain the steps:

  • Create a new catkin package using catkin_create_pkg in your workspace.

  • Create the custom message in this package as you would do in regular ROS (msg folder, modify the CMakeLists, etc). As you probably know, you would generate the standard Python/ Cpp files corresponding to those messages by building the workspace.

  • To create the java artifacts, source your rosjava installation workspace (if installed from source) and then build your workspace. The Java artifacts will be in devel/share/maven.

  • Modify your build.gradle dependencies to include the newly generated messages. Note that the version specified in the package will be the version of your messages.

Check out this tutorial: . It shows how to create and use custom services in Java, which in the end are actually a particular case for messages.

If you find it useful, I can create a tutorial for this as well when I find some time. Hope it helps!

edit flag offensive delete link more


@jubeira This is a big help in pushing me along. I ran through the tutorial you linked and it got me much closer. I am going to run through the guide again though cause I believe I missed something. The generated .jar file did not contain my custom message but instead talker and listener classes.

jbeard gravatar image jbeard  ( 2018-01-12 19:29:53 -0500 )edit

@jubeira I seem to have difficulty going at step 3. I source my rosjava installation and then build my package but I don't get the maven folder.

jbeard gravatar image jbeard  ( 2018-01-14 18:11:50 -0500 )edit

I will write an example or a tutorial to give you more precise instructions about it, this answer is a bit vague. In the meantime, try checking the tutorial for services. The process of creating custom messages is analogue to that one; try following those steps replacing services for messages.

jubeira gravatar image jubeira  ( 2018-01-15 12:46:00 -0500 )edit

Thank you for all the help. I have finally got my messages working for the most part (there is an array vs list issue I will make another question for).

jbeard gravatar image jbeard  ( 2018-01-17 20:39:15 -0500 )edit

I'm glad that it worked! I've been pretty busy lately and I couldn't write a proper tutorial or example yet. In any case, I've always used rosjava from source; it's relatively easy to install and I think it causes less trouble.

jubeira gravatar image jubeira  ( 2018-01-19 07:27:31 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-01-11 18:28:19 -0500

Seen: 763 times

Last updated: Dec 11 '19