Ask Your Question
0

Launch the rosjava application with the ROS Melodic version. Which method/tutorial is correct?

asked 2019-07-22 08:21:27 -0500

Dines gravatar image

updated 2019-07-29 11:04:57 -0500

Hello. I want to develop a ROS application. I need to use Java for this. As I understand it, there is a rosjava package. But I also need to use a version of ros melodic but rosjava has not yet been ported to this version, so the deb installation is not available. There are two options left for me, as I understand from this page http://wiki.ros.org/rosjava/Tutorials... . Besides this page, I also saw http://rosjava.github.io/rosjava_core... and http://rosjava.github.io/rosjava_core... . It seems to me that I have tried all the methods of installing rosjava as well as creating and running the rosjava application. Nothing I tried helped me. There was always some mistake. So I think I need to ask this. How do I install rosjava, create an application and run it? Which path is the right one? I don't need rosrun or roslaunch for my purposes. I have to write this in java. Essentially, apart from the ros features, it should be a classic Java application with a standard maven structure and build using gradle. And have the main features that ROS provides for other languages (Message publish and subscribe, services and etc. ). I would like to provide an error message but because of several different installation methods I don't understand what is important and what is not (and what I do). I want to repeat that this application may not be a standard ros package. But I would like to see a standard java application with just ros functions. Maybe you can do it purely in Gradle? That would be great, I suppose.

P.S. Sorry about the bad English P.P.S. I'm sorry about the bad statement of the problem. I'm just tired and I don't know what I'm doing.

env | grep ROS
ROS_ETC_DIR=/opt/ros/melodic/etc/ros
ROS_ROOT=/opt/ros/melodic/share/ros
ROS_MASTER_URI=http://localhost:11311
ROS_VERSION=1
ROS_PYTHON_VERSION=2
ROS_PACKAGE_PATH=/home/denis/catkin_ws/src/mavlink:/home/denis/catkin_ws/src/mavros/libmavconn:/home/denis/catkin_ws/src/mavros/mavros_msgs:/home/denis/catkin_ws/src/mavros/mavros:/home/denis/catkin_ws/src/mavros/mavros_extras:/home/denis/catkin_ws/src/Firmware:/home/denis/catkin_ws/src/mavros/test_mavros:/opt/ros/melodic/share
ROSLISP_PACKAGE_DIRECTORIES=/home/denis/catkin_ws/devel/share/common-lisp
ROS_DISTRO=melodic


cat /proc/version
Linux version 4.18.0-25-generic (buildd@lgw01-amd64-033) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #26~18.04.1-Ubuntu SMP Thu Jun 27 07:28:31 UTC 2019

Edit:

java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)

Edit 2:Update links: http://rosjava.github.io/rosjava_core... One of the methods I tried to follow. The old link stopped working

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-07-25 14:11:07 -0500

jubeira gravatar image

Hi @Dines,

Try installing rosjava from source: http://wiki.ros.org/rosjava/Tutorials.... If you find an error when getting dependencies (rosdep install step), use -r option to continue and don't worry.

You should be able to build applications with catkin_make or with Gradle directly if you don't need any custom messages. If you want to define your own interfaces (messages / services) you should create a catkin package and apply the same CMake rules you usually would with a regular roscpp or rospy package.

Hope it helps!

edit flag offensive delete link more

Comments

Well, I tried to do what it says. The first time I built it, it was a mistake. I didn't read it in detail, but as far as I understood it took too long to build and gradle/java gave me the error. So I tried to run the build several more times. Each time the number of errors decreased. After a few builds the error stopped changing and became this https://paste.ubuntu.com/p/GFc7skbKn7/ . [Fatal Error] package.xml:1:7: The string "--" is not permitted within comments. This line has already occurred to me in other build methods described in other sources. Can you help me?

Dines gravatar imageDines ( 2019-07-29 09:04:54 -0500 )edit

I've never seen an error like that one. The catkin plugin apparently failing is this one: https://github.com/rosjava/rosjava_bo...; I don't see the -- anywhere. Can you try building rosjava core with gradle directly? Go to rosjava_core folder and run ./gradlew build.

jubeira gravatar imagejubeira ( 2019-07-29 09:18:53 -0500 )edit

https://pastebin.ubuntu.com/p/zqkZcC5... The same error occurs when trying to follow the instructions described here http://rosjava.github.io/rosjava_core...

Dines gravatar imageDines ( 2019-07-29 11:02:04 -0500 )edit

What do you think I should do? Write about it in the issue on github or ask on this resource? Two different installation methods and the same problem. Thanks for your help anyway.

Dines gravatar imageDines ( 2019-07-30 18:05:52 -0500 )edit

It's a bit hard to tell. The pastebin says failed to apply plugin catkin. Try commenting / deleting that line from build.gradle and build using rosjava_core using gradlew (change the version number in allprojects block as well to the version in package.xml manually as well). Also, try using --stacktrace and --debug options when building to get more information.

jubeira gravatar imagejubeira ( 2019-07-31 08:31:46 -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

2 followers

Stats

Asked: 2019-07-22 08:21:27 -0500

Seen: 28 times

Last updated: Jul 29