I am trying to work with ompl on drake and am having issues with using the ompl headers in drake. I installed ompl using the default installation path and made the following changes in drake:
Added the following to the workspace:
new_local_repository(
name = "ompl",
path = "/usr/local/include/ompl-1.5/ompl",
build_file = "ompl.BUILD",
)
ompl.BUILD:
cc_library(
name = "ompl",
hdrs = glob(["**"]),
includes = ["include"],
visibility = ["//visibility:public"],
linkstatic = 1,
)
In my repository's BUILD.bazel:
drake_cc_binary(
name = "ompl_ex",
srcs = ["src/ompl_ex.cc"],
data = [],
test_rule_args = ["--target_realtime_rate=0.0"],
deps = [
"@gflags",
"@ompl//:ompl",
],
)
ompl_ex.cc
#include <memory>
#include <limits.h>
#include <unistd.h>
#include <fstream>
#include <string>
#include <gflags/gflags.h>
#include <iostream>
#include <ompl/config.h>
#include <vector>
namespace drake {
namespace ompl {
int DoMain(){
std::cout<<"the function is working"<<std::endl;
return 0;
}
} // namespace examples
} // namespace drake
int main(int argc, char* argv[]) {
gflags::ParseCommandLineFlags(&argc, &argv, true);
return drake::ompl::DoMain();
}
The error I get:
infinite_horizon_ltl/src/ompl_ex.cc:10:10: fatal error: ompl/config.h: No such file or directory
#include <ompl/config.h>
I use spot libraries similarly and they seem to be working fine. Not sure what I am getting wrong in the case of OMPL. I checked on drakes git issues and found that there was an attempt at integration but the branch is deleted now, and the solution proposed does not seem to be working on my system.
I have found that it is easiest to work with
drake
as an external library in acmake
project. This works quite well withompl
. Here's a quick example which imports bothdrake
andompl
as external libraries and solves a simple planning problem.https://github.com/DexaiRobotics/drake-torch/tree/master/examples/drake-ompl
The output and video were made using the
dexai2/drake-torch/cpu-nightly-ros
docker which is available here: https://hub.docker.com/r/dexai2/drake-torch/tagsAs an aside, depending on which version of Ubuntu you use, you may need change your gcc version - e.g. you need
gcc-9
andg++-9
specified in theCMakeLists.txt
for Ubuntu 20.04 andgcc-7
andg++-7
on 18.04. See notes here: https://drake.mit.edu/developers.html#id10