robotic 0.2.9.dev2__cp312-cp312-manylinux2014_x86_64.whl → 0.3.1__cp312-cp312-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 (77) hide show
  1. robotic/__init__.py +3 -3
  2. robotic/_robotic.pyi +17 -11
  3. robotic/_robotic.so +0 -0
  4. robotic/include/rai/Algo/rungeKutta.h +1 -1
  5. robotic/include/rai/Control/TimingMPC.h +2 -2
  6. robotic/include/rai/Core/array.h +64 -40
  7. robotic/include/rai/Core/array.ipp +244 -80
  8. robotic/include/rai/Core/arrayDouble.h +10 -13
  9. robotic/include/rai/Core/graph.h +23 -2
  10. robotic/include/rai/Core/h5.h +3 -1
  11. robotic/include/rai/Geo/fclInterface.h +3 -1
  12. robotic/include/rai/Geo/geo.h +4 -1
  13. robotic/include/rai/Geo/mesh.h +11 -5
  14. robotic/include/rai/Geo/pairCollision.h +4 -4
  15. robotic/include/rai/Gui/RenderData.h +4 -3
  16. robotic/include/rai/Gui/opengl.h +1 -1
  17. robotic/include/rai/KOMO/komo.h +1 -0
  18. robotic/include/rai/KOMO/manipTools.h +1 -1
  19. robotic/include/rai/Kin/F_forces.h +1 -1
  20. robotic/include/rai/Kin/dof_forceExchange.h +4 -4
  21. robotic/include/rai/Kin/frame.h +4 -3
  22. robotic/include/rai/Kin/kin.h +24 -15
  23. robotic/include/rai/Kin/kin_physx.h +2 -2
  24. robotic/include/rai/Kin/simulation.h +1 -0
  25. robotic/include/rai/Logic/folWorld.h +1 -1
  26. robotic/include/rai/Optim/testProblems_Opt.h +2 -2
  27. robotic/include/rai/Optim/utils.h +2 -2
  28. robotic/include/rai/PathAlgos/ConfigurationProblem.h +3 -2
  29. robotic/include/rai/PathAlgos/RRT_PathFinder.h +1 -1
  30. robotic/librai.so +0 -0
  31. robotic/meshTool +0 -0
  32. robotic/mujoco-import.py +5 -7
  33. robotic/rai-robotModels/g1/g1.g +11 -2
  34. robotic/rai-robotModels/g1/g1_29dof_conv.yml +64 -0
  35. robotic/rai-robotModels/objects/shelf.g +1 -1
  36. robotic/rai-robotModels/panda/panda.g +1 -1
  37. robotic/rai-robotModels/panda/panda_arm_hand_conv.g +22 -22
  38. robotic/rai-robotModels/panda/panda_arm_hand_conv.yml +24 -0
  39. robotic/rai-robotModels/pr2/pr2.g +6 -6
  40. robotic/rai-robotModels/pr2/pr2_clean.g +114 -114
  41. robotic/rai-robotModels/pr2/pr2_modifications.g +2 -2
  42. robotic/rai-robotModels/ranger/ranger.g +3 -3
  43. robotic/rai-robotModels/robotiq/robotiq.g +1 -1
  44. robotic/rai-robotModels/robotiq/robotiq_arg2f_85_model_conv.yml +19 -0
  45. robotic/rai-robotModels/scenarios/panda_fixRobotiq.g +3 -3
  46. robotic/rai-robotModels/tests/arm.g +11 -11
  47. robotic/rai-robotModels/ur10/ur10.g +1 -1
  48. robotic/rai-robotModels/ur10/ur10_clean.g +8 -8
  49. robotic/ry-h5info +2 -2
  50. robotic/ry-test +2 -1
  51. robotic/ry-urdfConvert.py +3 -2
  52. robotic/src/__init__.py +0 -0
  53. robotic/{cleanMeshes.py → src/cleanMeshes.py} +0 -0
  54. robotic/src/meshlabFilters.mlx +20 -0
  55. robotic/src/{config_mujoco.py → mujoco_io.py} +21 -16
  56. robotic/src/{config_urdf.py → urdf_io.py} +0 -0
  57. robotic/src/yaml_helper.py +0 -0
  58. robotic/test.py +15 -0
  59. robotic/version.py +1 -1
  60. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-h5info +2 -2
  61. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-test +2 -1
  62. robotic-0.3.1.data/scripts/ry-urdfConvert.py +74 -0
  63. {robotic-0.2.9.dev2.dist-info → robotic-0.3.1.dist-info}/METADATA +9 -15
  64. {robotic-0.2.9.dev2.dist-info → robotic-0.3.1.dist-info}/RECORD +70 -69
  65. {robotic-0.2.9.dev2.dist-info → robotic-0.3.1.dist-info}/WHEEL +1 -1
  66. robotic/rai-robotModels/g1/g1_29dof_conv.g +0 -77
  67. robotic/rai-robotModels/robotiq/robotiq_arg2f_85_model_conv.g +0 -21
  68. robotic/ry-urdf2rai +0 -222
  69. robotic/ry-urdf2yaml +0 -250
  70. robotic-0.2.9.dev2.data/scripts/ry-urdf2rai +0 -222
  71. robotic-0.2.9.dev2.data/scripts/ry-urdf2yaml +0 -250
  72. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-bot +0 -0
  73. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-info +0 -0
  74. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-meshTool +0 -0
  75. {robotic-0.2.9.dev2.data → robotic-0.3.1.data}/scripts/ry-view +0 -0
  76. {robotic-0.2.9.dev2.dist-info → robotic-0.3.1.dist-info}/licenses/LICENSE +0 -0
  77. {robotic-0.2.9.dev2.dist-info → robotic-0.3.1.dist-info}/top_level.txt +0 -0
@@ -38,9 +38,6 @@ struct Serializable {
38
38
  namespace rai {
39
39
 
40
40
  //struct FileToken;
41
- struct SparseVector;
42
- struct SparseMatrix;
43
- struct RowShifted;
44
41
 
45
42
  // OLD, TODO: hide -> array.cpp
46
43
  extern bool useLapack;
@@ -66,6 +63,7 @@ extern const char* arrayBrackets;
66
63
 
67
64
  namespace rai {
68
65
 
66
+ #if 0
69
67
  /** Simple array container to store arbitrary-dimensional arrays (tensors).
70
68
  Can buffer more memory than necessary for faster
71
69
  resize; enables non-const reference of subarrays; enables fast
@@ -105,7 +103,7 @@ struct ArrayDouble : public Array<double> {
105
103
  using Array<double>::elem; //adopt all elem(..) methods
106
104
  double& elem(int i, int j); //access that also handles sparse matrices
107
105
  using Array<double>::operator(); //adopt all double& operator()(..) methods
108
- ArrayDouble operator()(std::pair<int, int> I) const { ArrayDouble z; z.referToRange(*this, I.first, I.second); return z; }
106
+ ArrayDouble operator()(std::pair<int, int> I) const { ArrayDouble z; z.referToRange(*this, I.first, I.second+1); return z; }
109
107
  ArrayDouble operator()(int i, std::pair<int, int> J) const { ArrayDouble z; z.referToRange(*this, i, J.first, J.second); return z; }
110
108
  ArrayDouble operator()(int i, int j, std::initializer_list<int> K) const;
111
109
  ArrayDouble operator[](int i) const { ArrayDouble z; z.referToDim(*this, i); return z; }
@@ -147,11 +145,10 @@ struct ArrayDouble : public Array<double> {
147
145
 
148
146
  void write(std::ostream& os=stdCout(), const char* ELEMSEP=nullptr, const char* LINESEP=nullptr, const char* BRACKETS=nullptr, bool dimTag=false, bool binary=false) const;
149
147
  };
148
+ #endif
150
149
 
151
150
  }
152
151
 
153
- typedef rai::ArrayDouble arr;
154
-
155
152
  //===========================================================================
156
153
  ///
157
154
  /// @name alternative iterators
@@ -328,7 +325,7 @@ inline arr zeros(uint d0, uint d1) { return zeros(uintA{d0, d1}); }
328
325
  inline arr zeros(uint d0, uint d1, uint d2) { return zeros(uintA{d0, d1, d2}); }
329
326
 
330
327
  /// return array of c's
331
- inline arr consts(const double& c, const uintA& d) { arr z; z.resize(d); z.setUni(c); return z; }
328
+ inline arr consts(const double& c, const uintA& d) { arr z; z.resize(d); z.setConst(c); return z; }
332
329
  /// return VECTOR of c's
333
330
  inline arr consts(const double& c, uint n) { return consts(c, uintA{n}); }
334
331
  /// return matrix of c's
@@ -357,16 +354,14 @@ inline arr randn(uint d0, uint d1) { return randn(uintA{d0, d1}); }
357
354
 
358
355
  /// return a grid with different lo/hi/steps in each dimension
359
356
  arr grid(const arr& lo, const arr& hi, const uintA& steps);
360
- /// return a grid (1D: range) split in 'steps' steps
361
- inline arr grid(uint dim, double lo, double hi, uint steps) { arr g; g.setGrid(dim, lo, hi, steps); return g; }
362
357
  /// return a 1D-grid
363
- inline arr range(double lo, double hi, uint steps) { arr g; g.setGrid(1, lo, hi, steps).reshape(-1); return g; }
358
+ inline arr range(double lo, double hi, uint steps) { return rai::grid(1, lo, hi, steps).reshape(-1); }
364
359
  //inline uintA range(uint n) { uintA r; r.setStraightPerm(n); return r; }
365
360
 
366
361
  arr repmat(const arr& A, uint m, uint n);
367
362
 
368
363
  //inline uintA randperm(uint n) { uintA z; z.setRandomPerm(n); return z; }
369
- inline arr linspace(double base, double limit, uint n) { arr z; z.setGrid(1, base, limit, n).reshape(-1); return z; }
364
+ inline arr linspace(double base, double limit, uint n) { return rai::grid(1, base, limit, n).reshape(-1); }
370
365
  arr logspace(double base, double limit, uint n);
371
366
 
372
367
  void normalizeWithJac(arr& y, arr& J, double eps=0.);
@@ -431,8 +426,8 @@ arr reshapeColor(const arr& col, int d0=-1);
431
426
 
432
427
  void scanArrFile(const char* name);
433
428
 
434
- arr finiteDifferenceGradient(const ScalarFunction& f, const arr& x, arr& Janalytic=NoArr);
435
- arr finiteDifferenceJacobian(const VectorFunction& f, const arr& _x, arr& Janalytic=NoArr);
429
+ arr finiteDifferenceGradient(const ScalarFunction& f, const arr& x, arr& Janalytic=NoArr, double eps=1e-8);
430
+ arr finiteDifferenceJacobian(const VectorFunction& f, const arr& _x, arr& Janalytic=NoArr, double eps=1e-8);
436
431
  bool checkGradient(const ScalarFunction& f, const arr& x, double tolerance, bool verbose=false);
437
432
  bool checkHessian(const ScalarFunction& f, const arr& x, double tolerance, bool verbose=false);
438
433
  bool checkJacobian(const VectorFunction& f, const arr& x, double tolerance, bool verbose=false, const StringA& featureNames= {});
@@ -612,6 +607,8 @@ inline bool isEmptyShape(const arr& X) { return X.special && X.special->type==
612
607
  inline bool isRowShifted(const arr& X) { return X.special && X.special->type==SpecialArray::RowShiftedST; }
613
608
  inline bool isSparseMatrix(const arr& X) { return X.special && X.special->type==SpecialArray::sparseMatrixST; }
614
609
  inline bool isSparseVector(const arr& X) { return X.special && X.special->type==SpecialArray::sparseVectorST; }
610
+ void special_copy(arr& x, const arr& a);
611
+ void special_write(ostream& os, const arr& x);
615
612
 
616
613
  struct RowShifted : SpecialArray {
617
614
  arr& Z; ///< references the array itself
@@ -25,6 +25,7 @@ struct Graph;
25
25
  struct ParseInfo;
26
26
  struct RenderingInfo;
27
27
  struct GraphEditCallback;
28
+ struct BracketOp;
28
29
  typedef Array<Node*> NodeL;
29
30
  typedef Array<GraphEditCallback*> GraphEditCallbackL;
30
31
  }
@@ -139,9 +140,10 @@ struct Graph : NodeL {
139
140
 
140
141
  //
141
142
  template<class T> Node* set(const char* key, const T& x){ Node* n = findNodeOfType(typeid(T), key); if(n) n->as<T>()=x; else n=add<T>(key, x); return n; }
143
+ Node* set(Node* _n){ Node* n = findNodeOfType(_n->type, _n->key); if(n) n->copyValue(_n); else n=_n->newClone(*this); return n; }
142
144
 
143
145
  //-- get nodes
144
- Node* operator[](const char* key) const { return findNode(key); } ///< returns nullptr if not found
146
+ BracketOp operator[](const char* key); ///< returns nullptr if not found
145
147
  Node* getNode(const char* key) const { return findNode(key); } ///< returns nullptr if not found
146
148
  Node* getEdge(Node* p1, Node* p2) const;
147
149
  Node* getEdge(const NodeL& parents) const;
@@ -190,7 +192,7 @@ struct Graph : NodeL {
190
192
  void write(std::ostream& os=cout, const char* ELEMSEP=",\n", const char* BRACKETS=0, int indent=-1, bool yamlMode=false, bool binary=false) const;
191
193
  void writeDot(std::ostream& os, bool withoutHeader=false, bool defaultEdges=false, int nodesOrEdges=0, int focusIndex=-1, bool subGraphsAsNodes=false);
192
194
  void writeHtml(std::ostream& os, std::istream& is);
193
- void writeYaml(std::ostream& os);
195
+ void writeYaml(std::ostream& os) const;
194
196
  void writeParseInfo(std::ostream& os);
195
197
 
196
198
  void displayDot(Node* highlight=nullptr);
@@ -289,6 +291,21 @@ struct NodeInitializer {
289
291
  /// pipe node initializers into a graph (to append nodes)
290
292
  inline Graph& operator<<(Graph& G, const NodeInitializer& n) { G.addInit(n); return G; }
291
293
 
294
+ //===========================================================================
295
+
296
+ struct BracketOp {
297
+ Graph& G;
298
+ const char* key;
299
+ Node *n;
300
+ template<class T> void operator=(const T& x){
301
+ if(!n) n = G.add<T>(key, x);
302
+ else n->as<T>() = x;
303
+ }
304
+ Node* operator->() { return n; }
305
+ operator Node*() { return n; }
306
+ //T& operator->() { return *p; }
307
+ };
308
+
292
309
  //===========================================================================
293
310
  //
294
311
  // algorithms
@@ -482,6 +499,10 @@ template<class T> NodeInitializer::NodeInitializer(const char* key, const String
482
499
  n = G.add<T>(key, x);
483
500
  }
484
501
 
502
+ inline BracketOp Graph::operator[](const char* key) {
503
+ return BracketOp{*this, key, findNode(key)};
504
+ }
505
+
485
506
  template<class T> T& Graph::get(const char* key) const {
486
507
  Node* n = findNodeOfType(typeid(T), key);
487
508
  if(!n) HALT("no node of type '" <<typeid(T).name() <<"' with key '"<< key<< "' found");
@@ -23,6 +23,7 @@ struct H5_Writer {
23
23
  H5_Writer(const char* filename);
24
24
 
25
25
  template<class T> void add(const char* name, const rai::Array<T>& x);
26
+ void addDict(const char* name, const Graph& dict);
26
27
  void addGroup(const char* group);
27
28
  };
28
29
 
@@ -30,12 +31,13 @@ struct H5_Writer {
30
31
 
31
32
  struct H5_Reader {
32
33
  std::shared_ptr<H5::H5File> file;
33
- rai::Graph G;
34
34
  int verbose=0;
35
+ Graph G;
35
36
 
36
37
  H5_Reader(const char* filename);
37
38
  void readAll();
38
39
  template<class T> rai::Array<T> read(const char* name, bool ifExists=false);
40
+ Graph readDict(const char* name, bool ifExists=false);
39
41
  bool exists(const char* name);
40
42
  };
41
43
 
@@ -16,7 +16,7 @@ struct FclInterface {
16
16
  struct FclInterface_self* self=0;
17
17
  enum QueryMode { _broadPhaseOnly, _binaryCollisionSingle, _binaryCollisionAll, _distanceCutoff, _fine } mode;
18
18
 
19
- double cutoff=-1.;
19
+ double cutoff=.01;
20
20
  uintAA excludes;
21
21
  uintA collisions; //return values!
22
22
  arr X_lastQuery; //memory to check whether an object has moved in consecutive queries
@@ -24,6 +24,8 @@ struct FclInterface {
24
24
  FclInterface(const Array<Shape*>& geometries, const uintAA& _excludes, QueryMode _mode);
25
25
  ~FclInterface();
26
26
 
27
+ void setActiveColliders(uintA geom_ids);
28
+
27
29
  void step(const arr& X);
28
30
 
29
31
  protected:
@@ -133,6 +133,7 @@ struct Quaternion {
133
133
  Quaternion& setDiff(const Vector& from, const Vector& to);
134
134
  Quaternion& setInterpolateEmbedded(double t, const Quaternion& from, const Quaternion to);
135
135
  Quaternion& setInterpolateProper(double t, const Quaternion& from, const Quaternion to);
136
+ void integrateDiffEq(arr& qdot, double tau);
136
137
  void invert();
137
138
  void flipSign();
138
139
  void uniqueSign();
@@ -151,6 +152,7 @@ struct Quaternion {
151
152
  bool isNormalized() const;
152
153
  Vector getLog() const;
153
154
  Vector getVector() const { return getLog(); }
155
+ Vector getThreeEntries() const { CHECK_ZERO(w, 1e-6, ""); return Vector(x, y, z); }
154
156
  double getRad() const;
155
157
  double getDeg() const{ return 180./RAI_PI*getRad(); }
156
158
  void getRad(double& angle, Vector& axis) const;
@@ -254,7 +256,6 @@ struct Camera {
254
256
  void setWHRatio(float ratio);
255
257
  void setFocalLength(float f);
256
258
  void setPosition(float x, float y, float z);
257
- void setOffset(float x, float y, float z);
258
259
  void setKinect();
259
260
  void setDefault();
260
261
 
@@ -349,8 +350,10 @@ bool operator!=(const Transformation&, const Transformation&);
349
350
 
350
351
  // MIXED
351
352
  Vector operator*(const Quaternion& b, const Vector& c);
353
+ arr operator*(const Quaternion& b, const arr& c);
352
354
  Vector operator/(const Vector& c, const Quaternion& b);
353
355
  Vector operator*(const Transformation& b, const Vector& c);
356
+ arr operator*(const Transformation& b, const arr& c);
354
357
  Vector operator/(const Vector& c, const Transformation& b);
355
358
 
356
359
  std::istream& operator>>(std::istream&, Vector&);
@@ -54,7 +54,7 @@ struct Mesh {
54
54
 
55
55
  /// @name set or create
56
56
  void clear();
57
- void setBox(bool edgesOnly=false);
57
+ Mesh& setBox(bool edgesOnly=false);
58
58
  void setBox(const arr& lo, const arr& up, bool edgesOnly=false);
59
59
  Mesh& setDot(); ///< an awkward mesh: just a single dot, not tris (e.g. cvx core of a sphere...)
60
60
  void setLine(double l); ///< an awkward mesh: just a single line, not tris (e.g. cvx core of a sphere...)
@@ -81,9 +81,9 @@ struct Mesh {
81
81
  /// @name transform and modify
82
82
  void subDivide();
83
83
  void subDivide(uint tri);
84
- void scale(double s);
85
- void scale(double sx, double sy, double sz);
86
- void scale(const arr& s);
84
+ Mesh& scale(double s);
85
+ Mesh& scale(double sx, double sy, double sz);
86
+ Mesh& scale(const arr& s);
87
87
  void translate(double dx, double dy, double dz);
88
88
  void translate(const arr& d);
89
89
  void transform(const Transformation& t);
@@ -95,6 +95,8 @@ struct Mesh {
95
95
  void makeTriangleFan();
96
96
  void makeLines();
97
97
  void makeArrayFormatted(double avgNormalsThreshold=.9);
98
+ void makeLinesArrayFormatted();
99
+
98
100
 
99
101
  /// @name convex decomposition
100
102
  rai::Mesh decompose();
@@ -102,7 +104,6 @@ struct Mesh {
102
104
 
103
105
  /// @name support function
104
106
  uint support(const double* dir);
105
- void supportMargin(uintA& verts, const arr& dir, double margin, int initialization=-1);
106
107
 
107
108
  /// @name internal computations & cleanup
108
109
  void computeTriNormals();
@@ -125,6 +126,7 @@ struct Mesh {
125
126
  double getCircum(uint tri) const;
126
127
  double getVolume() const;
127
128
  uintA getVertexDegrees() const;
129
+ void samplePoints(arr& pts, arr& normals, uint n);
128
130
 
129
131
  ANN& ensure_ann();
130
132
 
@@ -156,8 +158,11 @@ struct Mesh {
156
158
 
157
159
  stdOutPipe(Mesh)
158
160
 
161
+ void clearAssetMeshesTextures();
162
+
159
163
  } //namespace
160
164
 
165
+
161
166
  //===========================================================================
162
167
 
163
168
  //
@@ -166,6 +171,7 @@ stdOutPipe(Mesh)
166
171
 
167
172
  uintA getSubMeshPositions(const char* filename);
168
173
  arr MinkowskiSum(const arr& A, const arr& B);
174
+ void supportMargin(const arr& V, uintA& verts, const arr& dir, double margin, int initialization=-1);
169
175
 
170
176
  //===========================================================================
171
177
  //
@@ -21,8 +21,8 @@ namespace rai {
21
21
  */
22
22
  struct PairCollision : NonCopyable {
23
23
  //INPUTS
24
- rai::Mesh mesh1; //V and T will typically be initialized by reference
25
- rai::Mesh mesh2; //V and T will typically be initialized by reference
24
+ arr mesh1;
25
+ arr mesh2;
26
26
  const rai::Transformation* t1=0;
27
27
  const rai::Transformation* t2=0;
28
28
  double rad1=0., rad2=0.; ///< only kinVector and glDraw account for this; the basic collision geometry (OUTPUTS below) is computed neglecting radii!!
@@ -39,7 +39,7 @@ struct PairCollision : NonCopyable {
39
39
  arr poly, polyNorm;
40
40
 
41
41
  //mesh-to-mesh
42
- PairCollision(rai::Mesh& mesh1, rai::Mesh& mesh2,
42
+ PairCollision(const arr& mesh1, const arr& mesh2,
43
43
  const rai::Transformation& t1, const rai::Transformation& t2,
44
44
  double rad1=0., double rad2=0.);
45
45
  //sdf-to-sdf
@@ -64,7 +64,7 @@ struct PairCollision : NonCopyable {
64
64
  private:
65
65
  //wrappers of external libs
66
66
  enum CCDmethod { _ccdGJKIntersect, _ccdGJKSeparate, _ccdGJKPenetration, _ccdMPRIntersect, _ccdMPRPenetration };
67
- void libccd(rai::Mesh& m1, rai::Mesh& m2, CCDmethod method); //calls ccdMPRPenetration of libccd
67
+ void libccd(const arr& m1, const arr& m2, CCDmethod method); //calls ccdMPRPenetration of libccd
68
68
  void GJK_sqrDistance(); //gjk_distance of libGJK
69
69
  bool simplexType(uint i, uint j) { return simplex1.d0==i && simplex2.d0==j; } //helper
70
70
  };
@@ -93,6 +93,7 @@ struct RenderQuad {
93
93
  struct DistMarkers {
94
94
  int markerObj=-1;
95
95
  arr pos;
96
+ arr color;
96
97
  intA slices;
97
98
  void clear(){ pos.clear(); slices.clear(); }
98
99
  };
@@ -120,8 +121,8 @@ struct RenderData {
120
121
  GLuint shadowFramebuffer, shadowTexture;
121
122
  GLuint prog_ID, prog_Projection_W, prog_ModelT_WM, prog_eyePosition_W, prog_ShadowProjection_W, prog_useShadow, prog_shadowMap, prog_numLights, prog_lightDirection_W, prog_FlatColor, prog_textureDim, prog_textureImage;
122
123
  GLuint progShadow, progShadow_ShadowProjection_W, progShadow_ModelT_WM;
123
- GLuint progTensor, progTensor_Projection_W, progTensor_ModelT_WM, progTensor_ModelScale, progTensor_eyePosition_W, progTensor_tensorTexture;
124
- GLuint progMarker, progMarker_Projection_W, progMarker_ModelT_WM;
124
+ GLuint progTensor, progTensor_Projection_W, progTensor_ModelT_WM, progTensor_ModelScale, progTensor_eyePosition_W, progTensor_FlatColor, progTensor_tensorTexture;
125
+ GLuint progMarker, progMarker_Projection_W, progMarker_ModelT_WM, progMarker_FlatColor;
125
126
  GLuint progText, progText_color, progText_useTexColor;
126
127
  RenderFont font;
127
128
  };
@@ -133,7 +134,7 @@ struct RenderData {
133
134
 
134
135
  void addLight(const arr& pos, const arr& focus, double heightAbs=5.);
135
136
  void addAxes(double scale, const rai::Transformation& _X);
136
- void addDistMarker(const arr& a, const arr& b, int s=-1, double size=.1);
137
+ void addDistMarker(const arr& a, const arr& b, int s=-1, double size=.1, const arr& color=arr{1.,0.,1.});
137
138
  void addText(const char* text, float x, float y, float size);
138
139
  void setText(const char* text);
139
140
  void addQuad(const byteA& img, float x, float y, float w, float h);
@@ -41,7 +41,7 @@ struct RenderData;
41
41
  // utility functions
42
42
  //
43
43
 
44
- void id2color(::byte rgb[3], uint id);
44
+ byteA id2color_b(uint id);
45
45
  arr id2color(uint id);
46
46
  uint color2id(::byte rgb[3]);
47
47
 
@@ -106,6 +106,7 @@ struct KOMO : NonCopyable {
106
106
 
107
107
  void addContact_slide(double startTime, double endTime, const char* from, const char* to);
108
108
  void addContact_stick(double startTime, double endTime, const char* from, const char* to, double frictionCone_mu=.8);
109
+ rai::Frame* addContact_WithPoaFrame(double time, str obj, str from, double frictionCone_mu, double init_objMass, double init_POAdist=.1);
109
110
  void addContact_elasticBounce(double time, const char* from, const char* to, double elasticity=.8, double stickiness=0.);
110
111
  void addContact_ComplementarySlide(double startTime, double endTime, const char* from, const char* to);
111
112
  // void addContact_Relaxed(double startTime, double endTime, const char *from, const char* to);
@@ -63,7 +63,7 @@ struct ManipulationHelper {
63
63
  arr sample(const char* sampleMethod=0, int verbose=1);
64
64
  void debug(bool listObjectives=true, bool plotOverTime=false);
65
65
 
66
- std::shared_ptr<ManipulationHelper> sub_motion(uint phase, uint steps_per_phase, bool fixEnd=true, double homing_scale=1e-2, double acceleration_scale=1e-1, bool accumulated_collisions=true, bool joint_limits=true, bool quaternion_norms=true, const StringA& activeDofs={});
66
+ std::shared_ptr<ManipulationHelper> sub_motion(uint phase, uint steps_per_phase=50, bool fixEnd=true, double homing_scale=1e-2, double acceleration_scale=1e-1, bool accumulated_collisions=true, bool joint_limits=true, bool quaternion_norms=true, const StringA& activeDofs={});
67
67
  std::shared_ptr<rai::RRT_PathFinder> sub_rrt(uint phase, const StringA& explicitCollisionPairs= {}, const StringA& activeDofs={});
68
68
 
69
69
  void play(rai::Configuration& C, double duration=1.);
@@ -98,7 +98,7 @@ struct F_fex_POAAtFrame : Feature {
98
98
 
99
99
  struct F_fex_ForceInFrameCone : Feature {
100
100
  double mu;
101
- F_fex_ForceInFrameCone(double _mu=.5) : mu(_mu) {}
101
+ F_fex_ForceInFrameCone(double _mu=.8) : mu(_mu) {}
102
102
  arr phi(const FrameL& F);
103
103
  uint dim_phi(const FrameL& F) { return 1; }
104
104
  };
@@ -17,7 +17,7 @@ struct PairCollision;
17
17
 
18
18
  //===========================================================================
19
19
 
20
- enum ForceExchangeType : int { FXT_none=-1, FXT_poa=0, FXT_torque=1, FXT_force, FXT_forceZ, FXT_poaOnly };
20
+ enum ForceExchangeType : int { FXT_none=-1, FXT_poa=0, FXT_wrench=1, FXT_force, FXT_forceZ, FXT_poaOnly };
21
21
 
22
22
  ///Description of a ForceExchange
23
23
  struct ForceExchangeDof : Dof, NonCopyable {
@@ -29,9 +29,9 @@ struct ForceExchangeDof : Dof, NonCopyable {
29
29
  PairCollision* __coll=0;
30
30
  public:
31
31
 
32
- arr poa;
33
- arr force;
34
- arr torque;
32
+ arr poa; //in world coordinates!
33
+ arr force; //in world coordinates, acting at the poa
34
+ arr torque; //in world coordinates, acting at the poa
35
35
 
36
36
  ForceExchangeDof(Frame& a, Frame& b, ForceExchangeType _type, const ForceExchangeDof* copyContact=nullptr);
37
37
  ~ForceExchangeDof();
@@ -116,7 +116,7 @@ struct Frame : NonCopyable {
116
116
  //accessors to transformations
117
117
  const Transformation& ensure_X();
118
118
  const Transformation& get_Q() const;
119
- const Transformation& get_X() const;
119
+ const Transformation& get_X() { return ensure_X(); }
120
120
  Transformation_Xtoken set_X() { return Transformation_Xtoken(*this); }
121
121
  Transformation_Qtoken set_Q();
122
122
 
@@ -333,14 +333,15 @@ struct Shape : NonCopyable {
333
333
  Enum<ShapeType> _type;
334
334
  arr size;
335
335
  shared_ptr<Mesh> _mesh;
336
- shared_ptr<Mesh> _sscCore;
336
+ shared_ptr<arr> _sscCore;
337
+ double coll_cvxRadius=-1.;
337
338
  shared_ptr<SDF> _sdf;
338
339
  char cont=0; ///< are contacts registered (or filtered in the callback)
339
340
 
340
341
  double radius() { if(size.N) return size(-1); return 0.; }
341
342
  Enum<ShapeType>& type() { return _type; }
342
343
  Mesh& mesh() { if(!_mesh) { if(_type==ST_none) _type=ST_mesh; _mesh = make_shared<Mesh>(); } return *_mesh; }
343
- Mesh& sscCore() { if(!_sscCore) { if(_type==ST_none) _type=ST_ssCvx; _sscCore = make_shared<Mesh>(); } return *_sscCore; }
344
+ arr& sscCore() { if(!_sscCore) { if(_type==ST_none) _type=ST_ssCvx; _sscCore = make_shared<arr>(); } return *_sscCore; }
344
345
  SDF& sdf() { if(!_sdf) { if(_type==ST_none) _type=ST_sdf; _sdf = make_shared<TensorShape>(); } return *_sdf; }
345
346
  double alpha() { arr& C=mesh().C; if(C.N==4 || C.N==2 || (C.nd==2 && C.d1==4)) return C.elem(-1); return 1.; }
346
347
 
@@ -116,7 +116,7 @@ struct Configuration {
116
116
  FrameL getJointsSlice(const FrameL& slice, bool activesOnly=true) const;
117
117
  uintA getDofIDs() const;
118
118
  StringA getJointNames() const;
119
- DofL getDofs(const FrameL& F, bool actives, bool inactives, bool mimics=false) const;
119
+ DofL getDofs(const FrameL& F, bool actives, bool inactives, bool mimics=false, bool forces=true) const;
120
120
  uintA getCtrlFramesAndScale(arr& scale=NoArr, bool jointPairs=true) const;
121
121
  FrameL getRoots() const;
122
122
  FrameL getParts() const;
@@ -161,11 +161,10 @@ struct Configuration {
161
161
  arr getCtrlMetric() const;
162
162
  arr getNaturalCtrlMetric(double power=.5) const; ///< returns diagonal of a natural metric in q-space, depending on tree depth
163
163
  arr getJointLimits(const DofL& dofs) const;
164
- arr getJointLimits() const { return getJointLimits(activeDofs); }
164
+ arr getJointLimits() const { getJointStateDimension(); return getJointLimits(activeDofs); }
165
165
  arr getTorqueLimits(const DofL& dofs, uint index=4) const;
166
166
  double getEnergy(const arr& qdot);
167
- double getTotalPenetration(); ///< proxies are returns from a collision engine; contacts stable constraints
168
- bool getCollisionFree();
167
+ // bool getCollisionFree(); //broken
169
168
  Graph reportForces();
170
169
  bool checkUniqueNames(bool makeUnique=false);
171
170
  FrameL calc_topSort() const;
@@ -192,6 +191,7 @@ struct Configuration {
192
191
  Joint* attach(Frame* a, Frame* b);
193
192
  Joint* attach(const char* a, const char* b);
194
193
  uintAA getCollisionExcludePairIDs(int verbose=0);
194
+ FrameL getCollidableShapes();
195
195
  FrameL getCollidablePairs();
196
196
  void prefixNames(bool clear=false);
197
197
 
@@ -242,22 +242,32 @@ struct Configuration {
242
242
  void dyn_MF(arr& M, arr& F, const arr& q_dot);
243
243
  arr dyn_inverseDyamics(const arr& q_dot, const arr& q_ddot);
244
244
  arr dyn_fwdDynamics(const arr& q_dot, const arr& u);
245
- private: //internal:
245
+ void dyn_fwdStep_RungeKutta(arr& q_dot, const arr& u, double tau);
246
+ double dyn_energy(const arr& q_dot);
247
+ // private: //internal:
246
248
  struct FrameDynState{ bool isGood=false; Vector p, v, w, vd, wd; Matrix R; };
247
249
  FrameDynState& dyn_ensure(Frame* f, const arr& q_dot, Array<FrameDynState>& buffer);
248
250
  arr dyn_inertia(Frame* f);
249
251
  arr dyn_M(Frame *f, const arr& I_f);
250
252
  arr dyn_J_dot(Frame *f, const arr& q_dot, const arr& Jpos, const arr& Jang);
251
- arr dyn_coriolis(Frame *f, const arr& q_dot, const arr& I_f, const arr& Jpos, const arr& Jang, Array<FrameDynState>& buffer);
253
+ arr dyn_C(Frame *f, const arr& q_dot, const arr& I_f, const arr& Jpos, const arr& Jang, Array<FrameDynState>& buffer);
252
254
  public:
253
255
 
254
256
  /// @name dynamics based on the fs() interface
255
257
  void equationOfMotion(arr& M, arr& F, const arr& qdot, bool gravity=true);
256
- void fwdDynamics(arr& qdd, const arr& qd, const arr& tau, bool gravity=true);
258
+ arr fwdDynamics(const arr& qd, const arr& tau, bool gravity=true);
257
259
  void inverseDynamics(arr& tau, const arr& qd, const arr& qdd, bool gravity=true);
258
260
 
259
261
  /// @name collisions & proxies
260
- void copyProxies(const ProxyA& _proxies);
262
+ void coll_setActiveColliders(const FrameL& colliders);
263
+ void coll_addExcludePair(uint aID, uint bID);
264
+
265
+ double coll_totalViolation(); ///< proxies are returns from a collision engine; contacts stable constraints
266
+ bool coll_isCollisionFree();
267
+ void coll_reportProxies(std::ostream& os=cout, double belowMargin=1., bool brief=true) const;
268
+ StringA coll_getProxyPairs(double belowMargin, arr& distances=NoArr);
269
+ std::shared_ptr<FclInterface> coll_fcl(int verbose=0);
270
+ void coll_fclReset();
261
271
  void addProxies(const uintA& collisionPairs);
262
272
 
263
273
  /// @name extensions on demand
@@ -265,9 +275,6 @@ public:
265
275
  OpenGL& gl();
266
276
  void view_lock(const char* _lockInfo);
267
277
  void view_unlock();
268
- //std::shared_ptr<SwiftInterface> swift();
269
- std::shared_ptr<FclInterface> fcl(int verbose=0);
270
- void swiftDelete();
271
278
  PhysXInterface& physx();
272
279
  OdeInterface& ode();
273
280
  FeatherstoneInterface& fs();
@@ -278,8 +285,11 @@ public:
278
285
  void glAdd(void (*call)(void*, OpenGL&), void* classP);
279
286
  int glAnimate();
280
287
  void view_close();
288
+ void view_focus(const char* frameName, double heightAbs=1.);
289
+ void view_setCameraPose(const arr& pose);
290
+ arr view_getCameraPose();
281
291
  void set_viewer(std::shared_ptr<ConfigurationViewer>& _viewer);
282
- void stepFcl();
292
+ void coll_stepFcl();
283
293
  void stepPhysx(double tau);
284
294
  void stepOde(double tau);
285
295
  void stepDynamics(arr& qdot, const arr& u_control, double tau, double dynamicNoise = 0.0, bool gravity = true);
@@ -289,7 +299,7 @@ public:
289
299
  void write(Graph& G) const;
290
300
  void writeURDF(std::ostream& os, const char* robotName="myrobot") const;
291
301
  void writeCollada(const char* filename, const char* format="collada") const;
292
- void writeMeshes(str pathPrefix="meshes/", bool copyTextures=false, bool enumerateTextures=false) const;
302
+ void writeMeshes(str pathPrefix="meshes/", bool copyTextures=false, bool enumerateAssets=false) const;
293
303
  void writeMesh(const char* filename="z.ply") const;
294
304
  void read(std::istream& is);
295
305
  Graph getGraph() const;
@@ -301,7 +311,6 @@ public:
301
311
 
302
312
  //some info
303
313
  void report(std::ostream& os=cout) const;
304
- void reportProxies(std::ostream& os=cout, double belowMargin=1., bool brief=true) const;
305
314
  void reportLimits(std::ostream& os=cout) const;
306
315
 
307
316
  private:
@@ -316,7 +325,7 @@ stdPipes(Configuration)
316
325
  //
317
326
 
318
327
  uintA framesToIndices(const FrameL& frames);
319
- uintA jointsToIndices(const JointL& joints);
328
+ FrameL dofsToFrames(const DofL& dofs);
320
329
  StringA framesToNames(const FrameL& frames);
321
330
 
322
331
  //===========================================================================
@@ -15,6 +15,7 @@ struct PhysX_Options {
15
15
  RAI_PARAM("physx/", int, verbose, 1)
16
16
  RAI_PARAM("physx/", bool, yGravity, false)
17
17
  RAI_PARAM("physx/", double, angularDamping, .1)
18
+ RAI_PARAM("physx/", double, jointFriction, 0.05)
18
19
  RAI_PARAM("physx/", double, defaultFriction, 1.)
19
20
  RAI_PARAM("physx/", double, defaultRestitution, .1) //restitution=1 should be elastic...
20
21
  RAI_PARAM("physx/", double, motorKp, 1000.)
@@ -41,12 +42,11 @@ struct PhysXInterface {
41
42
  void removeJoint(rai::Joint* j);
42
43
  void postAddObject(rai::Frame* f);
43
44
 
44
- void view(bool pause=false, const char* txt=nullptr);
45
-
46
45
  void setGravity(float grav);
47
46
  void disableGravity(rai::Frame* f, bool disable=true);
48
47
  void addForce(rai::Vector& force, rai::Frame* b);
49
48
  void addForce(rai::Vector& force, rai::Frame* b, rai::Vector& pos);
50
49
 
50
+ rai::Configuration& getDebugConfig();
51
51
  rai::PhysX_Options& opt();
52
52
  };
@@ -92,6 +92,7 @@ struct Simulation {
92
92
  //== management interface
93
93
 
94
94
  //-- store and reset the state of the simulation
95
+ void resetTime();
95
96
  void getState(arr& frameState, arr& q=NoArr, arr& frameVelocities=NoArr, arr& qDot=NoArr);
96
97
  void setState(const arr& frameState, const arr& q=NoArr, const arr& frameVelocities=NoArr, const arr& qDot=NoArr);
97
98
  void pushConfigurationToSimulator(const arr& frameVelocities=NoArr, const arr& qDot=NoArr);
@@ -129,7 +129,7 @@ struct FOL_World : TreeSearchDomain {
129
129
  void addObject(const char* name);
130
130
  template<class T> void addValuedFact(const StringA& symbols, const T& x) {
131
131
  NodeL parents;
132
- for(const String& s:symbols) parents.append(KB[s]);
132
+ for(const String& s:symbols) parents.append(KB.findNode(s));
133
133
  start_state->add<T>(0, x, parents);
134
134
  }
135
135
  void addTerminalRule(const char* literals);
@@ -107,12 +107,12 @@ struct SimpleConstraintFunction : NLP {
107
107
  virtual void evaluate(arr& phi, arr& J, const arr& _x) {
108
108
  CHECK_EQ(_x.N, 2, "");
109
109
  phi.resize(4);
110
- if(!!J) { J.resize(4, 2); J.setZero(); }
110
+ if(!!J) { J.resize(4, 2).setZero(); }
111
111
 
112
112
  //simple squared potential, displaced by 1
113
113
  arr x(_x);
114
114
  x(0) -= 1.;
115
- phi({0, 1}) = x;
115
+ phi({0, 1+1}) = x;
116
116
  if(!!J) J.setMatrixBlock(eye(2), 0, 0);
117
117
  x(0) += 1.;
118
118
 
@@ -67,8 +67,8 @@ struct Conv_NLP_SlackLeastSquares : NLP {
67
67
  virtual void evaluate(arr& phi, arr& J, const arr& x) {
68
68
  arr Pphi, PJ;
69
69
  P->evaluate(Pphi, PJ, x);
70
- phi = Pphi.sub(pick);
71
- J = PJ.sub(pick);
70
+ phi = Pphi.pick(pick);
71
+ J = PJ.pick(pick);
72
72
  for(uint i=0; i<pick.N; i++) {
73
73
  if(P->featureTypes(pick(i))==OT_ineq) {
74
74
  if(phi(i)<0.) { phi(i)=0.; J[i]=0.; } //ReLu for g
@@ -31,7 +31,7 @@ struct QueryResult {
31
31
  stdOutPipe(QueryResult)
32
32
 
33
33
  struct ConfigurationProblem {
34
- rai::Configuration C;
34
+ rai::Configuration& C;
35
35
  arr limits;
36
36
  uintA sphericalCoordinates;
37
37
 
@@ -43,8 +43,9 @@ struct ConfigurationProblem {
43
43
  //user info
44
44
  int verbose=0;
45
45
  uint evals=0;
46
+ double queryTime=0.;
46
47
 
47
- ConfigurationProblem(const rai::Configuration& _C, bool _useBroadCollisions=true, double _collisionTolerance=1e-3, int _verbose=0);
48
+ ConfigurationProblem(rai::Configuration& _C, bool _useBroadCollisions=true, double _collisionTolerance=1e-3, int _verbose=0);
48
49
 
49
50
  void setExplicitCollisionPairs(const StringA& _collisionPairs);
50
51
 
@@ -78,7 +78,7 @@ struct RRT_PathFinder : NonCopyable {
78
78
  arr path;
79
79
 
80
80
  //setup
81
- void setProblem(const Configuration& C);
81
+ void setProblem(Configuration& C);
82
82
  void setStartGoal(const arr& _starts, const arr& _goals);
83
83
  void setExplicitCollisionPairs(const StringA& collisionPairs);
84
84
 
robotic/librai.so CHANGED
Binary file