robotic 0.3.3__cp311-cp311-manylinux2014_x86_64.whl → 0.3.3.dev0__cp311-cp311-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of robotic might be problematic. Click here for more details.

Files changed (65) hide show
  1. robotic/__init__.py +4 -1
  2. robotic/_robotic.pyi +45 -34
  3. robotic/_robotic.so +0 -0
  4. robotic/include/rai/Algo/RidgeRegression.h +1 -1
  5. robotic/include/rai/Core/arrayDouble.h +15 -4
  6. robotic/include/rai/Core/util.h +3 -0
  7. robotic/include/rai/DataGen/rndStableConfigs.h +1 -0
  8. robotic/include/rai/Geo/geo.h +4 -4
  9. robotic/include/rai/Geo/mesh.h +5 -5
  10. robotic/include/rai/Geo/pairCollision.h +1 -1
  11. robotic/include/rai/Geo/signedDistanceFunctions.h +2 -3
  12. robotic/include/rai/KOMO/komo.h +2 -0
  13. robotic/include/rai/KOMO/komo_NLP.h +2 -2
  14. robotic/include/rai/KOMO/manipTools.h +4 -0
  15. robotic/include/rai/Kin/kin_physx.h +6 -4
  16. robotic/include/rai/Kin/simulation.h +9 -4
  17. robotic/include/rai/LGP/LGP_TAMP_Abstraction.h +33 -0
  18. robotic/include/rai/LGP/LGP_Tool.h +4 -25
  19. robotic/include/rai/LGP/LGP_computers2.h +196 -0
  20. robotic/include/rai/LGP/NLP_Descriptor.h +5 -0
  21. robotic/include/rai/Optim/BayesOpt.h +3 -3
  22. robotic/include/rai/Optim/GlobalIterativeNewton.h +1 -1
  23. robotic/include/rai/Optim/NLP.h +5 -5
  24. robotic/include/rai/Optim/SlackGaussNewton.h +0 -10
  25. robotic/include/rai/Optim/constrained.h +1 -1
  26. robotic/include/rai/Optim/gradient.h +8 -6
  27. robotic/include/rai/Optim/lagrangian.h +3 -2
  28. robotic/include/rai/Optim/lbfgs.h +18 -0
  29. robotic/include/rai/Optim/liblbfgs.h +755 -0
  30. robotic/include/rai/Optim/m_LeastSquaresZeroOrder.h +38 -0
  31. robotic/include/rai/Optim/newton.h +3 -3
  32. robotic/include/rai/Optim/opt-ceres.h +2 -2
  33. robotic/include/rai/Optim/options.h +3 -2
  34. robotic/include/rai/Optim/primalDual.h +1 -1
  35. robotic/include/rai/Optim/testProblems_Opt.h +20 -8
  36. robotic/include/rai/Optim/utils.h +20 -79
  37. robotic/include/rai/Perception/pcl.h +10 -10
  38. robotic/librai.so +0 -0
  39. robotic/meshTool +0 -0
  40. robotic/rai-robotModels/panda/panda.g +9 -9
  41. robotic/rai-robotModels/panda/panda_withoutCollisionModels.g +3 -11
  42. robotic/rai-robotModels/pr2/pr2.g +5 -5
  43. robotic/rai-robotModels/pr2/pr2_clean.g +19 -19
  44. robotic/rai-robotModels/robotiq/robotiq_clean.g +2 -2
  45. robotic/rai-robotModels/scenarios/liftRing.g +2 -2
  46. robotic/rai-robotModels/scenarios/pandaSingle.g +1 -1
  47. robotic/rai-robotModels/tests/arm.g +15 -16
  48. robotic/ry-h5info +3 -12
  49. robotic/src/h5_helper.py +20 -5
  50. robotic/src/h5_helper.py~ +42 -0
  51. robotic/version.py +1 -1
  52. robotic-0.3.3.dev0.data/scripts/ry-h5info +23 -0
  53. {robotic-0.3.3.dist-info → robotic-0.3.3.dev0.dist-info}/METADATA +9 -9
  54. {robotic-0.3.3.dist-info → robotic-0.3.3.dev0.dist-info}/RECORD +63 -57
  55. robotic/test.py +0 -15
  56. robotic-0.3.3.data/scripts/ry-h5info +0 -32
  57. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-bot +0 -0
  58. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-info +0 -0
  59. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-meshTool +0 -0
  60. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-test +0 -0
  61. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-urdfConvert.py +0 -0
  62. {robotic-0.3.3.data → robotic-0.3.3.dev0.data}/scripts/ry-view +0 -0
  63. {robotic-0.3.3.dist-info → robotic-0.3.3.dev0.dist-info}/WHEEL +0 -0
  64. {robotic-0.3.3.dist-info → robotic-0.3.3.dev0.dist-info}/licenses/LICENSE +0 -0
  65. {robotic-0.3.3.dist-info → robotic-0.3.3.dev0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,196 @@
1
+ /* ------------------------------------------------------------------
2
+ Copyright (c) 2011-2024 Marc Toussaint
3
+ email: toussaint@tu-berlin.de
4
+
5
+ This code is distributed under the MIT License.
6
+ Please see <root-path>/LICENSE for details.
7
+ -------------------------------------------------------------- */
8
+
9
+ #pragma once
10
+
11
+ #include "../Search/ComputeNode.h"
12
+ #include "../Search/AStar.h"
13
+ #include "../Logic/folWorld.h"
14
+ #include "../Optim/NLP_GraphSolver.h"
15
+ #include "../PathAlgos/RRT_PathFinder.h"
16
+ #include "LGP_TAMP_Abstraction.h"
17
+
18
+ namespace rai {
19
+
20
+ //===========================================================================
21
+
22
+ struct LGP2_GlobalInfo {
23
+ RAI_PARAM("LGP/", int, verbose, 1)
24
+ RAI_PARAM("LGP/", double, skeleton_w0, 1.)
25
+ RAI_PARAM("LGP/", double, skeleton_wP, 2.)
26
+ RAI_PARAM("LGP/", double, waypoint_w0, 10.)
27
+ RAI_PARAM("LGP/", double, waypoint_wP, 2.)
28
+ RAI_PARAM("LGP/", int, waypointStopEvals, 1000)
29
+ RAI_PARAM("LGP/", int, rrtStopEvals, 10000)
30
+ RAI_PARAM("LGP/", double, rrtStepsize, .05)
31
+ RAI_PARAM("LGP/", double, rrtTolerance, .03)
32
+ RAI_PARAM("LGP/", double, pathCtrlCosts, 1.)
33
+ RAI_PARAM("LGP/", int, pathStepsPerPhase, 30)
34
+ RAI_PARAM("LGP/", double, collScale, 1e1)
35
+ RAI_PARAM("LGP/", bool, useSequentialWaypointSolver, false)
36
+ };
37
+
38
+ //===========================================================================
39
+
40
+ struct LGPComp2_root : ComputeNode {
41
+ // FOL_World& L;
42
+ Configuration& C;
43
+ LGP_TAMP_Abstraction& tamp;
44
+ // bool useBroadCollisions=false;
45
+ // StringA explicitCollisions;
46
+ // StringA explicitLift;
47
+ // String explicitTerminalSkeleton;
48
+ // std::shared_ptr<rai::AStar> fol_astar;
49
+ std::shared_ptr<LGP2_GlobalInfo> info;
50
+ bool fixedSkeleton=false;
51
+
52
+ LGPComp2_root(Configuration& _C, LGP_TAMP_Abstraction& _tamp, const StringA& explicitLift, const String& explicitTerminalSkeleton);
53
+
54
+ virtual void untimedCompute() {}
55
+ virtual int getNumDecisions() { return -1.; }
56
+ // virtual double effortHeuristic(){ return 11.+10.; }
57
+ virtual double branchingPenalty_child(int i);
58
+
59
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
60
+
61
+ int verbose() { return info->verbose; }
62
+ };
63
+
64
+ //===========================================================================
65
+
66
+ struct LGPComp2_Skeleton : ComputeNode {
67
+ LGPComp2_root* root=0;
68
+ int num=0;
69
+ // Skeleton skeleton;
70
+ //shared_ptr<SkeletonSolver> sol;
71
+ // StringA actionSequence;
72
+ Array<StringA> actionSequence;
73
+ // Array<Graph*> states;
74
+ // arr times;
75
+
76
+ LGPComp2_Skeleton(LGPComp2_root* _root, int num);
77
+ // LGPComp2_Skeleton(LGPComp2_root* _root, const Skeleton& _skeleton);
78
+
79
+ void createNLPs(const rai::Configuration& C);
80
+
81
+ virtual void untimedCompute();
82
+
83
+ virtual int getNumDecisions() { return -1.; }
84
+ // virtual double branchingHeuristic(){ return root->info->waypoint_w0; }
85
+ // virtual double effortHeuristic(){ return 10.+10.; }
86
+ virtual double branchingPenalty_child(int i);
87
+
88
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
89
+ };
90
+
91
+ //===========================================================================
92
+
93
+ struct LGPComp2_FactorBounds: ComputeNode {
94
+ LGPComp2_Skeleton* sket;
95
+ int seed=0;
96
+ KOMO komoWaypoints;
97
+ std::shared_ptr<NLP_Factored> nlp;
98
+ uint t=0;
99
+
100
+ LGPComp2_FactorBounds(LGPComp2_Skeleton* _sket, int rndSeed);
101
+
102
+ virtual void untimedCompute();
103
+ // virtual double effortHeuristic(){ return 10.+1.*(komoWaypoints.T); }
104
+ virtual int getNumDecisions() { return 1; }
105
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
106
+ };
107
+
108
+ //===========================================================================
109
+
110
+ struct LGPComp2_PoseBounds: ComputeNode {
111
+ LGPComp2_Skeleton* sket;
112
+ int seed=0;
113
+ uint t=0;
114
+
115
+ LGPComp2_PoseBounds(LGPComp2_Skeleton* _sket, int rndSeed);
116
+
117
+ virtual void untimedCompute();
118
+ // virtual double effortHeuristic(){ return 10.+1.*(sket->states.N); }
119
+ virtual int getNumDecisions() { return 1; }
120
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
121
+ };
122
+
123
+ //===========================================================================
124
+
125
+ struct LGPComp2_Waypoints : ComputeNode {
126
+ LGPComp2_Skeleton* sket;
127
+ int seed=0;
128
+ std::shared_ptr<KOMO> komoWaypoints;
129
+ NLP_Solver sol;
130
+ NLP_GraphSolver gsol;
131
+
132
+ LGPComp2_Waypoints(LGPComp2_Skeleton* _sket, int rndSeed);
133
+
134
+ virtual void untimedCompute();
135
+ // virtual double effortHeuristic(){ return 10.+1.*(komoWaypoints->T); }
136
+ virtual int getNumDecisions();
137
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
138
+ };
139
+
140
+ //===========================================================================
141
+
142
+ struct LGPComp2_RRTpath : ComputeNode {
143
+ LGPComp2_Waypoints* ways=0;
144
+ LGPComp2_RRTpath* prev=0;
145
+
146
+ shared_ptr<Configuration> C;
147
+ uint t;
148
+ shared_ptr<RRT_PathFinder> rrt;
149
+ arr q0, qT;
150
+ arr path;
151
+
152
+ LGPComp2_RRTpath(ComputeNode* _par, LGPComp2_Waypoints* _ways, uint _t);
153
+
154
+ virtual void untimedCompute();
155
+ // virtual double effortHeuristic(){ return 10.+1.*(ways->komoWaypoints->T-t-1); }
156
+
157
+ virtual int getNumDecisions() { return 1; }
158
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i);
159
+ };
160
+
161
+ //===========================================================================
162
+
163
+ struct LGPComp2_OptimizePath : ComputeNode {
164
+ LGPComp2_Skeleton* sket=0;
165
+ LGPComp2_Waypoints* ways=0;
166
+
167
+ shared_ptr<KOMO> komoPath;
168
+ NLP_Solver sol;
169
+
170
+ LGPComp2_OptimizePath(LGPComp2_Skeleton* _sket); //compute path from skeleton directly, without waypoints first
171
+ LGPComp2_OptimizePath(LGPComp2_Waypoints* _ways); //compute path initialized from waypoints
172
+ LGPComp2_OptimizePath(LGPComp2_RRTpath* _par, LGPComp2_Waypoints* _ways); //compute path initialized from series of RRT solutions
173
+
174
+ virtual void untimedCompute();
175
+ // virtual double effortHeuristic(){ return 0.; }
176
+
177
+ virtual double sample() {
178
+ CHECK(sol.ret, "");
179
+ CHECK(sol.ret->done, "");
180
+ if(sol.ret->ineq>1. || sol.ret->eq>4.) return 1e10;
181
+ return sol.ret->ineq+sol.ret->eq;
182
+ }
183
+
184
+ // if(opt.verbose>0) LOG(0) <<*ret;
185
+ // if(opt.verbose>1) cout <<komoPath.report(false, true, opt.verbose>2);
186
+ // if(opt.verbose>0) komoPath.view(opt.verbose>1, STRING("optimized path\n" <<*ret));
187
+ // //komoPath.checkGradients();
188
+ // if(opt.verbose>1) komoPath.view_play(opt.verbose>2);
189
+
190
+ virtual int getNumDecisions() { return 0; }
191
+ virtual std::shared_ptr<ComputeNode> createNewChild(int i) { HALT("is terminal"); }
192
+ };
193
+
194
+ //===========================================================================
195
+
196
+ }//namespace
@@ -0,0 +1,5 @@
1
+ #pragma once
2
+
3
+ #include "../KOMO/komo.h"
4
+
5
+ rai::Graph getDescriptor(KOMO& komo, int verbose);
@@ -12,7 +12,7 @@
12
12
  #include "../Core/array.h"
13
13
 
14
14
  struct BayesOpt {
15
- ScalarFunction f;
15
+ ScalarFunction& f;
16
16
  arr bounds;
17
17
 
18
18
  arr data_X;
@@ -29,12 +29,12 @@ struct BayesOpt {
29
29
  double lengthScale;
30
30
 
31
31
  //lengthScale is always relative to hi-lo
32
- BayesOpt(const ScalarFunction& f, const arr& bounds, rai::OptOptions& opt, double init_lengthScale=1., double prior_var=1.);
32
+ BayesOpt(ScalarFunction& f, const arr& bounds, rai::OptOptions& opt, double init_lengthScale=1., double prior_var=1.);
33
33
  ~BayesOpt();
34
34
 
35
35
  void step();
36
36
  void run(uint maxIt=10);
37
- void report(bool display=true, const ScalarFunction& f=ScalarFunction());
37
+ void report(bool display, ScalarFunction& f);
38
38
 
39
39
  private:
40
40
  void addDataPoint(const arr& x, double y); //and update the regressions
@@ -21,7 +21,7 @@ struct GlobalIterativeNewton {
21
21
  rai::Array<LocalMinimum> localMinima;
22
22
  LocalMinimum* best;
23
23
 
24
- GlobalIterativeNewton(const ScalarFunction& f, const arr& bounds, rai::OptOptions& opt);
24
+ GlobalIterativeNewton(ScalarFunction& f, const arr& bounds, rai::OptOptions& opt);
25
25
  ~GlobalIterativeNewton();
26
26
 
27
27
  void step();
@@ -171,7 +171,7 @@ struct SolverReturn {
171
171
  uint evals=0;
172
172
  double time=0.;
173
173
  bool feasible=false;
174
- double sos=-1., f=-1., ineq=-1., eq=-1.;
174
+ double sos=0., f=0., ineq=0., eq=0.;
175
175
  bool done=false;
176
176
  void write(ostream& os) const;
177
177
  };
@@ -180,11 +180,11 @@ stdOutPipe(SolverReturn)
180
180
  //===========================================================================
181
181
  // TRIVIAL only header
182
182
 
183
- struct Conv_NLP_TrivialFactoreded : NLP_Factored {
183
+ struct Conv_NLP2TrivialFactoredNLP : NLP_Factored {
184
184
  shared_ptr<NLP> P;
185
185
  arr x_buffer;
186
186
 
187
- Conv_NLP_TrivialFactoreded(const shared_ptr<NLP>& P) : P(P) {
187
+ Conv_NLP2TrivialFactoredNLP(const shared_ptr<NLP>& P) : P(P) {
188
188
  copySignature(*P);
189
189
  variableDimensions = { dimension };
190
190
  featureDimensions = { featureTypes.N };
@@ -199,7 +199,7 @@ struct Conv_NLP_TrivialFactoreded : NLP_Factored {
199
199
 
200
200
  //===========================================================================
201
201
 
202
- struct Conv_FactoredNLP_BandedNLP : NLP {
202
+ struct Conv_FactoredNLP2BandedNLP : NLP {
203
203
  shared_ptr<NLP_Factored> P;
204
204
  uint maxBandSize;
205
205
  bool sparseNotBanded;
@@ -207,7 +207,7 @@ struct Conv_FactoredNLP_BandedNLP : NLP {
207
207
  //buffers
208
208
  arrA J_i;
209
209
 
210
- Conv_FactoredNLP_BandedNLP(const shared_ptr<NLP_Factored>& P, uint _maxBandSize, bool _sparseNotBanded=false);
210
+ Conv_FactoredNLP2BandedNLP(const shared_ptr<NLP_Factored>& P, uint _maxBandSize, bool _sparseNotBanded=false);
211
211
 
212
212
  // trivial
213
213
  virtual arr getInitializationSample() { return P->getInitializationSample(); }
@@ -16,16 +16,6 @@
16
16
 
17
17
  namespace rai {
18
18
 
19
- struct SlackGaussNewton_Options {
20
- RAI_PARAM("sam/", double, tolerance, .01)
21
- RAI_PARAM("sam/", double, margin, .0)
22
- RAI_PARAM("sam/", int, verbose, 2)
23
-
24
- RAI_PARAM("sam/", int, maxEvals, 50)
25
- RAI_PARAM("sam/", double, stepMax, .1)
26
- RAI_PARAM("sam/", double, damping, 1e-2)
27
- };
28
-
29
19
  struct SlackGaussNewton {
30
20
  OptOptions opt;
31
21
  std::shared_ptr<NLP> nlp;
@@ -29,7 +29,7 @@ struct ConstrainedSolver {
29
29
 
30
30
  ConstrainedSolver(arr& x, arr& dual, const shared_ptr<NLP>& P, const rai::OptOptions& opt=DEFAULT_OPTIONS);
31
31
 
32
- uint run();
32
+ std::shared_ptr<SolverReturn> run();
33
33
  bool ministep();
34
34
  // void reinit();
35
35
  private:
@@ -18,7 +18,7 @@
18
18
 
19
19
  struct OptGrad {
20
20
  arr& x;
21
- ScalarFunction f;
21
+ ScalarFunction& f;
22
22
  rai::OptOptions o;
23
23
 
24
24
  enum StopCriterion { stopNone=0, stopCrit1, stopCrit2, stopCritLineSteps, stopCritEvals, stopStepFailed };
@@ -29,14 +29,14 @@ struct OptGrad {
29
29
  StopCriterion stopCriterion;
30
30
  ofstream fil;
31
31
 
32
- OptGrad(arr& x, const ScalarFunction& f, rai::OptOptions o=DEFAULT_OPTIONS);
32
+ OptGrad(arr& x, ScalarFunction& f, rai::OptOptions o=DEFAULT_OPTIONS);
33
33
  ~OptGrad();
34
34
  StopCriterion step();
35
35
  StopCriterion run(uint maxIt = 1000);
36
36
  void reinit(const arr& _x=NoArr);
37
37
  };
38
38
 
39
- inline int optGrad(arr& x, const ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
39
+ inline int optGrad(arr& x, ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
40
40
  return OptGrad(x, f, opt).run();
41
41
  }
42
42
 
@@ -48,14 +48,16 @@ inline int optGrad(arr& x, const ScalarFunction& f, rai::OptOptions opt=DEFAULT_
48
48
  /** Rprop, a fast gradient-based minimization */
49
49
  struct Rprop {
50
50
  unique_ptr<struct sRprop> self;
51
+ double fx;
52
+ uint evals;
51
53
  Rprop();
52
54
  ~Rprop();
53
55
  void init(double initialStepSize=1., double minStepSize=1e-6, double stepMaxSize=50.);
54
- bool step(arr& x, const ScalarFunction& f);
55
- uint loop(arr& x, const ScalarFunction& f, double stoppingTolerance=1e-2, double initialStepSize=1., uint maxIterations=1000, int verbose=0);
56
+ bool step(arr& x, ScalarFunction& f);
57
+ uint loop(arr& x, ScalarFunction& f, double stoppingTolerance=1e-2, double initialStepSize=1., uint maxIterations=1000, int verbose=0);
56
58
  };
57
59
 
58
- inline uint optRprop(arr& x, const ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
60
+ inline uint optRprop(arr& x, ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
59
61
  return Rprop().loop(x, f, opt.stopTolerance, opt.stepInit, opt.stopEvals, opt.verbose);
60
62
  }
61
63
 
@@ -34,13 +34,14 @@ struct LagrangianProblem : ScalarFunction, NLP {
34
34
  arr x; ///< point where P was last evaluated
35
35
  arr phi_x, J_x, H_x; ///< features at x
36
36
 
37
- LagrangianProblem(const shared_ptr<NLP>& P, const rai::OptOptions& opt);
37
+ LagrangianProblem(const shared_ptr<NLP>& P, const rai::OptOptions& opt, double muSquaredPenalty=-1., double muLogBarrier=-1.);
38
38
 
39
39
  virtual void evaluate(arr& phi, arr& J, const arr& x); //evaluate all features and (optionally) their Jacobians for state x
40
40
  virtual void getFHessian(arr& H, const arr& x); //the Hessian of the sum of all f-features (or Hessian in addition to the Gauss-Newton Hessian of all other features)
41
41
  virtual arr getInitializationSample() { return P->getInitializationSample(); }
42
+ virtual void report(ostream &os, int verbose, const char *msg){ P->report(os, verbose, msg); }
42
43
 
43
- double lagrangian(arr& dL, arr& HL, const arr& x); ///< CORE METHOD: the unconstrained scalar function F
44
+ double f(arr& dL, arr& HL, const arr& x); ///< CORE METHOD: the unconstrained scalar function F
44
45
 
45
46
  rai::Graph reportGradients(const StringA& featureNames);
46
47
  void reportMatrix(std::ostream& os);
@@ -0,0 +1,18 @@
1
+ #pragma once
2
+
3
+ #include "NLP.h"
4
+ #include "options.h"
5
+
6
+ struct OptLBFGS{
7
+ ScalarFunction& f;
8
+ uint dimension;
9
+ arr& x;
10
+ rai::OptOptions opt;
11
+
12
+ OptLBFGS(arr& x, ScalarFunction& f, rai::OptOptions o=DEFAULT_OPTIONS);
13
+
14
+ std::shared_ptr<SolverReturn> solve();
15
+
16
+ //private:
17
+ arr g;
18
+ };