How to use Javafx in ROSjava
I'm working on a project that involves a UI communicating through ROS to both a drone and rover. The UI was built in Java, so we have been attempting to use ROSjava to enable the UI to publish to ROS topics. However, the UI was also built with Javafx, and has a google maps API built in, the google maps API means that we cannot use java 8 since the google maps page will not load. Since we need to use a newer version of java, Javafx is not built-in and needs to be imported, we followed the answer in this thread:
https://answers.ros.org/question/1132...
in an attempt to import the needed javafx modules, however, it fails to import and gives "package <javafx module=""> does not exist" for all lines importing a javafx module:
/home/wpirbe/rosjava/src/demining_ui/ui/src/main/java/com/github/demining_ui/ui/MineFieldController.java:10: error: package javafx.scene does not exist
import javafx.scene.Parent;
/home/wpirbe/rosjava/src/demining_ui/ui/src/main/java/com/github/demining_ui/ui/MineFieldController.java:11: error: package javafx.scene does not exist
import javafx.scene.Scene;
/home/wpirbe/rosjava/src/demining_ui/ui/src/main/java/com/github/demining_ui/ui/MineFieldController.java:12: error: package javafx.scene.control does not exist
import javafx.scene.control.Button;
These are the same errors that we got just running the .class file in linux before adding the javafx libraries to the run configuration. When we only build the javafx package using catkin_make --only-pkg-with-deps javafx_jars
, it works without errors but then errors when building the package with the UI code. We're working on this in Ubuntu 16.04. How should we go about importing Javafx into ROSjava? Thanks!
Not an answer, but I would suggest to perhaps take a look at rosbridge_suite instead. It's a simple, lightweight protocol (JSON based) which is very easy to consume and produce in any language which can open a TCP socket and read/write strings to that socket.
For Java specifically, there are some implementations of clients available. rctoris/jrosbridge is one example.
rosjava
is nice too, but if all you need is to create some GUI frontend and exchange a few messages, it may be too much.Note: if you have the possibility to run ROS nodes on your local PC, you could even use this when communicating with ROS running on some product (where you can't add arbitrary other nodes, such as
rosbridge_server
). You'd runrosbridge_server
on your own machine in that case, and have it join the ROS node graph running on the product.