Skip to content

Commit e745d1f

Browse files
committed
improve docstrings (slightly)
1 parent cdad221 commit e745d1f

File tree

10 files changed

+88
-25
lines changed

10 files changed

+88
-25
lines changed

README.md

+2-11
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,12 @@ TOPP-RA is a library for time-parameterizing robot trajectories subject to kinem
99

1010
If you use this library for your research, please reference the accompanying paper [«A new approach to Time-Optimal Path Parameterization based on Reachability Analysis»](https://arxiv.org/abs/1707.07239), *IEEE Transactions on Robotics*, vol. 34(3), pp. 645–659, 2018.
1111

12+
For documentations and some tutorials, see [TOPP-RA's documentation](https://hungpham2511.github.io/toppra/).
13+
1214
# Installation
1315
## Basic functionality (robotic manipulators)
1416

1517

16-
Install
17-
[qpOASES](https://projects.coin-or.org/qpOASES/wiki/QpoasesInstallation) by
18-
following the steps below:
19-
``` shell
20-
git clone https://github.com/hungpham2511/qpOASES
21-
cd qpOASES/ && mkdir bin && make
22-
cd interfaces/python/
23-
pip install cython
24-
python setup.py install --user
25-
```
26-
2718
Finally, install `toppra` with
2819
``` sh
2920
git clone https://github.com/hungpham2511/toppra

docs/source/index.rst

+5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ parametrize trajectories subject to velocity and acceleration
4141
constraints. Some advanced functionalities require `openrave`, `cvxpy`
4242
and so on. See :doc:`installation` for the full instruction.
4343

44+
.. toctree::
45+
:maxdepth: 2
46+
47+
installation
48+
4449
Tutorials
4550
~~~~~~~~~~~~~~~~~~
4651
.. toctree::

docs/source/tutorials/2_can_linear_constraints.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
2: Canonical Linear Constraint
2-
========================================
1+
2: Simple [1]_ Second-Order Constraint
2+
====================================
33

44
TOPP-RA *can not* account for arbitrary constraint; it can only handle
55
those constraints of certain kinds. One class of constraints TOPP-RA
66
supports is Second-Order constraint.
77

88
This class of constraint is quite general. Commonly found constraints
9-
such as joint acceleration, tool tip Cartesian acceleration,
9+
such as joint acceleration [2]_, tool tip Cartesian acceleration,
1010
interaction force on the robot base, are all Second-Order constraints.
1111

1212
Background
@@ -177,6 +177,14 @@ Download the example given this tutorial here
177177
:download:`cartesian_accel.py <../../../examples/cartesian_accel.py>`.
178178

179179

180+
.. [1] The form of Second-Order constraint presented in this tutorial
181+
is not the most general, hence, they are simple.
180182
183+
.. [2] Cartesian velocity constraint, as well as joint velocity
184+
constraint, are not Second-Order Constraint. They are
185+
First-Order constraints. These constraints will be treated in
186+
near future. For now, see how
187+
:class:`toppra.constraint.JointVelocityConstraint` is
188+
implemented.
181189
182190

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
extra_compile_args=['-O1'],
3434
include_dirs=[np.get_include()])
3535

36-
3736
EXTENSIONS = [ext_1, ext_2]
3837

3938
if __name__ == "__main__":

toppra/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
from .planning_utils import retime_active_joints_kinematics, create_rave_torque_path_constraint
1717
import constraint as constraint
1818
import algorithm as algorithm
19+
import solverwrapper as solverwrapper
1920

2021
setup_logging()

toppra/algorithm/reachabilitybased/time_optimal_algorithm.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,22 @@
66

77

88
class TOPPRA(ReachabilityAlgorithm):
9-
""" The Time-Optimal Path Parameterization based on Reachability Analysis algorithm.
9+
"""Time-Optimal Path Parameterization based on Reachability
10+
Analysis (TOPPRA).
1011
1112
Parameters
1213
----------
13-
constraint_list: list of Constraint
14-
path: Interpolator
14+
constraint_list: :class:`~toppra.constraint.Constraint` list
15+
List of constraints to which the robotic system is subjected to.
16+
path: :class:`~toppra.Interpolator`
17+
Input geometric path.
1518
gridpoints: array, optional
19+
Gridpoints for discretization of the geometric path. The start
20+
and end points must agree with the geometric path's domain.
1621
solver_wrapper: str, optional
17-
Name of the solver to use.
22+
Name of the solver wrapper to use.
23+
See :class:`toppra.solverwrapper.hotqpOASESSolverWrapper`,
24+
:class:`toppra.solverwrapper.seidelWrapper`
1825
1926
"""
2027

toppra/constraint/canonical_conic.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,20 @@ class RobustCanonicalLinearConstraint(CanonicalConicConstraint):
5252
in a centered ellipsoid:
5353
5454
.. math::
55-
[\Delta a[i, j], \Delta b[i, j], \Delta c[i, j]]^\top = diag(ru, rx, rc) \mathbf e,
55+
56+
[\Delta a[i, j], \Delta b[i, j], \Delta c[i, j]]^\\top = diag(ru, rx, rc) \mathbf e,
5657
5758
where \|\mathbf e\|_2 \leq 1.
5859
5960
Parameters
6061
----------
61-
cnst: `CanonicalLinearConstraint`
62-
The base CanonicalLinearConstraint.
62+
cnst: :class:`~toppra.constraint.CanonicalLinearConstraint`
63+
The base constraint to robustify.
6364
ellipsoid_axes_lengths: (3,)array
6465
Lengths of the axes of the perturbation ellipsoid. Must all be
6566
non-negative.
67+
discretization_scheme: :class:`~.constraint.DiscretizationType`
68+
Constraint discretization scheme to use.
6669
"""
6770
def __init__(self, cnst, ellipsoid_axes_lengths, discretization_scheme=DiscretizationType.Collocation):
6871
super(RobustCanonicalLinearConstraint, self).__init__()

toppra/constraint/constraint.py

+8
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ class ConstraintType(Enum):
1010

1111

1212
class DiscretizationType(Enum):
13+
"""Enum to mark different Discretization Scheme for constraint.
14+
15+
1. `Collocation`: smaller problem size, but lower accuracy.
16+
2. `Interplation`: larger problem size, but higher accuracy.
17+
18+
In general, the difference in speed is not too large. Should use
19+
Interpolation if possible.
20+
"""
1321
Collocation = 0
1422
Interpolation = 1
1523

toppra/solverwrapper/cy_seidel_solverwrapper.pyx

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# cython: embedsignature=True
12
import numpy as np
23
cimport numpy as np
34
from libc.math cimport abs, pow, isnan
@@ -352,6 +353,20 @@ cdef LpSol cy_solve_lp2d(double[:] v, double[:] a, double[:] b, double[:] c, dou
352353
return sol
353354

354355
cdef class seidelWrapper:
356+
""" A solver wrapper that implements Seidel's LP algorithm.
357+
358+
This wrapper can only be used if there is only Canonical Linear
359+
Constraints.
360+
361+
Parameters
362+
----------
363+
constraint_list: list of :class:`.Constraint`
364+
The constraints the robot is subjected to.
365+
path: :class:`.Interpolator`
366+
The geometric path.
367+
path_discretization: array
368+
The discretized path positions.
369+
"""
355370
cdef:
356371
list constraints, _params
357372
unsigned int N, nV, nC, nCons
@@ -367,6 +382,20 @@ cdef class seidelWrapper:
367382

368383
# @cython.profile(True)
369384
def __init__(self, list constraint_list, path, path_discretization):
385+
""" A solver wrapper that implements Seidel's LP algorithm.
386+
387+
This wrapper can only be used if there is only Canonical Linear
388+
Constraints.
389+
390+
Parameters
391+
----------
392+
constraint_list: list of :class:`.Constraint`
393+
The constraints the robot is subjected to.
394+
path: :class:`.Interpolator`
395+
The geometric path.
396+
path_discretization: array
397+
The discretized path positions.
398+
"""
370399
self.constraints = constraint_list
371400
self.path = path
372401
path_discretization = np.array(path_discretization)
@@ -485,7 +514,7 @@ cdef class seidelWrapper:
485514
& x_{min} \leq x \leq x_{max} \\\\
486515
& x_{next, min} \leq x + 2 \Delta_i u \leq x_{next, max},
487516
488-
NOTE: if x_min == x_max, one can solve an LP instead of a 2D
517+
TODO if x_min == x_max, one can solve an LP instead of a 2D
489518
LP. This optimization is currently not implemented.
490519
491520
Parameters

toppra/solverwrapper/ecos_solverwrapper.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,20 @@
1111

1212

1313
class ecosWrapper(SolverWrapper):
14-
""" A wrapper that handles linear and conic-quadratic constraints using ECOS.
15-
14+
"""A solver wrapper that handles linear and conic-quadratic constraints using ECOS.
15+
16+
:class:`ecosWrapper` and :class:`cvxpyWrapper` are the only
17+
wrappers that can handle conic-quadratic constraints, which are
18+
necessary to compute robust path parameterization.
19+
20+
Attributes
21+
----------
22+
constraints : list of `Constraint`
23+
Constraints on the robot system.
24+
path : Interpolator
25+
The geometric path to be time-parametrized.
26+
path_discretization: array
27+
The discretization grid use to discretize the geometric path.
1628
1729
"""
1830
def __init__(self, constraint_list, path, path_discretization):

0 commit comments

Comments
 (0)