ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Implementing custom rosjava message

asked 2018-11-13 02:26:39 -0600

Champen23 gravatar image


I am trying to implement a custom rosjava message to a rosjava subscriber node. I can find my message using "rosmsg show" but not in my code. The code compiles without warnings if I use std_msgs.String

final Subscriber<msg.Cvmsg> subscriber = connectedNode.newSubscriber("chatter", msg.Cvmsg._TYPE);
subscriber.addMessageListener(new MessageListener<msg.Cvmsg>()

I have tried finding the answer on here, but the documentation seems outdated. I am on Ubuntu 16.04 and using kinetic Any help is much apreciated :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-11-21 07:11:32 -0600

jubeira gravatar image

Hi @Champen23,

I don't have an example for messages at hand, but I do have one for services which is analogue: .

In a few words, you should create a ROS package with the messages you want to use in the same workspace just like you would do in regular ROS. Check CMakeLists here, you should add your custom message definitions there and create a msg folder.

Then, if you source rosjava_build_tools and build the workspace, your custom messages will be built for Java as well and you should be able to use them.

Let me know if you need further clarifications; I can add custom messages to that example if you need to.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools



Asked: 2018-11-13 02:26:39 -0600

Seen: 355 times

Last updated: Nov 21 '18