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

pubsub tutorial change string

asked 2014-08-04 04:00:43 -0500

stefan gravatar image

updated 2014-08-05 09:15:06 -0500


i successfully ran the pubsub Tutorial. This Q helped me to see the message in RQT on my Computer.

How can i change the text hello world?

rosTextView.setMessageToStringCallable ((message) -> {return message.getData();});

what is this doing exactly?

when executing the Talker, how does the node know what to publish?

nodeMainExecuter.execute(talker, nodeConfiguration)


Thanks for your short explanation.


in rosjava - tutorial pubsub i can change the

Then i do

cd rosjava_core-hydro
./gradlew install

This builds the new libraries. Now i have my lib in


i think i ve installed rosjava like this

The referenced libs in the android project are in

opt/ros/hydro/share/maven/org/ros/rosjava_core/    .../rosjava_tutorial_pubsub

How do i get my libs to this root-folder?

Edit: in my android project i can change the root of this lib in


root url="jar://$USER_HOME$/rosjava_core-hydro/build/libs/rosjava_tutorial_pubsub-0.1.6.jar!/"

still saying hello world

Final Edit:

Changing something in talker.class in your rosjava

where do i have to do catkin_make or ./gradle install ???? to create the lib

Then using nautilus with sudo to copy the generated lib into the root folder

opt/ros/hydro/share/maven/org/ros/rosjava_core/    .../rosjava_tutorial_pubsub

here exchange the -jar through your new .jar (with talker and listener class) in it

And now the app publishes the text you wrote in the file

edit retag flag offensive close merge delete


maybe someone can extend the pubsub tutorial with a section for changing the text of "hello world" to my custom text - could be useful

stefan gravatar image stefan  ( 2014-08-05 07:00:41 -0500 )edit

@stefan: changing it should not have been so involved. All that should be needed is to build the rosjava repository from source, and have your ros android projects depend on that, instead of overwriting binary dists in '/opt/ros/..'.

gvdhoorn gravatar image gvdhoorn  ( 2014-08-05 08:18:06 -0500 )edit

maybe i got smthing wrong with rosandroid and rosjava folders

stefan gravatar image stefan  ( 2014-08-05 09:12:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-04 04:28:26 -0500

gvdhoorn gravatar image

updated 2014-08-05 08:21:34 -0500

If you haven't already, I suggest you read through the available ros java documentation. Especially the rosjava_core documentation should be helpful. The java ROS client and interaction works a little different from the other client libraries (such as roscpp and rospy).

Both your questions should be answered after this.

Edit: for completeness:

what is this doing exactly?

rosTextView.setMessageToStringCallable ((message) -> {return message.getData();});

This is most likely a 'collapsed' view of (so your editor is collapsing this, look for a 'plus' in the gutter or margin):

rosTextView.setMessageToStringCallable(new MessageCallable<String, std_msgs.String>() {
  public String call(std_msgs.String message) {
    return message.getData();

In short: the class RosTextView extends a specialised View, which can update (append) its contents whenever a message comes in over a certain topic (in this case chatter, set by invoking rosTextView.setTopicName("chatter")). The method setMessageToStringCallable(..) just registers a callback (anonymous MessageCallable here) which will be invoked upon reception of a message. In this case it just returns the data within the message (which is a String), which RosTextView will use to update its view.

Your other questions can also be answered by reading the sources of the relevant classes.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-08-04 04:00:43 -0500

Seen: 891 times

Last updated: Aug 05 '14