codac-team / codac Goto Github PK
View Code? Open in Web Editor NEWCodac is a library for constraint programming over reals, trajectories and sets.
Home Page: http://www.codac.io
License: GNU Lesser General Public License v3.0
Codac is a library for constraint programming over reals, trajectories and sets.
Home Page: http://www.codac.io
License: GNU Lesser General Public License v3.0
2021 UPDATE : Tubex has been renamed to Codac, here is the updated sample : https://www.ensta-bretagne.fr/lebars/Share/codac_test_win.zip.
If you just want to quickly test Tubex in C++ on Windows, try https://www.ensta-bretagne.fr/lebars/Share/tubex_test_win.zip.
Otherwise, if you need to rebuild the library (e.g. to get latest updates or modify it), try this :
qt-opensource-windowsx86-5.12.6.exe
and select Qt\Qt 5.12.6\MinGW 7.3.0 32 bit
and Qt\Developer and Designer Tools\MinGW 7.3.0 32 bit
options (in addition to existing selected options)Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install -y cmake git wget winflexbison make patch --installargs 'ADD_CMAKE_TO_PATH=System'
refreshenv
wget https://github.com/ros2/choco-packages/releases/download/2020-02-24/eigen.3.3.4.nupkg --no-check-certificate -nv
choco install -y eigen.3.3.4.nupkg
Git Bash
app and inside, runexport PATH=/c/Qt/Qt5.12.6/Tools/mingw730_32/bin:$PATH
cd Downloads
git clone https://github.com/ibex-team/ibex-lib.git
cd ibex-lib
mkdir build ; cd build
cmake -G "MSYS Makefiles" -D CMAKE_INSTALL_PREFIX="../../ibex" -D CMAKE_CXX_FLAGS="-fPIC" -D CMAKE_C_FLAGS="-fPIC" ..
cmake --build . --target install
cd ../..
git clone https://github.com/SimonRohou/tubex-lib
cd tubex-lib
git submodule init ; git submodule update
mkdir build ; cd build
cmake -G "MSYS Makefiles" -D CMAKE_BUILD_TYPE=Release -D CMAKE_PREFIX_PATH="../ibex" -D CMAKE_INSTALL_PREFIX="../../tubex" ..
cmake --build . --target install
cd ../
ibex
and tubex
folders in www.ensta-bretagne.fr/lebars/Share/tubex_test_win.zip with the new ones…Solve this issue, appearing in the Linux config of Travis "Ubuntu 18.04 C++ Python 3.8".
Hi,
After looking into the library, and can't find a way to modify the time domain of a Tube or TubeVector in order to cover a wider time domain. For exemple, I would like to add new Slices at the end of a Tube, delete Slices at the beginning of a Tube, or even move the first Slice to the end of the Tube in order to prevent reallocation.
The purpose of this is to maintain the time domain to [current_time - time_span, current_time].
It appears to me that this functionnality can often be necessary for robotics, as the required time domain cannot be always known before the mission.
If you had already stumble into this case scenario, how did you manage it ? Thanks !
For instance, when using:
const Trajectory TFunction::traj_eval(const TrajectoryVector& x) const
with f("x[2]","y")
The function f.nb_var = 1, instead of 2.
Trying to pretty-print the following interval vector with icecream
raises a TypeError
from codac import *
from icecream import ic
b2_iv = IntervalVector([[-0.5418019655155, -0.4680189629224],[-0.4088904965983, -0.3177809931966]])
ic(b2_iv)
Hi,
I was performing some profiling in my lib in order to speed it up, and I found that a lot of time is spent here :
It seems to represent 72% of the computation time of my call to CtcDeriv::contract(Tube, Tube)
!!!
I opened this issue because it seems that this time is lost because there is no need to call this line : m_v_floating_pts
only contains the four corners of a 2D box (tdomain x codomain), so its already convex.
Am I wrong ?
Thanks in advance !!!
For example the following line SIVIA(IntervalVector([[-30,30],[-30,30]]),SepProj(SepFwdBwd(Function("x","y","mx","my", "(x-mx)^2+(y-my)^2"),[-oo,100]),IntervalVector([[0,1],[2,10]])),0.5)
returns the error Assertion failed: ((XinFull | XoutFull) == cart_prod(x, y)), function process, file codac_SepProj.cpp, line 72.
Also a call of function compute_detections() from a TPlane object results in the following error python3(32091,0x102cac580) malloc: Heap corruption detected, free list is damaged at 0x600000e9dc00
*** Incorrect guard value: 102058021869322
Would it be possible to choose where ibex-lib is installed. For instance with a cmake variable IBEX_ROOT?
It will allow to manage different version of ibex.
Il manque une conversion à Interval dans deux appels à eval_vector dans tubex_Fnc.cp
le double est transformé en entier et peut causer un segFault.
res_gate = eval_vector(v_sy[0]->domain().lb(), x);
devrait être
res_gate = eval_vector(Interval(v_sy[0]->domain().lb()), x);
et
res_gate = eval_vector(v_sy[0]->domain().ub(), x);
devrait etre
res_gate = eval_vector(Interval(v_sy[0]->domain().ub()), x);
Hi,
I think that there is missing something explaining that we need to modify the ./cmake/modules/FindIbexLib.cmake file in order to compile tubex with ibex and filib.
Regards,
Vincent
Hi,
I tried this :
#include "tubex.h"
#include "tubex-robotics.h"
using namespace std;
using namespace ibex;
using namespace tubex;
int main()
{
clock_t t_start = clock();
float tf = 10.0;
Interval domain(0.0, tf);
float timestep = 0.01;
TubeVector x(domain, timestep, 4);
TubeVector y(domain, timestep, 2);
IntervalVector x0(x.size());
x0[0] = Interval(0.0); // Initial position x
x0[1] = Interval(0.0); // Initial position y
x0[2] = Interval(0.0); // cos(th) initial
x0[3] = Interval(1.0); // sin(th) initial
x.set(x0, 0.0);
IntervalVector xf(x.size());
xf[0] = Interval(-1.0, 1.0);
xf[1] = Interval(-1.0, 1.0);
xf[2] = Interval(0.0, 1.0);
xf[3] = Interval(-1.0, 1.0);
x.set(xf, 10.0);
CtcDeriv ctc_dyn;
tubex::CtcFwdBwd ctc_fwdbwd(
tubex::Function("x", "y", "cos_th", "sin_th", "cos_th^2 + sin_th^2 - 1.0"));
float dt = 0.02;
for (float t=dt; t<tf; t=t+dt) {
int i = 0;
float volume_x;
do
{
volume_x = x.volume();
y[0].set(Interval(0.5*t).inflate(0.05), Interval(t-dt, t));
y[1].set(Interval(-t).inflate(0.001), Interval(t-dt, t));
ctc_dyn.contract(x[0], y[0]*x[2]);
ctc_dyn.contract(x[1], y[0]*x[3]);
ctc_dyn.contract(x[2], y[1]*x[3]);
ctc_dyn.contract(x[3], -y[1]*x[2]);
ctc_fwdbwd.contract(x);
i++;
} while(volume_x != x.volume());
}
}
but i got this error:
tubex-lib/src/core/contractors/tubex_CtcDeriv.cpp:27: void tubex::CtcDeriv::contract(tubex::Tube&, const tubex::Tube&, tubex::TPropagation): Assertion `Tube::same_slicing(x, v)' failed.
Abandon (core dumped)
The following code does not provide the expected result (from IBEX):
IntervalVector x(2, Interval::EMPTY_SET);
x |= Vector({0,oo});
cout << x << endl;
(<0, 0> ; [empty])
I have tested the package with Matlab and there are several problems that prevent it from being used :
I can't test the validity of the function "Function" since IntervalVector returns a wrong result, so to be tested.
Good luck to fix it, and thank you for your work !
There might be an issue in v0.1.5 where as soon as we try to use e.g. ctc::deriv
, we get an abort error at
codac/src/core/contractors/dyn/codac_CtcLinobs.cpp
Lines 43 to 46 in 7fdbc3f
codac/src/core/contractors/codac_predef_contractors.cpp
Lines 15 to 22 in 7fdbc3f
CtcChain()
./certis/3/neveub/RECHERCHE/tubex/tubex-2/tubex-lib/src/core/graphics/tubex_ColorMap.cpp: In member function ‘tubex::rgb tubex::ColorMap::color(double) const’:
/certis/3/neveub/RECHERCHE/tubex/tubex-2/tubex-lib/src/core/graphics/tubex_ColorMap.cpp:69:15: error: call of overloaded ‘isnan(double&)’ is ambiguous
if(isnan(r)) // undefined ratio
pour corriger, il suffit de mettre
if(std::isnan(r))
Le contracteur CtcLohner perd les portes initiales et finales ponctuelles du premier tube d'un tube vector de dimension 2 (BVP)
pendant la contraction.
la porte initiale [1,1] devient [-92.35, 94.85]
la porte finale [0,0] devient [-93.6, 93.6]
code
#include
#include
#include "codac.h"
#include "ibex.h"
using namespace std;
using namespace ibex;
using namespace codac;
int main(){
IntervalVector bounds (2);
bounds[0]=Interval(-100,100);
bounds[1]=Interval(-100,100);
Interval domain(0.,1);
TubeVector x(domain,0.5,bounds);
Function f("x1", "x2" ,"(x2;x1)");
IntervalVector v(2);
v[0]=Interval(1.,1.);
v[1]=Interval(-100,100);
x.set(v, 0.); // ini
v[0]=Interval(0.,0.);
v[1]=Interval(-100,100);
x.set(v, 1.); // ini
cout << " x avant " << x << endl;
CtcLohner ctclohner(f);
cout << " x before Lohner " << x << endl;
for (int k=0; k< x.size(); k++){
const Slice *slice = x[k].first_slice();
while(slice != NULL){
cout << " slice " << k << *slice << endl;
slice = slice->next_slice();
}
}
ctclohner.contract(x);
cout << " x after Lohner " << x << endl;
for (int k=0; k< x.size(); k++){
const Slice *slice = x[k].first_slice();
while(slice != NULL){
cout << " slice " << k << *slice << endl;
slice = slice->next_slice();
}
}
cout << " x " << x << endl;
return 0;
}
voici les résultats
x avant TubeVector (dim 2) [0, 1]↦([-100, 100] ; [-100, 100]), 2 slices
x before Lohner TubeVector (dim 2) [0, 1]↦([-100, 100] ; [-100, 100]), 2 slices
slice 0Slice [0, 0.5]↦([1, 1])[-100, 100]([-100, 100])
slice 0Slice [0.5, 1]↦([-100, 100])[-100, 100]([0, 0])
slice 1Slice [0, 0.5]↦([-100, 100])[-100, 100]([-100, 100])
slice 1Slice [0.5, 1]↦([-100, 100])[-100, 100]([-100, 100])
x after Lohner TubeVector (dim 2) [0, 1]↦([-93.6, 94.85] ; [-100, 100]), 2 slices
slice 0Slice [0, 0.5]↦([-92.35, 94.85])[-92.35, 94.85]([-92.35, 93.6])
slice 0Slice [0.5, 1]↦([-92.35, 93.6])[-93.6, 93.6]([-93.6, 93.6])
slice 1Slice [0, 0.5]↦([-100, 100])[-100, 100]([-100, 100])
slice 1Slice [0.5, 1]↦([-100, 100])[-100, 100]([-100, 100])
x TubeVector (dim 2) [0, 1]↦([-93.6, 94.85] ; [-100, 100]), 2 slices
Hi,
I'm posting this issue to ask for some help regarding the use of the Tubex library for my robotics problem.
I'm trying to perform the range only localization of an agent relative to three beacons. Because the beacons are very close together, the computation of the position of the agent is very sensitive to measurement error. That's why I'd like to use constraints programming to combine multiple measurement at different times in order to compute an hopefully more precise trajectory.
Looking at the examples and documentation, they are programs working with range only measurements, but they make use of the estimated speed of the agent. I don't have access to this information. My need is rather to combine high frequency range data to estimate speed and position. Is there a way to do it with constrain programming as is in Tubex ? Maybe you would have so educated suggestion on the way to solve this ?
My other questions is about the way to use Tubex for online computation. The examples work with the entire trajectory and all measurements created at the beginning of the code before contracting the trajectory, so i have issues understanding how I can use Tubex to do some online localization. Basically how can I Asynchronously add a new measurement to refine the estimation from the couple last measurements.
Thanks a lot for you're help. Feel free to ask any more information. I have high hopes about this library being able to solve my precision issue.
I downloaded the .tar.gz package from https://github.com/SimonRohou/tubex-lib/releases/tag/v3.0.12
I wanted to compiled it with the python bindings. My cmake commands was:
cmake -DCMAKE_INSTALL_PREFIX=/nfs/work/contredo/software/tubex/3.0.12/ibex/2.8.9/gaol/none -DWITH_PYTHON=1 ..
There was several problems:
Cmake was unable to find the correct Tubex version (because the tubex directory is not a git repo, the cmake command version_from_git failed, but it did not prevent cmake to continue). See the start of the cmake output below. [ This error also appears without -DWITH_PYTHON=1
]
The cmake command failed with the error
CMake Error at python/CMakeLists.txt:5 (add_subdirectory):
The source directory
/nfs/work/contredo/src/tubex-lib-3.0.13/python/pybind11
does not contain a CMakeLists.txt file.
I was able to fix this by downloading the pybind11 source code into the directory (the problem is that the submodule is not added into the .tar.gz archive).
This error does not appears if I remove -DWITH_PYTHON=1
.
[ 74%] Building CXX object python/CMakeFiles/tube.dir/src/core/arithmetic/tubex_py_arithmetic.cpp.o
[ 75%] Building CXX object python/CMakeFiles/tube.dir/src/core/cn/tubex_py_ContractorNetwork.cpp.o
/nfs/work/contredo/src/tubex-lib-3.0.12/python/src/core/cn/tubex_py_ContractorNetwork.cpp:21:10: fatal error: tubex_py_ContractorNetwork_docs.h: No such file or directory
#include "tubex_py_ContractorNetwork_docs.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
This error does not appears if I remove -DWITH_PYTHON=1
.
Cmake output:
-- Found Git: /usr/bin/git (found version "1.8.3.1")
CMake Warning at scripts/CMakeModules/version_from_git.cmake:66 (message):
[MunkeiVersionFromGit] Failed to execute Git: fatal: Not a git repository
(or any parent up to mount point /nfs)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Call Stack (most recent call first):
CMakeLists.txt:9 (version_from_git)
-- The CXX compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /trinity/shared/apps/cv-standard/gcc/7.5.0/bin/c++
-- Check for working CXX compiler: /trinity/shared/apps/cv-standard/gcc/7.5.0/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Full project version is
-- Configuring build for tubex-lib
-- Configuring tubex-lib in DEBUG mode as none was specified.
-- Running on system Linux-3.10.0-514.10.2.el7.x86_64 with processor x86_64
-- Using CMake 3.6.0
-- C++ compiler: GNU 7.5.0
-- Will build static libraries
-- Found IBEX version 2.8.9
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.5")
-- Failed to find sphinx-build executable (missing: SPHINX_EXECUTABLE)
-- Sphinx not found, not able to generate/install the manual.
-- Found PythonInterp: /trinity/shared/apps/local/Python/3.8.2/bin/python3.8 (found version "3.8.2")
-- Found PythonLibs: /trinity/shared/apps/local/Python/3.8.2/lib/libpython3.8.a
-- pybind11 v2.5.dev1
-- /!\ Run "make api" for generating Doxygen doc, then "cmake .." again, before "make"
-- Generating docstrings from doxygen files...
-- /!\ Enable to build doc files (generate XML Doxygen files first)
-- Performing Test HAS_FLTO
-- Performing Test HAS_FLTO - Success
-- LTO enabled
-- Configuring done
-- Generating done
-- Build files have been written to: /nfs/work/contredo/src/tubex-lib-3.0.12/build-ibex-2.8.9-gaol-none
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.