Joctomap - A Java wrapper for Octomap
Octomap is a C++ framework to generate, update and manage 3D occupancy maps. These maps are multi-resolution and widely used in mapping and robotic applications, among others.
Joctomap is a wrapper for this mapping library which allows you to use it in Java/Android projects. It provides access to the main functionalities of Octomap, while retaining the structure and philosophy of the mapping library.
It allows using the main functions of Octomap in Java, but it also has several functionalities which might be interesting for planning and navigation problems, like:
- Check collisions between circles and oriented rectangles and the obstacles in the map
- Query the resolution, given a position in the map
- Query which cells are occupied (and retrieve their positions or keys) within a bounding box
- Build an adjacency map to easily retrieve the adjacent cells to a given one
- Build an octree given an image in PPM (ASCII) format
Integration with ROS
Since March 26th, 2018, it is possible to serialize and deserialize octomap_msgs/Octomap messages used in ROS. Thus, it is possible to integrate Octomap in ROS applications written in Java and communicate with other nodes using Rosjava.
How do I use it?
This project depends on spatial-utils, a lightweight library for geometrical operations in cartesian coordinate systems. This library has to be compiled first:
git clone https://github.com/gonzalezsieira/spatial-utils cd spatial-utils mvn install
Joctomap is compatible for JDK1.6+. Compile it as follows:
git clone https://github.com/gonzalezsieira/joctomap cd joctomap mvn install -DreleaseType=Release -Djdk=$JDK_HOME
-DreleaseTypecan be Release or Debug according to your needs.
-Djdkmust point to the directory where your JDK is installed. (e.g. /usr/lib/jvm/java-8-oracle)
Afterwards you can import the generated jar file into your project or, if you use maven, add the following dependency:
<dependency> <groupId>es.usc.citius.lab</groupId> <artifactId>joctomap</artifactId> </dependency>
For gradle, it would be: