CoppeliaRobotics / simOMPL

OMPL (Open Motion Planning Library) plugin for CoppeliaSim
Other
16 stars 4 forks source link

Is it possible to change the OMPL source code for this plug-in? #3

Closed fferri closed 6 years ago

fferri commented 6 years ago

From @lewispro on September 20, 2017 15:58

I develop motion planning algorithms using ompl and I'm wondering if I can somehow change this plug-in so it runs my own ompl algorithms (like replace RRT-Connect, FMT, etc with my own algorithms)? How should I have do this? Thanks!

_Copied from original issue: fferri/vrepExtOMPL#3

fferri commented 6 years ago

From @aidyk on September 20, 2017 16:20

The following files should be modified to add your own planner :

  1. callbacks.xml

    • Add your own planner under <enum name="Algorithm"...> as other planners are
    • Don't care the ordering
  2. v_repExtOMPL.cpp

    • Include the header file of your own planner
    • Add your planner inside a switch statement in "plannerFactory" function

Compile & copy the corresponding lib/so/dylib file to the right location. If everything is correctly done, simExtOMPL_setAlgorithm() will auto-completes the name of your own planner and, it will be callable.

fferri commented 6 years ago

From @lewispro on September 23, 2017 3:12

Many thanks for the fast response! Sorry I need your help again... I tried what you suggested and was able to compile this plugin and generate the dylib file and I put the dylib file next to the vrep executable. However, when I open v-rep, and it tries to load the plugin, the message in the terminal says:

Plugin 'OMPL': loading... this plugin requires at least V-REP 3.4.0 rev9 Initialization failed. Plugin 'OMPL': load failed (failed initialization).

Since V-REP as of 9/22/18 is still at 3.4.0 rev1, I have no idea how to resolve this. I tried looking at the v_repExtOMPL.cpp but couldn't find anything that generates the error message.

fferri commented 6 years ago

From @aidyk on September 25, 2017 9:1

This repository contains a developement version which is not compatible with the latest release. Try with v_repExtOMPL plugin originally included in the released one. You can find it under V-REP installation location, under programming/v_repExtOMPL/.

fferri commented 6 years ago

From @lewispro on September 25, 2017 20:26

Thanks again for the fast reply!

I found the v_repExtOMPL plugin shipped with V-REP 3.4.0 under programming/v_repExtOMPL/ I'm not sure how to use it though. I followed the README.txt provided in that folder and completed the first step: 1) obtain v_repStubsGen:

mkdir external cd external git clone https://github.com/fferri/v_repStubsGen.git export PYTHONPATH=$PYTHONPATH:$PWD

However, in the second step: 2) Generate stubs for Lua callbacks:

python -m v_repStubsGen -H stubs.h -C stubs.cpp callbacks.xml It gives me an error: "/usr/bin/python: No module named v_repStubsGen.main; 'v_repStubsGen' is a package and cannot be directly executed"

On the other hand, I also tried replacing the v_repExttOMPL.cpp and .h files in this repo with files from under programming/v_repExtOMPL/. However, that gives me a linker error:

Undefined symbols for architecture x86_64: "setDubinsParams(SScriptCallBack, char const, setDubinsParams_in, setDubinsParams_out)", referenced from: setDubinsParams_callback(SScriptCallBack) in stubs.cpp.o setDubinsParams(SScriptCallBack, setDubinsParams_in, setDubinsParams_out) in stubs.cpp.o "getData(SScriptCallBack, char const, getData_in, getData_out)", referenced from: getData_callback(SScriptCallBack) in stubs.cpp.o getData(SScriptCallBack, getData_in, getData_out) in stubs.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [libv_repExtOMPL.dylib] Error 1 make[1]: [CMakeFiles/v_repExtOMPL.dir/all] Error 2 make: *** [all] Error 2

fferri commented 6 years ago

From @lewispro on September 25, 2017 23:53

BTW, I don't mind using an old version of V-REP so if you let me know what V-REP version works for the plugin in this repo, I'm perfectly fine with that as well. Thanks!

fferri commented 6 years ago

From @aidyk on October 18, 2017 6:38

Sorry for the late reply. Before setting up, there are some issues to be noted.

  1. v_repExtOMPL in this repository is not compatible with the latest release(3.4.0, rev1, available on the official website) or the formers.
  2. v_repExtOMPL in the latest release is not compatible with the latest version of v_repStubsGen(https://github.com/fferri/v_repStubsGen) for unknown reason. I checked 3.3.2 works well.
  3. callbacks.* are missing in the latest release.

For these reasons, I recommend to download older version(3.3.2) and use enclosed v_repExtOMPL plug-in, not from this repository.

It wouldn't be the best option, but works at least to me.

piyp791 commented 6 years ago

I am trying the steps mentioned in this last comment, but getting the same error:

/home/peps/anaconda3/envs/multirobot/bin/python: No module named v_repStubsGen.__main__; 'v_repStubsGen' is a package and cannot be directly executed

Environment details: OS - Ubuntu 16.04 64 bit VREP - 3.3.2 (rev 3) Linux

Libraries Download source: v_repStubs downloaded from https://github.com/CoppeliaRobotics/v_repStubs

Using the extOMPL plugin from within the VREP directory.

The PYTHONPATH looks like this

'/home/peps/anaconda3/envs/multirobot/bin', '/home/peps/Robotics/V-REP_PRO_EDU_V3_3_2_64_Linux/programming/v_repExtOMPL/external'

Steps followed obtain v_repStubsGen:

mkdir external (inside the folder v_repExtOMPL) cd external git clone https://github.com/CoppeliaRobotics/v_repStubs export PYTHONPATH=$PYTHONPATH:$PWD

Generate stubs for Lua callbacks:

python -m v_repStubsGen -H stubs.h -C stubs.cpp callbacks.xml (results in error!)

What am I doing wrong here?

fferri commented 6 years ago

Did you try latest version of V-REP and OMPL plugin?

piyp791 commented 6 years ago

Right, so I tried with the latest version of V-REP (3.5 rev 4 64 bit) and the OMPL plugin.

Problem: OMPL source code changes not being reflected.

Compilation Steps

  1. Compiled and installed OMPL from source.
  2. Built the OMPL_Plugin as per the instructions.
  3. Double checked that the plugin is picking the libompl.so from the location /usr/local/lib/ as mentioned in the CMakeCache.txt file.
  4. OMPL-VREP plugin loads fine.

Code updation

  1. Modified some print statements in some files (RRT.cpp, RRTConnect.cpp, Planner.cpp etc) in the OMPL installation folder.
  2. Re-compiled and installed the OMPL code.
  3. Re-built the OMPL-VREP plugin.
  4. Problem: The changes are not being reflected in the console.

Am I making changes in the wrong place?

piyp791 commented 6 years ago

Figured it out! Turns out V-REP 3.5 picks up the libraries (libompl.so and libv_repExtOMPL.so) from its installation folder. So I just needed to replace these libraries with the updated ones and I could see my updated print statements.