-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConstraintGeneration_8py_source.html
285 lines (283 loc) · 31.5 KB
/
ConstraintGeneration_8py_source.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="author" content="Ioan A. Șucan, Mark Moll, Lydia E. Kavraki">
<meta name="generator" content="Doxygen 1.8.17"/>
<title>ompl/demos/constraint/ConstraintGeneration.py Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script src="jquery.js"></script>
<script src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="ompl.css" rel="stylesheet">
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<nav class="navbar navbar-expand-md fixed-top navbar-dark">
<a class="navbar-brand" href="./index.html">OMPL</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav mr-auto">
<li class="nav-item"><a class="nav-link" href="download.html">Download</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="docDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
<div class="dropdown-menu" aria-labelledby="docDropdown">
<a class="dropdown-item" href="https://ompl.kavrakilab.org/OMPL_Primer.pdf">Primer</a>
<a class="dropdown-item" href="installation.html">Installation</a>
<a class="dropdown-item" href="tutorials.html">Tutorials</a>
<a class="dropdown-item" href="group__demos.html">Demos</a>
<a class="dropdown-item omplapp" href="gui.html">OMPL.app GUI</a>
<a class="dropdown-item omplapp" href="webapp.html">OMPL web app</a>
<a class="dropdown-item" href="python.html">Python Bindings</a>
<a class="dropdown-item" href="planners.html">Available Planners</a>
<a class="dropdown-item" href="plannerTerminationConditions.html">Planner Termination Conditions</a>
<a class="dropdown-item" href="benchmark.html">Benchmarking Planners</a>
<a class="dropdown-item" href="spaces.html">Available State Spaces</a>
<a class="dropdown-item" href="optimalPlanning.html">Optimal Planning</a>
<a class="dropdown-item" href="constrainedPlanning.html">Constrained Planning</a>
<a class="dropdown-item" href="multiLevelPlanning.html">Multilevel Planning</a>
<a class="dropdown-item" href="FAQ.html">FAQ</a>
<div class="dropdown-divider"></div>
<div class="dropdown-header">External links</div>
<a class="dropdown-item" href="http://moveit.ros.org">MoveIt</a>
<a class="dropdown-item" href="http://plannerarena.org">Planner Arena</a>
<a class="dropdown-item" href="https://moveit.ros.org//moveit!/ros/2013/05/07/icra-motion-planning-tutorial.html">ICRA 2013 Tutorial</a>
<a class="dropdown-item" href="http://kavrakilab.org/iros2011/">IROS 2011 Tutorial</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="gallery.html">Gallery</a></li>
<li class="nav-item"><a class="nav-link" href="integration.html">OMPL Integrations</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="codeDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Code</a>
<div class="dropdown-menu" aria-labelledby="codeDropdown">
<a class="dropdown-item" href="api_overview.html">API Overview</a>
<a class="dropdown-item" href="annotated.html">Classes</a>
<a class="dropdown-item" href="files.html">Files</a>
<a class="dropdown-item" href="styleGuide.html">Style Guide</a>
<div class="dropdown-divider"></div>
<div class="dropdown-header">Repositories</div>
<a class="dropdown-item" href="https://github.com/ompl/ompl">ompl on GitHub</a>
<a class="dropdown-item" href="https://github.com/ompl/omplapp">omplapp on GitHub</a>
<div class="dropdown-divider"></div>
<div class="dropdown-header">Continuous Integration</div>
<a class="dropdown-item" href="https://travis-ci.org/ompl/ompl">ompl on Travis CI (Linux/macOS)</a>
<a class="dropdown-item" href="https://travis-ci.org/ompl/omplapp">omplapp on Travis CI (Linux/macOS)</a>
<a class="dropdown-item" href="https://ci.appveyor.com/project/mamoll/ompl">ompl on AppVeyor CI (Windows)</a>
<a class="dropdown-item" href="https://ci.appveyor.com/project/mamoll/omplapp">omplapp on AppVeyor CI (Windows)</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="https://github.com/ompl/ompl/issues">Issues</a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="communityDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Community</a>
<div class="dropdown-menu" aria-labelledby="communityDropdown">
<a class="dropdown-item" href="support.html">Get Support</a>
<a class="dropdown-item" href="developers.html">Developers/Contributors</a>
<a class="dropdown-item" href="contrib.html">Submit a Contribution</a>
<a class="dropdown-item" href="education.html">Education</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="aboutDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">About</a>
<div class="dropdown-menu" aria-labelledby="aboutDropdown">
<a class="dropdown-item" href="license.html">License</a>
<a class="dropdown-item" href="citations.html">Citations</a>
<a class="dropdown-item" href="acknowledgements.html">Acknowledgments</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="https://ompl.kavrakilab.org/blog.html">Blog</a></li>
</ul>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</div>
</nav>
<div class="container" role="main">
<div>
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_bd20f02bf35df13d389bcb0b6d4c9a2f.html">demos</a></li><li class="navelem"><a class="el" href="dir_662cc195ea6e2c3691b51ceb9de7397d.html">constraint</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">ConstraintGeneration.py</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">#!/usr/bin/python3</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span>  </div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="keyword">import</span> sympy <span class="keyword">as</span> sp</div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> sp.init_printing()</div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>  </div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"># Constraint class template that will be filled in.</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> template = <span class="stringliteral">"""class {name:s}Constraint : public ompl::base::Constraint</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="stringliteral">{{</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="stringliteral">public:</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="stringliteral"> {name:s}Constraint() : ompl::base::Constraint({ambientDim:d}, {constraintDim:d})</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="stringliteral"> {{</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="stringliteral"> }}</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="stringliteral"></span> </div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="stringliteral"> void function(const Eigen::Ref<const Eigen::VectorXd> &x, Eigen::Ref<Eigen::VectorXd> out) const override</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="stringliteral"> {{</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="stringliteral">{funcCode:s} }}</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="stringliteral"></span> </div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="stringliteral"> void jacobian(const Eigen::Ref<const Eigen::VectorXd> &x, Eigen::Ref<Eigen::MatrixXd> out) const override</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="stringliteral"> {{</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> <span class="stringliteral">{jacCode:s} }}</span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="stringliteral">}};</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="stringliteral">"""</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>  </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html"> 24</a></span> <span class="keyword">class </span><a class="code" href="classConstraintGeneration_1_1Constraint.html">Constraint</a>:</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  </div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="keyword">def </span>__init__(self, name, n):</div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>  self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#aba6ccbfe2cc11c39dd8a0e3d020cddf0">name_</a> = name</div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="comment"># Generate an array of variables to use.</span></div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">variables_</a> = [sp.Symbol(<span class="stringliteral">"x[{:d}]"</span>.format(i), real=<span class="keyword">True</span>) <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(n)]</div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a> = []</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  </div>
<div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html#a165da2cdf386ccdfd7c931f87ee9f9ae"> 32</a></span>  <span class="keyword">def </span><a class="code" href="classConstraintGeneration_1_1Constraint.html#a165da2cdf386ccdfd7c931f87ee9f9ae">__getitem__</a>(self, index):</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="stringliteral">"""Return the index^th variable."""</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">return</span> self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">variables_</a>[index]</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  </div>
<div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html#a5627e97b0bd780d9e4be618fc00c56a8"> 36</a></span>  <span class="keyword">def </span><a class="code" href="classConstraintGeneration_1_1Constraint.html#a5627e97b0bd780d9e4be618fc00c56a8">getVars</a>(self):</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <span class="stringliteral">"""Create a variable vector."""</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">return</span> sp.Matrix(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">variables_</a>)</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  </div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html#a2e1cff84378f70039fb1f3b7277a15c7"> 40</a></span>  <span class="keyword">def </span><a class="code" href="classConstraintGeneration_1_1Constraint.html#a2e1cff84378f70039fb1f3b7277a15c7">getConstraints</a>(self):</div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>  <span class="stringliteral">"""Create a constraint function vector."""</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">return</span> sp.Matrix(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a>)</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html#a7db25568883415f3d14c054eb6799410"> 44</a></span>  <span class="keyword">def </span><a class="code" href="classConstraintGeneration_1_1Constraint.html#a7db25568883415f3d14c054eb6799410">addConstraint</a>(self, f):</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="stringliteral">"""Add some symbolic function of variables to the list of constraints."""</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a>.append(f)</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  </div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classConstraintGeneration_1_1Constraint.html#a5bcee1c9ab76ffaaa5c4a97b1dacb9cd"> 48</a></span>  <span class="keyword">def </span><a class="code" href="classConstraintGeneration_1_1Constraint.html#a5bcee1c9ab76ffaaa5c4a97b1dacb9cd">jacobian</a>(self):</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="stringliteral">"""Compute the Jacobian of the current list of constraints."""</span></div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">return</span> self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a2e1cff84378f70039fb1f3b7277a15c7">getConstraints</a>().<a class="code" href="classConstraintGeneration_1_1Constraint.html#a5bcee1c9ab76ffaaa5c4a97b1dacb9cd">jacobian</a>(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">variables_</a>)</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  <span class="keyword">def </span>funcCode(self):</div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  ss = <span class="stringliteral">""</span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(len(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a>)):</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  ss += <span class="stringliteral">' '</span> * 8</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  ss += sp.printing.cxxcode(sp.simplify(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a>[i]),</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  assign_to=<span class="stringliteral">"out[{:d}]"</span>.format(i))</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  ss += <span class="stringliteral">"\n"</span></div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keywordflow">return</span> ss</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  </div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keyword">def </span>jacCode(self):</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  ss = <span class="stringliteral">""</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  jac = self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a5bcee1c9ab76ffaaa5c4a97b1dacb9cd">jacobian</a>()</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <span class="keywordflow">for</span> i <span class="keywordflow">in</span> range(jac.shape[0]):</div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="keywordflow">for</span> j <span class="keywordflow">in</span> range(jac.shape[1]):</div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  ss += <span class="stringliteral">' '</span> * 8</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  ss += sp.printing.cxxcode(sp.simplify(jac[i, j]),</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  assign_to=<span class="stringliteral">"out({:d}, {:d})"</span>.format(i, j))</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  ss += <span class="stringliteral">"\n"</span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keywordflow">return</span> ss</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  </div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="keyword">def </span>toCode(self):</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="keywordflow">return</span> template.format(name=self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#aba6ccbfe2cc11c39dd8a0e3d020cddf0">name_</a>,</div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  ambientDim=len(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">variables_</a>),</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  constraintDim=len(self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">constraints_</a>),</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  funcCode=self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#ad307a0786d48fb8d91cc0030b058690f">funcCode</a>(),</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  jacCode=self.<a class="code" href="classConstraintGeneration_1_1Constraint.html#afc79dd9354fd42abd378a1c12a9afe97">jacCode</a>())</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  </div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span> <span class="keywordflow">if</span> __name__ == <span class="stringliteral">"__main__"</span>:</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="comment"># Sphere constraint</span></div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  s = <a class="code" href="classConstraintGeneration_1_1Constraint.html">Constraint</a>(<span class="stringliteral">"Sphere"</span>, 3)</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  s.addConstraint(s.getVars().norm() - 1)</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  print(s.toCode())</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="comment"># Torus constraint</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  t = <a class="code" href="classConstraintGeneration_1_1Constraint.html">Constraint</a>(<span class="stringliteral">"Torus"</span>, 3)</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  </div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  outer_radius = 3</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  inner_radius = 1</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  c = t.getVars()</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  c[2] = 0</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  torus = (t.getVars() - outer_radius * c / c.norm()).norm() - inner_radius</div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  t.addConstraint(torus)</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  </div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  print(t.toCode())</div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a7db25568883415f3d14c054eb6799410"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a7db25568883415f3d14c054eb6799410">ConstraintGeneration.Constraint.addConstraint</a></div><div class="ttdeci">def addConstraint(self, f)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00044">ConstraintGeneration.py:44</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_ad307a0786d48fb8d91cc0030b058690f"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#ad307a0786d48fb8d91cc0030b058690f">ConstraintGeneration.Constraint.funcCode</a></div><div class="ttdeci">def funcCode(self)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00052">ConstraintGeneration.py:52</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a82d60e3b491f27545a8b968f9b1000d1"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a82d60e3b491f27545a8b968f9b1000d1">ConstraintGeneration.Constraint.constraints_</a></div><div class="ttdeci">constraints_</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00030">ConstraintGeneration.py:30</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a5bcee1c9ab76ffaaa5c4a97b1dacb9cd"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a5bcee1c9ab76ffaaa5c4a97b1dacb9cd">ConstraintGeneration.Constraint.jacobian</a></div><div class="ttdeci">def jacobian(self)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00048">ConstraintGeneration.py:48</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_aba6ccbfe2cc11c39dd8a0e3d020cddf0"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#aba6ccbfe2cc11c39dd8a0e3d020cddf0">ConstraintGeneration.Constraint.name_</a></div><div class="ttdeci">name_</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00027">ConstraintGeneration.py:27</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html">ConstraintGeneration.Constraint</a></div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00024">ConstraintGeneration.py:24</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a165da2cdf386ccdfd7c931f87ee9f9ae"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a165da2cdf386ccdfd7c931f87ee9f9ae">ConstraintGeneration.Constraint.__getitem__</a></div><div class="ttdeci">def __getitem__(self, index)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00032">ConstraintGeneration.py:32</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a5627e97b0bd780d9e4be618fc00c56a8"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a5627e97b0bd780d9e4be618fc00c56a8">ConstraintGeneration.Constraint.getVars</a></div><div class="ttdeci">def getVars(self)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00036">ConstraintGeneration.py:36</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a13a7371058c1e1e2da060d77a623bcbe"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a13a7371058c1e1e2da060d77a623bcbe">ConstraintGeneration.Constraint.variables_</a></div><div class="ttdeci">variables_</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00029">ConstraintGeneration.py:29</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_afc79dd9354fd42abd378a1c12a9afe97"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#afc79dd9354fd42abd378a1c12a9afe97">ConstraintGeneration.Constraint.jacCode</a></div><div class="ttdeci">def jacCode(self)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00061">ConstraintGeneration.py:61</a></div></div>
<div class="ttc" id="aclassConstraintGeneration_1_1Constraint_html_a2e1cff84378f70039fb1f3b7277a15c7"><div class="ttname"><a href="classConstraintGeneration_1_1Constraint.html#a2e1cff84378f70039fb1f3b7277a15c7">ConstraintGeneration.Constraint.getConstraints</a></div><div class="ttdeci">def getConstraints(self)</div><div class="ttdef"><b>Definition:</b> <a href="ConstraintGeneration_8py_source.html#l00040">ConstraintGeneration.py:40</a></div></div>
</div>
<footer class="footer">
<div class="container">
<a href="http://www.kavrakilab.org">Kavraki Lab</a> •
<a href="https://www.cs.rice.edu">Department of Computer Science</a> •
<a href="https://www.rice.edu">Rice University</a><br/>
Funded in part by the <a href="https://www.nsf.gov">National Science Foundation</a><br/>
Documentation generated by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.8.17
</div>
</footer>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-9156598-2', 'auto');
ga('send', 'pageview');
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>