You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.. [#gurobi] On Linux, Trajopt now works with the free solver BPMPD, which is included with the source distribution (as a static library). However, Gurobi is better-tested with Trajopt and usually performs better.
18
20
19
-
.. [#gurobi] Good news! Trajopt now works with the excellent free solver BPMPD. It's not very well-tested at the moment, but you can use it now by checking out the devel branch and setting TRAJOPT_CONVEX_SOLVER=BPMPD.
20
21
21
22
Instructions
22
23
-------------
23
24
24
-
- install OpenRAVE 0.8 or above
25
-
26
-
.. note:: For best results, install a new version of OpenRAVE (version 0.9). Due to a recent bugfix, optimization over affine DOFs won't work with 0.8. You can install from source or use the `openrave testing <https://launchpad.net/~openrave/+archive/testing>`_ PPA.
25
+
- install OpenRAVE. To obtain OpenRAVE 0.9, you can install from source or use the `openrave testing <https://launchpad.net/~openrave/+archive/testing>`_ PPA.
27
26
28
27
29
28
- install OpenSceneGraph, CMake, boost, and Eigen using your package manager. In Ubuntu, that's::
- download and install Gurobi from `<http://www.gurobi.com>`_. You'll need to make an account and obtain a license. It's free for academic use, and non-academic users can get a free trial.
35
+
- set the environment variable GUROBI_HOME to point to the folder of your Gurobi directory that contains the folders :file:`include` and :file:`lib`. On my development machines, these are :file:`/home/username/Src/gurobi502/linux64` and :file:`/Library/gurobi501/mac64`.
32
36
33
-
- download and install Gurobi from `<http://www.gurobi.com>`_. You'll need to make an account and obtain a license. It's free for academic use, and non-academic users can get a free trial.
34
-
- set the environment variable GUROBI_HOME to point to the folder of your Gurobi directory that contains the folders :file:`include` and :file:`lib`. On my development machines, these are :file:`/home/username/Src/gurobi502/linux64` and :file:`/Library/gurobi501/mac64`.
35
37
- Clone trajopt from `github <https://github.com/joschu/trajopt>`_
36
38
- Follow the usual CMake procedure::
37
39
@@ -55,26 +57,10 @@ You can check if the build worked by typing
55
57
56
58
ctest
57
59
58
-
in the build directory. The output should look something like this::
59
-
60
-
Running tests...
61
-
Test project /Users/joschu/build/trajopt-release
62
-
Start 1: arm_to_cart_target.py
63
-
1/6 Test #1: arm_to_cart_target.py ............ Passed 2.30 sec
64
-
Start 2: arm_to_joint_target.py
65
-
2/6 Test #2: arm_to_joint_target.py ........... Passed 1.93 sec
66
-
Start 3: sco-unit
67
-
3/6 Test #3: sco-unit ......................... Passed 0.04 sec
68
-
Start 4: collision-checker-unit
69
-
4/6 Test #4: collision-checker-unit ........... Passed 0.05 sec
70
-
Start 5: planning-unit
71
-
5/6 Test #5: planning-unit .................... Passed 1.43 sec
72
-
Start 6: cast-cost-unit
73
-
6/6 Test #6: cast-cost-unit ................... Passed 0.05 sec
74
-
75
-
100% tests passed, 0 tests failed out of 7
76
-
77
-
Total Test time (real) = 8.09 sec
60
+
in the build directory. The output should look something like this:
61
+
62
+
.. include:: cmd_output/ctest.txt
63
+
:literal:
78
64
79
65
If one of the unit tests fails, you can get more diagnostic information by running with ``ctest -V``, or running the test scripts individually. The python executables are in ``SOURCE_DIR/python_examples`` and the compiled c++ executables are in ``BUILD_DIR/bin``.
80
66
@@ -94,4 +80,4 @@ Common installation problems
94
80
95
81
* *All the python tests fail* with an ``ImportError``, because ``trajoptpy`` is not found or ``ctrajoptpy`` is not found. That means your ``PYTHONPATH`` is not set correctly. It should have both the trajopt source directory ``/path/to/trajopt`` and the ``lib`` subdirectory of the build directory, ``/path/to/build_trajopt/lib``.
96
82
97
-
* *Almost all the tests fail, where OpenRAVE symbols aren't found*. Set ``LD_LIBRARY_PATH=/usr/local/lib`` or whereever libopenrave.so is. (Note: if you know how to fix this problem through RPATH settings or linker flags, please enlighten me.)
83
+
* *Almost all the tests fail, where OpenRAVE symbols aren't found*. Set ``LD_LIBRARY_PATH=/usr/local/lib`` or whereever libopenrave.so is. (Note: if you know how to fix this problem through RPATH settings or linker flags, please enlighten me.)
Copy file name to clipboardExpand all lines: doc/misc.rst
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,36 +11,38 @@ Downloading test data
11
11
12
12
First navigate to the ``bigdata`` directory, and then run the script ``download.py``.
13
13
14
+
15
+
.. _collcosts:
16
+
14
17
Collision costs
15
18
------------------
16
19
17
20
There are two types of collision penalty provided: a discrete-time penalty and a continuous-time penalty. The discrete-time penalty is based on the signed distance between the robot's links and the obstacles (including robot links). The continuous-time penalty considers the volume swept-out by the robot's links as it moves from one timestep to the next. See the paper for more details. While the discrete-time penalty will often jump through a thin obstacle, the continuous-time penalty will properly penalize such events. The only downside of the continuous-time penalty is that it currently doesn't check self-collisions. If you want to avoid self-collisions, you can add a discrete-time and continuous-time penalty.
18
21
19
-
From python, both penalties have the same API. The optional ``first_step`` and ``last_step`` arguments are the first and last timestep (inclusive) for the costs.
22
+
In JSON, you can switch between the types of cost with the ``continuous`` parameter, which is ``True`` by default.
Some costs and constraints have been implemented but are not currently documented here.
44
-
One way to find out about which ones have been implemented and what parameters are available is to look at the Doxygen documentation for the subclasses of `CostInfo<../../dox_build/structtrajopt_1_1_cost_info.html>`_ and `CntInfo <../../dox_build/structtrajopt_1_1_cnt_info.html>`_ because each item under "costs" or "constraints" in the JSON document is first converted to one of these structs when the JSON file is read.
46
+
One way to find out about which ones have been implemented and what parameters are available is to look at the Doxygen documentation for the subclasses of `TermInfo<../../dox_build/structtrajopt_1_1_term_info.html>`_ because each item under "costs" or "constraints" in the JSON document is first converted to one of these structs when the JSON file is read.
Copy file name to clipboardExpand all lines: doc/tutorial.rst
+49-3Lines changed: 49 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,16 +21,17 @@ The optimization will pause at every iteration and plot the current trajectory a
21
21
22
22
Every problem description contains four sections: basic_info, costs, constraints, and init_info (i.e., initialization info).
23
23
24
-
Here, there are two cost components: joint-space velocity, and the collision penalty. There is one constraint: the final joint state.
24
+
Here, there are two cost components: joint-space velocity, and the collision penalty. There is one constraint: the final joint state.
25
25
26
26
.. note:: Why do we use a collision cost, rather than a constraint? In the sequential convex optimization procedure, constraints get converted into costs--specifically, :math:`\ell_1` penalties (see the paper). So the difference between a constraint and an :math:`\ell_1` cost is that for a constraint, the optimizer checks to see if it is satisfied (to some tolerance), and if not, it jacks up the penalty coefficient. The thing about collisions is that it's often necessary to violate the safety margin, e.g. when you need to contact an object. So you're best off handling the logic yourself of adjusting penalties and safety margins, based on your specific problem.
27
27
28
+
See :ref:`collcosts` for more info on the collision penalty.
29
+
28
30
29
31
Move arm to pose target
30
32
-------------------------
31
33
Full source code: :file:`python_examples/arm_to_cart_target.py`
32
34
33
-
34
35
Next, let's solve the same problem, but instead of specifying the target joint position, we'll specify the target pose.
35
36
36
37
Now we use a pose constraint instead of a joint constraint:
@@ -48,6 +49,7 @@ Initialize using collision-free IK:
@@ -62,6 +64,49 @@ Whether you use a straight-line initialization, stationary initialization, or so
62
64
You can see this strategy in ``benchmark.py``, which uses four waypoints. Using this strategy, the algorithm solves 100% of 204 planning problems in the three provided scenes (tabletop, bookshelves, and kitchen_counter).
63
65
64
66
67
+
All in all, there are several ways to initialize:
68
+
69
+
- **Stationary**: Initialize with the trajectory that stands still for ``n_steps`` timesteps.
70
+
71
+
.. code-block:: python
72
+
73
+
"init_info" : {
74
+
"type" : "stationary"
75
+
}
76
+
77
+
- **With a given trajectory**:
78
+
79
+
.. code-block:: python
80
+
81
+
"init_info" : {
82
+
"type" : "given_traj"
83
+
"data" : [[ 0. , 0. , 0. ],
84
+
[ 0.111, 0.222, 0.333],
85
+
[ 0.222, 0.444, 0.667],
86
+
[ 0.333, 0.667, 1. ],
87
+
[ 0.444, 0.889, 1.333],
88
+
[ 0.556, 1.111, 1.667],
89
+
[ 0.667, 1.333, 2. ],
90
+
[ 0.778, 1.556, 2.333],
91
+
[ 0.889, 1.778, 2.667],
92
+
[ 1. , 2. , 3. ]]
93
+
}
94
+
95
+
``data`` must be a 2d array with ``n_steps`` rows, and the first row must be the robot's current DOF values
96
+
97
+
- **With a straight line in configuration space**.
98
+
99
+
.. code-block:: python
100
+
101
+
"init_info" : {
102
+
"type" : "given_traj"
103
+
"endpoint" : [ 1. , 2. , 3. ]
104
+
}
105
+
106
+
The robot's DOF values are used for the start point of the line.
107
+
108
+
109
+
65
110
.. _rollingyourown:
66
111
67
112
Rolling your own costs and constraints in python
@@ -72,7 +117,8 @@ Full source code: :file:`python_examples/this_side_up.py`
72
117
73
118
This next script shows how you can easily implement your own costs and constraints. The constraint we consider here says that a certain vector defined in the robot gripper frame must point up (in the world coordinates). For example, one might imagine that the robot is holding a glass of water, and we don't want it to spill.
74
119
75
-
The basic setup of the problem is similar to the previous examples.
120
+
The basic setup of the problem is similar to the previous examples. Before getting to the python constraint functions, we'll add some constraints to the problem in the json file, including a cartesian velocity constraint.
121
+
76
122
We set a pose constraint at the end of the trajectory. This time, we ignore the rotation (by setting :code:`rot_coefs = [0,0,0]`).
0 commit comments