Robotics StackExchange | Archived questions

[rosjava] How can I use custom messages from 3rd party packages using rosjava without ROS workspaces?

I am using rosjava with no ROS workspace and it is working fine. However, now I want to use messages from mavros but I don't know how. I saw that it is possible to use genjava to convert messages to .jar, is it possible to use genjava without installing rosjava?

Asked by rezenders on 2019-03-18 15:30:04 UTC

Comments

Answers

Hi @rezenders,

You can follow this tutorial: http://wiki.ros.org/rosjava/Tutorials/indigo/RosJava%20Message%20Artifacts from genjava. Note that you need to have mavros messages installed.

Asked by jubeira on 2019-03-19 07:58:08 UTC

Comments

I haven't done that myself for a while, but it should work. If it doesn't please let me know.

Asked by jubeira on 2019-03-19 07:58:13 UTC

Hello @jubeira, I'm having some trouble with genjava installation. Since I'm using ros melodic I can't use apt to install it so I'm trying to get it from sources. I'm doing the following steps:

mkdir -p ~/genjava/src
wstool init ~/genjava/src
wstool set --target-workspace=src  genjava --git https://github.com/rosjava/genjava --version=kinetic
wstool update  --target-workspace=src genjava
rosdep install --from-paths src -i -y

But I get the following error:

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
genjava: Cannot locate rosdep definition for [rosjava_build_tools]

Asked by rezenders on 2019-03-19 10:10:15 UTC

Yes, for now nothing was released to melodic yet; I'd recommend you to proceed with the installation from source (all rosjava components; check http://wiki.ros.org/rosjava/Tutorials/kinetic/Source%20Installation)

Asked by jubeira on 2019-03-19 10:43:16 UTC

Using the kinetic branch for source installation in Melodic I get the following errors. With the complete installation:

$ rosdep install --from-paths src -i -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
rosjava_messages: Cannot locate rosdep definition for [world_canvas_msgs]

Asked by rezenders on 2019-03-19 10:52:08 UTC

With the minimal installation when I run catkin_make:

geometry_experimental/tf2/CMakeFiles/tf2.dir/build.make:86: recipe for target 'geometry_experimental/tf2/CMakeFiles/tf2.dir/src/buffer_core.cpp.o' failed
make[2]: *** [geometry_experimental/tf2/CMakeFiles/tf2.dir/src/buffer_core.cpp.o] Error 1
CMakeFiles/Makefile2:10925: recipe for target 'geometry_experimental/tf2/CMakeFiles/tf2.dir/all' failed
Catkin generate tree: replacing older version of tf2_msgs[0.5.20->0.6.5]
[ 93%] Built target std_msgs_generate_messages_java_gradle
[ 93%] Built target std_srvs_generate_messages_java_gradle
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j8 -l8" failed

Asked by rezenders on 2019-03-19 10:52:48 UTC

Also posted this in the issue https://github.com/rosjava/genjava/issues/19 Sorry for the cross posting

Asked by rezenders on 2019-03-19 10:53:05 UTC

@rezenders were you able to figure out the issue with 'world_canvas_messages'? I'm running into the exact same error.

Asked by gautam_io on 2019-06-12 12:38:22 UTC

@gautam_io No, I did not. I used ros kinect to generate the messages .jar, and then used the .jar with ros melodic.

PS: I used the following dockerfile environment to generate the .jar https://github.com/jason-lang/jason-ros/blob/master/MsgDockerfile

Asked by rezenders on 2019-06-12 13:08:26 UTC