Skip to content

Commit 256e811

Browse files
authored
Merge pull request #369 from SimonRohou/codac2_dev
Towards tube documentation and official V2 release
2 parents 0825024 + e11d52a commit 256e811

71 files changed

Lines changed: 4065 additions & 1270 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# [Codac: constraint-programming for robotics](http://codac.io/v2) [![Build Status](https://github.com/codac-team/codac/workflows/.github/workflows/tests.yml/badge.svg)](https://github.com/codac-team/codac/actions)
1+
# [Codac: constraint-programming for robotics](http://codac.io) [![Build Status](https://github.com/codac-team/codac/workflows/.github/workflows/tests.yml/badge.svg)](https://github.com/codac-team/codac/actions)
22

3-
See the official website: http://codac.io/v2
3+
See the official website: http://codac.io
44

55
Codac (Catalog Of Domains And Contractors) is a C++/Python/Matlab library providing tools for interval computations and constraint programming over real numbers, trajectories and sets.
66
It has numerous applications in parameter estimation, guaranteed integration, robot localization, and provides reliable outputs.

doc/manual/_static/css/custom.css

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,21 @@ a .download:before {
179179
}
180180

181181
/* Adding VIBes + IPE logos in the lateral menu */
182-
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-8) {
182+
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-9) {
183183
background:url("../logos/logos_vibes_ipe.png") no-repeat center / contain;
184184
}
185185

186-
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-8):hover {
186+
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-9):hover {
187187
background: url("../logos/logos_vibes_ipe.png") no-repeat center / contain,
188188
var(--color-sidebar-item-background--hover);
189189
}
190190

191-
.sidebar-tree li.toctree-l1 > a.reference.internal.current:has(+ input#toctree-checkbox-8) {
191+
.sidebar-tree li.toctree-l1 > a.reference.internal.current:has(+ input#toctree-checkbox-9) {
192192
background: url("../logos/logos_vibes_ipe.png") no-repeat center / contain,
193193
var(--color-sidebar-item-background--current);
194+
}
195+
196+
figcaption .caption-text
197+
{
198+
font-style: italic;
194199
}

doc/manual/conf.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ html_theme_options = {
8989
"color-toc-item-text--active": "#FFFFFF",
9090
},
9191

92-
"announcement": "You are currently reading the new Codac documentation, which is currently in preparation. <a href=\"http://codac.io\">See the v1 website</a>.",
92+
#"announcement": "You are currently reading the new Codac documentation, which is currently in preparation. <a href=\"http://codac.io\">See the v1 website</a>.",
9393
}
9494

9595
# See https://www.sympy.org/sphinx-math-dollar/

doc/manual/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,9 @@ User manual
213213
* The class SetMembershipFunction
214214
* Extension to custom expressions
215215

216-
* Tubes
217-
* What is a tube?
218-
* Temporal domains
219-
* The Tube classes
216+
* :ref:`sec-domains-tubes`
217+
* :ref:`sec-domains-tubes-tdomain`
218+
* :ref:`sec-domains-tubes-slicedtube`
220219
* The Trajectory classes
221220
* Increasing performances using views
222221

@@ -401,6 +400,7 @@ Development
401400
manual/introduction/index.rst
402401
manual/installation/index.rst
403402
manual/intervals/index.rst
403+
manual/tubes/index.rst
404404
manual/linear/index.rst
405405
manual/functions/index.rst
406406
manual/contractors/index.rst

doc/manual/manual/functions/analytic/analytic_operators.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ Expressions involving a non-supported centered-form operation
321321
If an operator, for which the centered form is not defined, is involved in an expression, then this expression cannot be evaluated using the centered form (calculation is disabled for the entire operation). A simple natural evaluation will then be computed.
322322

323323

324+
.. _sec-functions-temporal-operator:
325+
324326
Expressions involving a temporal operator
325327
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
326328

@@ -330,7 +332,7 @@ Temporal operations for involving trajectories or tubes in analytic expressions
330332

331333
.. code-tab:: py
332334

333-
x = # some sampled trajectory...
335+
x = # some tube or sampled trajectory...
334336
g = x.as_function() # intermediate operation
335337

336338
t = ScalarVar()
@@ -340,7 +342,7 @@ Temporal operations for involving trajectories or tubes in analytic expressions
340342

341343
.. code-tab:: c++
342344

343-
x = // some sampled trajectory...
345+
x = // some tube or sampled trajectory...
344346
g = x.as_function(); // intermediate operation
345347

346348
ScalarVar t;

doc/manual/manual/installation/cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Optionally, for Python binding (*e.g.* ``choco install python --version=3.10.4``
190190

191191
.. code-block:: bash
192192
193-
choco install doxygen.install --version=1.13
193+
choco install doxygen.install --version=1.16
194194
choco install graphviz
195195
python -m pip install --upgrade pip
196196
pip install --upgrade wheel setuptools sphinx sphinx_rtd_theme furo sphinx-math-dollar sphinx_tabs breathe sphinx_togglebutton

doc/manual/manual/installation/matlab.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ Since 2019, MATLAB allows you to import Python packages into its environment. Co
1313

1414
.. code-block:: bash
1515
16-
pip install codac4matlab --pre
17-
# Option --pre has to be set because Codac v2 is only available in pre-release
16+
pip install codac4matlab
1817
1918
Once Codac is installed, you can use it in your MATLAB scripts using the following import command:
2019

doc/manual/manual/installation/python.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,20 @@ Python installation
77

88
In case you want to use Codac only with Python, then the installation procedure is simply:
99

10-
1. **Dependencies**: Ensure you have a supported version of Python (>=3.6).
10+
1. **Dependencies**: Ensure you have a supported version of Python (>=3.8).
1111
2. **Install via pip**: Use the following command to install Codac:
1212

1313
.. code-block:: bash
1414
15-
pip install codac --pre
16-
# Option --pre has to be set because Codac v2 is only available in pre-release
15+
pip install codac
1716
1817
19-
You can also update and test your Codac Python package.
18+
You can also update and test your Codac Python package:
2019

2120
* **Update via pip**: Use the following command to update your already installed Codac package:
2221
.. code-block:: bash
2322
24-
pip install codac --upgrade --pre
25-
# Option --pre has to be set because Codac v2 is only available in pre-release
23+
pip install codac --upgrade
2624
2725
2826
* **Testing the installation**: In order to verify that your installation is working properly in Python, you can run:
@@ -42,7 +40,7 @@ Depending on your configuration, you may encounter difficulties when installing
4240
4341
.. code-block:: bash
4442
45-
pip3 install --break-system-packages codac --pre
43+
pip3 install --break-system-packages codac
4644
4745
.. admonition:: macOS Big Sur and later (x86_64)
4846

doc/manual/manual/tools/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ Tools
88

99
serialization.rst
1010
registration.rst
11-
octasym.rst
11+
octasym.rst
12+
sampled_traj_npz.rst
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
.. _sec-trajectories-sampledtraj:
2+
3+
Sampled trajectories
4+
====================
5+
6+
In Python, the ``SampledTraj`` name is a convenience wrapper that mimics the
7+
C++ template deduction style. Depending on the provided samples, it builds and
8+
returns one of the following objects:
9+
10+
- ``SampledTraj_Scalar``
11+
- ``SampledTraj_Vector``
12+
- ``SampledTraj_Matrix``
13+
14+
This keeps the user-facing syntax short and consistent with ``AnalyticTraj``.
15+
16+
17+
Loading a sampled trajectory from a ``.npz`` file
18+
-------------------------------------------------
19+
20+
A sampled trajectory cannot be constructed directly from a file path.
21+
The recommended workflow is:
22+
23+
1. load the ``.npz`` file with ``numpy.load``;
24+
2. extract the arrays containing the sampling times and sampled values;
25+
3. call ``SampledTraj(t, x)``.
26+
27+
The wrapper then deduces the appropriate trajectory type from ``x``.
28+
29+
.. tabs::
30+
31+
.. group-tab:: Python
32+
33+
.. code-block:: python
34+
35+
import numpy as np
36+
from codac import *
37+
38+
data = np.load("traj_vec.npz")
39+
traj = SampledTraj(data["t"], data["x"])
40+
41+
print(type(traj))
42+
43+
In the above example, if ``x`` is a 2D array of shape ``(N,n)``, then
44+
``traj`` is a ``SampledTraj_Vector``.
45+
46+
Another example:
47+
48+
.. tabs::
49+
50+
.. group-tab:: Python
51+
52+
.. code-block:: python
53+
54+
import numpy as np
55+
from codac import *
56+
57+
t = np.array([0.0, 0.5, 1.0, 1.5])
58+
x = np.array([
59+
[0.0, 1.0],
60+
[0.5, 1.5],
61+
[1.0, 2.0],
62+
[1.5, 2.5],
63+
])
64+
65+
traj = SampledTraj(t, x)
66+
print(traj) # outputs: SampledTraj. [0, 1.5]↦[[0, 1.5][1, 2.5]], 4 pts

0 commit comments

Comments
 (0)