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

writing nodes and defining custom messages/services in rosjava

asked 2012-07-27 05:51:16 -0500

DocSmiley gravatar image

I'm trying to follow the rosjava tutorials for creating my own node. This node needs to be both a publisher and a server.

I'm finding the rather brief notes on rosjava messages lacking the level of detail I need, being rather new to ROS and rosjava in particular. I have built .mgs and .srv files for other nodes using rospy, but the structure of rosjava seems sufficiently different that I'm unsure what to do.

I need to define two messages one is an arrays of ints, the other an array of floats

I also need to define services that are an array of int/floats pairs (or a single int/float pair), neither service returns anything.

I'm also unsure as to where to place my .java and externally linked library .jar files to have this node run correctly.

Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2012-07-27 08:43:04 -0500

joq gravatar image

updated 2012-07-27 08:44:40 -0500

I am not a java programmer, but I believe you need to create custom messages in a separate package, using the normal ROS message definition and generation tools.

edit flag offensive delete link more

Comments

The generation tools are not necessary for Java. Rebuilding the rosjava_messages package will generate all available ROS messages. This process is described in the documentation, albeit briefly. http://docs.rosjava.googlecode.com/hg/rosjava_core/html/getting_started.html#messages

damonkohler gravatar image damonkohler  ( 2012-08-01 16:51:27 -0500 )edit

I also found that if developing in eclipse, that I had to re-reference my rosjava_messages-0.0.0-SNAPSHOT.jar into my build path. If copied it into my libs folder, it would conflict with the ginerbread_mr2 jar of the same name. Must have same in both projects or import as external JAR to build path.

PeterMilani gravatar image PeterMilani  ( 2012-11-28 12:23:14 -0500 )edit

@damonkohler I tried doing what you suggested and I tried the instructions here: http://wiki.ros.org/rosjava/Tutorials... but unfortunately it still doesn't work for me. When I try to depend on the messages in my build.gradle I get the an error:

Robocop87 gravatar image Robocop87  ( 2015-02-21 00:25:26 -0500 )edit

Could not resolve all dependencies for configuration ':project:compile'.

Could not find any version that matches org.ros.rosjava_messages:hsmrs_framework:0.1.+. Required by: org.ros.rosjava_core:project:0.1.0

Robocop87 gravatar image Robocop87  ( 2015-02-21 00:25:39 -0500 )edit

I solved the problem from my comment, I didn't have the full group ID. It was org.ros.rosjava_messages.rosjava_pkg:msg_pkg:0.0.+

Robocop87 gravatar image Robocop87  ( 2015-02-21 00:52:07 -0500 )edit

Question Tools

Stats

Asked: 2012-07-27 05:51:16 -0500

Seen: 1,910 times

Last updated: Jul 27 '12