roboticstoolbox-python 1.3.0__cp313-cp313-win_amd64.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.
Files changed (673) hide show
  1. roboticstoolbox/__init__.py +104 -0
  2. roboticstoolbox/backends/Connector.py +107 -0
  3. roboticstoolbox/backends/Dynamixel/README.md +9 -0
  4. roboticstoolbox/backends/Dynamixel/dynamixel.json +581 -0
  5. roboticstoolbox/backends/Dynamixel/dynamixel_io.py +450 -0
  6. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/LICENSE +201 -0
  7. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/README.md +28 -0
  8. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/ReleaseNote.md +181 -0
  9. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/__init__.py +27 -0
  10. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_bulk_read.py +163 -0
  11. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_bulk_write.py +109 -0
  12. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_sync_read.py +166 -0
  13. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_sync_write.py +99 -0
  14. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/packet_handler.py +33 -0
  15. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/port_handler.py +155 -0
  16. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/protocol1_packet_handler.py +548 -0
  17. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/protocol2_packet_handler.py +1080 -0
  18. roboticstoolbox/backends/Dynamixel/dynamixel_sdk/robotis_def.py +75 -0
  19. roboticstoolbox/backends/Dynamixel/dyndata.py +121 -0
  20. roboticstoolbox/backends/PyPlot/EllipsePlot.py +253 -0
  21. roboticstoolbox/backends/PyPlot/PyPlot.py +769 -0
  22. roboticstoolbox/backends/PyPlot/PyPlot2.py +526 -0
  23. roboticstoolbox/backends/PyPlot/README.md +67 -0
  24. roboticstoolbox/backends/PyPlot/RobotPlot.py +247 -0
  25. roboticstoolbox/backends/PyPlot/RobotPlot2.py +123 -0
  26. roboticstoolbox/backends/PyPlot/__init__.py +4 -0
  27. roboticstoolbox/backends/ROS/ROS.py +129 -0
  28. roboticstoolbox/backends/ROS/__init__.py +3 -0
  29. roboticstoolbox/backends/__init__.py +39 -0
  30. roboticstoolbox/backends/swift/__init__.py +26 -0
  31. roboticstoolbox/bin/__init__.py +0 -0
  32. roboticstoolbox/bin/rtbtool.py +307 -0
  33. roboticstoolbox/blocks/Icons/250x250/armplot.png +0 -0
  34. roboticstoolbox/blocks/Icons/250x250/bicycle.png +0 -0
  35. roboticstoolbox/blocks/Icons/250x250/camera.png +0 -0
  36. roboticstoolbox/blocks/Icons/250x250/circlepath.png +0 -0
  37. roboticstoolbox/blocks/Icons/250x250/coriolis.png +0 -0
  38. roboticstoolbox/blocks/Icons/250x250/ctraj.png +0 -0
  39. roboticstoolbox/blocks/Icons/250x250/delta2tr.png +0 -0
  40. roboticstoolbox/blocks/Icons/250x250/diffsteer.png +0 -0
  41. roboticstoolbox/blocks/Icons/250x250/fdyn.png +0 -0
  42. roboticstoolbox/blocks/Icons/250x250/fdynx.png +0 -0
  43. roboticstoolbox/blocks/Icons/250x250/fkine.png +0 -0
  44. roboticstoolbox/blocks/Icons/250x250/gravload.png +0 -0
  45. roboticstoolbox/blocks/Icons/250x250/idyn.png +0 -0
  46. roboticstoolbox/blocks/Icons/250x250/idynx.png +0 -0
  47. roboticstoolbox/blocks/Icons/250x250/ikine.png +0 -0
  48. roboticstoolbox/blocks/Icons/250x250/inertia.png +0 -0
  49. roboticstoolbox/blocks/Icons/250x250/jacobian.png +0 -0
  50. roboticstoolbox/blocks/Icons/250x250/jtraj.png +0 -0
  51. roboticstoolbox/blocks/Icons/250x250/lspb.png +0 -0
  52. roboticstoolbox/blocks/Icons/250x250/multirotor.png +0 -0
  53. roboticstoolbox/blocks/Icons/250x250/multirotormixer.png +0 -0
  54. roboticstoolbox/blocks/Icons/250x250/multirotorplot.png +0 -0
  55. roboticstoolbox/blocks/Icons/250x250/point2tr.png +0 -0
  56. roboticstoolbox/blocks/Icons/250x250/tr2delta.png +0 -0
  57. roboticstoolbox/blocks/Icons/250x250/tr2t.png +0 -0
  58. roboticstoolbox/blocks/Icons/250x250/unicycle.png +0 -0
  59. roboticstoolbox/blocks/Icons/250x250/vehicleplot.png +0 -0
  60. roboticstoolbox/blocks/Icons/50x50/armplot.png +0 -0
  61. roboticstoolbox/blocks/Icons/50x50/bicycle.png +0 -0
  62. roboticstoolbox/blocks/Icons/50x50/camera.png +0 -0
  63. roboticstoolbox/blocks/Icons/50x50/circlepath.png +0 -0
  64. roboticstoolbox/blocks/Icons/50x50/coriolis.png +0 -0
  65. roboticstoolbox/blocks/Icons/50x50/delta2tr.png +0 -0
  66. roboticstoolbox/blocks/Icons/50x50/diffsteer.png +0 -0
  67. roboticstoolbox/blocks/Icons/50x50/fdyn.png +0 -0
  68. roboticstoolbox/blocks/Icons/50x50/fdynx.png +0 -0
  69. roboticstoolbox/blocks/Icons/50x50/fkine.png +0 -0
  70. roboticstoolbox/blocks/Icons/50x50/gravload.png +0 -0
  71. roboticstoolbox/blocks/Icons/50x50/idyn.png +0 -0
  72. roboticstoolbox/blocks/Icons/50x50/idynx.png +0 -0
  73. roboticstoolbox/blocks/Icons/50x50/ikine.png +0 -0
  74. roboticstoolbox/blocks/Icons/50x50/inertia.png +0 -0
  75. roboticstoolbox/blocks/Icons/50x50/jacobian.png +0 -0
  76. roboticstoolbox/blocks/Icons/50x50/jtraj.png +0 -0
  77. roboticstoolbox/blocks/Icons/50x50/lspb.png +0 -0
  78. roboticstoolbox/blocks/Icons/50x50/multirotor.png +0 -0
  79. roboticstoolbox/blocks/Icons/50x50/multirotormixer.png +0 -0
  80. roboticstoolbox/blocks/Icons/50x50/multirotorplot.png +0 -0
  81. roboticstoolbox/blocks/Icons/50x50/point2tr.png +0 -0
  82. roboticstoolbox/blocks/Icons/50x50/tr2delta.png +0 -0
  83. roboticstoolbox/blocks/Icons/50x50/tr2t.png +0 -0
  84. roboticstoolbox/blocks/Icons/50x50/unicycle.png +0 -0
  85. roboticstoolbox/blocks/Icons/50x50/vehicleplot.png +0 -0
  86. roboticstoolbox/blocks/Icons/armplot.png +0 -0
  87. roboticstoolbox/blocks/Icons/bicycle.png +0 -0
  88. roboticstoolbox/blocks/Icons/camera.png +0 -0
  89. roboticstoolbox/blocks/Icons/circlepath.png +0 -0
  90. roboticstoolbox/blocks/Icons/coriolis.png +0 -0
  91. roboticstoolbox/blocks/Icons/ctraj.png +0 -0
  92. roboticstoolbox/blocks/Icons/delta2tr.png +0 -0
  93. roboticstoolbox/blocks/Icons/diffsteer.png +0 -0
  94. roboticstoolbox/blocks/Icons/fdyn.png +0 -0
  95. roboticstoolbox/blocks/Icons/fdynx.png +0 -0
  96. roboticstoolbox/blocks/Icons/fkine.png +0 -0
  97. roboticstoolbox/blocks/Icons/gravload.png +0 -0
  98. roboticstoolbox/blocks/Icons/idyn.png +0 -0
  99. roboticstoolbox/blocks/Icons/idynx.png +0 -0
  100. roboticstoolbox/blocks/Icons/ikine.png +0 -0
  101. roboticstoolbox/blocks/Icons/inertia.png +0 -0
  102. roboticstoolbox/blocks/Icons/jacobian.png +0 -0
  103. roboticstoolbox/blocks/Icons/jtraj.png +0 -0
  104. roboticstoolbox/blocks/Icons/lspb.png +0 -0
  105. roboticstoolbox/blocks/Icons/multirotor.png +0 -0
  106. roboticstoolbox/blocks/Icons/multirotormixer.png +0 -0
  107. roboticstoolbox/blocks/Icons/multirotorplot.png +0 -0
  108. roboticstoolbox/blocks/Icons/point2tr.png +0 -0
  109. roboticstoolbox/blocks/Icons/tr2delta.png +0 -0
  110. roboticstoolbox/blocks/Icons/tr2t.png +0 -0
  111. roboticstoolbox/blocks/Icons/unicycle.png +0 -0
  112. roboticstoolbox/blocks/Icons/vehicleplot.png +0 -0
  113. roboticstoolbox/blocks/README.md +43 -0
  114. roboticstoolbox/blocks/__init__.py +6 -0
  115. roboticstoolbox/blocks/arm.py +1587 -0
  116. roboticstoolbox/blocks/mobile.py +500 -0
  117. roboticstoolbox/blocks/quad_model.py +132 -0
  118. roboticstoolbox/blocks/spatial.py +245 -0
  119. roboticstoolbox/blocks/uav.py +949 -0
  120. roboticstoolbox/core/Eigen/Cholesky +45 -0
  121. roboticstoolbox/core/Eigen/CholmodSupport +48 -0
  122. roboticstoolbox/core/Eigen/Core +384 -0
  123. roboticstoolbox/core/Eigen/Dense +7 -0
  124. roboticstoolbox/core/Eigen/Eigen +2 -0
  125. roboticstoolbox/core/Eigen/Eigenvalues +60 -0
  126. roboticstoolbox/core/Eigen/Geometry +59 -0
  127. roboticstoolbox/core/Eigen/Householder +29 -0
  128. roboticstoolbox/core/Eigen/IterativeLinearSolvers +48 -0
  129. roboticstoolbox/core/Eigen/Jacobi +32 -0
  130. roboticstoolbox/core/Eigen/KLUSupport +41 -0
  131. roboticstoolbox/core/Eigen/LU +47 -0
  132. roboticstoolbox/core/Eigen/MetisSupport +35 -0
  133. roboticstoolbox/core/Eigen/OrderingMethods +70 -0
  134. roboticstoolbox/core/Eigen/PaStiXSupport +49 -0
  135. roboticstoolbox/core/Eigen/PardisoSupport +35 -0
  136. roboticstoolbox/core/Eigen/QR +50 -0
  137. roboticstoolbox/core/Eigen/QtAlignedMalloc +39 -0
  138. roboticstoolbox/core/Eigen/SPQRSupport +34 -0
  139. roboticstoolbox/core/Eigen/SVD +50 -0
  140. roboticstoolbox/core/Eigen/Sparse +34 -0
  141. roboticstoolbox/core/Eigen/SparseCholesky +37 -0
  142. roboticstoolbox/core/Eigen/SparseCore +69 -0
  143. roboticstoolbox/core/Eigen/SparseLU +50 -0
  144. roboticstoolbox/core/Eigen/SparseQR +36 -0
  145. roboticstoolbox/core/Eigen/StdDeque +27 -0
  146. roboticstoolbox/core/Eigen/StdList +26 -0
  147. roboticstoolbox/core/Eigen/StdVector +27 -0
  148. roboticstoolbox/core/Eigen/SuperLUSupport +64 -0
  149. roboticstoolbox/core/Eigen/UmfPackSupport +40 -0
  150. roboticstoolbox/core/Eigen/src/Cholesky/LDLT.h +688 -0
  151. roboticstoolbox/core/Eigen/src/Cholesky/LLT.h +558 -0
  152. roboticstoolbox/core/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
  153. roboticstoolbox/core/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
  154. roboticstoolbox/core/Eigen/src/Core/ArithmeticSequence.h +413 -0
  155. roboticstoolbox/core/Eigen/src/Core/Array.h +417 -0
  156. roboticstoolbox/core/Eigen/src/Core/ArrayBase.h +226 -0
  157. roboticstoolbox/core/Eigen/src/Core/ArrayWrapper.h +209 -0
  158. roboticstoolbox/core/Eigen/src/Core/Assign.h +90 -0
  159. roboticstoolbox/core/Eigen/src/Core/AssignEvaluator.h +1010 -0
  160. roboticstoolbox/core/Eigen/src/Core/Assign_MKL.h +178 -0
  161. roboticstoolbox/core/Eigen/src/Core/BandMatrix.h +353 -0
  162. roboticstoolbox/core/Eigen/src/Core/Block.h +448 -0
  163. roboticstoolbox/core/Eigen/src/Core/BooleanRedux.h +162 -0
  164. roboticstoolbox/core/Eigen/src/Core/CommaInitializer.h +164 -0
  165. roboticstoolbox/core/Eigen/src/Core/ConditionEstimator.h +175 -0
  166. roboticstoolbox/core/Eigen/src/Core/CoreEvaluators.h +1741 -0
  167. roboticstoolbox/core/Eigen/src/Core/CoreIterators.h +132 -0
  168. roboticstoolbox/core/Eigen/src/Core/CwiseBinaryOp.h +183 -0
  169. roboticstoolbox/core/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
  170. roboticstoolbox/core/Eigen/src/Core/CwiseTernaryOp.h +197 -0
  171. roboticstoolbox/core/Eigen/src/Core/CwiseUnaryOp.h +103 -0
  172. roboticstoolbox/core/Eigen/src/Core/CwiseUnaryView.h +132 -0
  173. roboticstoolbox/core/Eigen/src/Core/DenseBase.h +701 -0
  174. roboticstoolbox/core/Eigen/src/Core/DenseCoeffsBase.h +685 -0
  175. roboticstoolbox/core/Eigen/src/Core/DenseStorage.h +652 -0
  176. roboticstoolbox/core/Eigen/src/Core/Diagonal.h +258 -0
  177. roboticstoolbox/core/Eigen/src/Core/DiagonalMatrix.h +391 -0
  178. roboticstoolbox/core/Eigen/src/Core/DiagonalProduct.h +28 -0
  179. roboticstoolbox/core/Eigen/src/Core/Dot.h +318 -0
  180. roboticstoolbox/core/Eigen/src/Core/EigenBase.h +160 -0
  181. roboticstoolbox/core/Eigen/src/Core/ForceAlignedAccess.h +150 -0
  182. roboticstoolbox/core/Eigen/src/Core/Fuzzy.h +155 -0
  183. roboticstoolbox/core/Eigen/src/Core/GeneralProduct.h +465 -0
  184. roboticstoolbox/core/Eigen/src/Core/GenericPacketMath.h +1040 -0
  185. roboticstoolbox/core/Eigen/src/Core/GlobalFunctions.h +194 -0
  186. roboticstoolbox/core/Eigen/src/Core/IO.h +258 -0
  187. roboticstoolbox/core/Eigen/src/Core/IndexedView.h +237 -0
  188. roboticstoolbox/core/Eigen/src/Core/Inverse.h +117 -0
  189. roboticstoolbox/core/Eigen/src/Core/Map.h +171 -0
  190. roboticstoolbox/core/Eigen/src/Core/MapBase.h +310 -0
  191. roboticstoolbox/core/Eigen/src/Core/MathFunctions.h +2057 -0
  192. roboticstoolbox/core/Eigen/src/Core/MathFunctionsImpl.h +200 -0
  193. roboticstoolbox/core/Eigen/src/Core/Matrix.h +565 -0
  194. roboticstoolbox/core/Eigen/src/Core/MatrixBase.h +547 -0
  195. roboticstoolbox/core/Eigen/src/Core/NestByValue.h +85 -0
  196. roboticstoolbox/core/Eigen/src/Core/NoAlias.h +109 -0
  197. roboticstoolbox/core/Eigen/src/Core/NumTraits.h +335 -0
  198. roboticstoolbox/core/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
  199. roboticstoolbox/core/Eigen/src/Core/PermutationMatrix.h +605 -0
  200. roboticstoolbox/core/Eigen/src/Core/PlainObjectBase.h +1128 -0
  201. roboticstoolbox/core/Eigen/src/Core/Product.h +191 -0
  202. roboticstoolbox/core/Eigen/src/Core/ProductEvaluators.h +1179 -0
  203. roboticstoolbox/core/Eigen/src/Core/Random.h +218 -0
  204. roboticstoolbox/core/Eigen/src/Core/Redux.h +515 -0
  205. roboticstoolbox/core/Eigen/src/Core/Ref.h +381 -0
  206. roboticstoolbox/core/Eigen/src/Core/Replicate.h +142 -0
  207. roboticstoolbox/core/Eigen/src/Core/Reshaped.h +454 -0
  208. roboticstoolbox/core/Eigen/src/Core/ReturnByValue.h +119 -0
  209. roboticstoolbox/core/Eigen/src/Core/Reverse.h +217 -0
  210. roboticstoolbox/core/Eigen/src/Core/Select.h +164 -0
  211. roboticstoolbox/core/Eigen/src/Core/SelfAdjointView.h +365 -0
  212. roboticstoolbox/core/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
  213. roboticstoolbox/core/Eigen/src/Core/Solve.h +188 -0
  214. roboticstoolbox/core/Eigen/src/Core/SolveTriangular.h +235 -0
  215. roboticstoolbox/core/Eigen/src/Core/SolverBase.h +168 -0
  216. roboticstoolbox/core/Eigen/src/Core/StableNorm.h +251 -0
  217. roboticstoolbox/core/Eigen/src/Core/StlIterators.h +463 -0
  218. roboticstoolbox/core/Eigen/src/Core/Stride.h +116 -0
  219. roboticstoolbox/core/Eigen/src/Core/Swap.h +68 -0
  220. roboticstoolbox/core/Eigen/src/Core/Transpose.h +464 -0
  221. roboticstoolbox/core/Eigen/src/Core/Transpositions.h +386 -0
  222. roboticstoolbox/core/Eigen/src/Core/TriangularMatrix.h +1001 -0
  223. roboticstoolbox/core/Eigen/src/Core/VectorBlock.h +96 -0
  224. roboticstoolbox/core/Eigen/src/Core/VectorwiseOp.h +784 -0
  225. roboticstoolbox/core/Eigen/src/Core/Visitor.h +381 -0
  226. roboticstoolbox/core/Eigen/src/Core/arch/AVX/Complex.h +372 -0
  227. roboticstoolbox/core/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
  228. roboticstoolbox/core/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
  229. roboticstoolbox/core/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
  230. roboticstoolbox/core/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
  231. roboticstoolbox/core/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
  232. roboticstoolbox/core/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
  233. roboticstoolbox/core/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
  234. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
  235. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
  236. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
  237. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
  238. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
  239. roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
  240. roboticstoolbox/core/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
  241. roboticstoolbox/core/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
  242. roboticstoolbox/core/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
  243. roboticstoolbox/core/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
  244. roboticstoolbox/core/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
  245. roboticstoolbox/core/Eigen/src/Core/arch/Default/Half.h +942 -0
  246. roboticstoolbox/core/Eigen/src/Core/arch/Default/Settings.h +49 -0
  247. roboticstoolbox/core/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
  248. roboticstoolbox/core/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
  249. roboticstoolbox/core/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
  250. roboticstoolbox/core/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
  251. roboticstoolbox/core/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
  252. roboticstoolbox/core/Eigen/src/Core/arch/MSA/Complex.h +648 -0
  253. roboticstoolbox/core/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
  254. roboticstoolbox/core/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
  255. roboticstoolbox/core/Eigen/src/Core/arch/NEON/Complex.h +584 -0
  256. roboticstoolbox/core/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
  257. roboticstoolbox/core/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
  258. roboticstoolbox/core/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
  259. roboticstoolbox/core/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
  260. roboticstoolbox/core/Eigen/src/Core/arch/SSE/Complex.h +351 -0
  261. roboticstoolbox/core/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
  262. roboticstoolbox/core/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
  263. roboticstoolbox/core/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
  264. roboticstoolbox/core/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
  265. roboticstoolbox/core/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
  266. roboticstoolbox/core/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
  267. roboticstoolbox/core/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
  268. roboticstoolbox/core/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
  269. roboticstoolbox/core/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
  270. roboticstoolbox/core/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
  271. roboticstoolbox/core/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
  272. roboticstoolbox/core/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
  273. roboticstoolbox/core/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
  274. roboticstoolbox/core/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
  275. roboticstoolbox/core/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
  276. roboticstoolbox/core/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
  277. roboticstoolbox/core/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
  278. roboticstoolbox/core/Eigen/src/Core/functors/StlFunctors.h +166 -0
  279. roboticstoolbox/core/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
  280. roboticstoolbox/core/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
  281. roboticstoolbox/core/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
  282. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
  283. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
  284. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
  285. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
  286. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
  287. roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
  288. roboticstoolbox/core/Eigen/src/Core/products/Parallelizer.h +180 -0
  289. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
  290. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
  291. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
  292. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
  293. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
  294. roboticstoolbox/core/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
  295. roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
  296. roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
  297. roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
  298. roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
  299. roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
  300. roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
  301. roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
  302. roboticstoolbox/core/Eigen/src/Core/util/BlasUtil.h +583 -0
  303. roboticstoolbox/core/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
  304. roboticstoolbox/core/Eigen/src/Core/util/Constants.h +563 -0
  305. roboticstoolbox/core/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
  306. roboticstoolbox/core/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
  307. roboticstoolbox/core/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
  308. roboticstoolbox/core/Eigen/src/Core/util/IntegralConstant.h +272 -0
  309. roboticstoolbox/core/Eigen/src/Core/util/MKL_support.h +137 -0
  310. roboticstoolbox/core/Eigen/src/Core/util/Macros.h +1464 -0
  311. roboticstoolbox/core/Eigen/src/Core/util/Memory.h +1163 -0
  312. roboticstoolbox/core/Eigen/src/Core/util/Meta.h +812 -0
  313. roboticstoolbox/core/Eigen/src/Core/util/NonMPL2.h +3 -0
  314. roboticstoolbox/core/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
  315. roboticstoolbox/core/Eigen/src/Core/util/ReshapedHelper.h +51 -0
  316. roboticstoolbox/core/Eigen/src/Core/util/StaticAssert.h +221 -0
  317. roboticstoolbox/core/Eigen/src/Core/util/SymbolicIndex.h +293 -0
  318. roboticstoolbox/core/Eigen/src/Core/util/XprHelper.h +856 -0
  319. roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
  320. roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
  321. roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
  322. roboticstoolbox/core/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
  323. roboticstoolbox/core/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
  324. roboticstoolbox/core/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
  325. roboticstoolbox/core/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
  326. roboticstoolbox/core/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
  327. roboticstoolbox/core/Eigen/src/Eigenvalues/RealQZ.h +657 -0
  328. roboticstoolbox/core/Eigen/src/Eigenvalues/RealSchur.h +558 -0
  329. roboticstoolbox/core/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
  330. roboticstoolbox/core/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
  331. roboticstoolbox/core/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
  332. roboticstoolbox/core/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
  333. roboticstoolbox/core/Eigen/src/Geometry/AlignedBox.h +486 -0
  334. roboticstoolbox/core/Eigen/src/Geometry/AngleAxis.h +247 -0
  335. roboticstoolbox/core/Eigen/src/Geometry/EulerAngles.h +114 -0
  336. roboticstoolbox/core/Eigen/src/Geometry/Homogeneous.h +501 -0
  337. roboticstoolbox/core/Eigen/src/Geometry/Hyperplane.h +282 -0
  338. roboticstoolbox/core/Eigen/src/Geometry/OrthoMethods.h +235 -0
  339. roboticstoolbox/core/Eigen/src/Geometry/ParametrizedLine.h +232 -0
  340. roboticstoolbox/core/Eigen/src/Geometry/Quaternion.h +870 -0
  341. roboticstoolbox/core/Eigen/src/Geometry/Rotation2D.h +199 -0
  342. roboticstoolbox/core/Eigen/src/Geometry/RotationBase.h +206 -0
  343. roboticstoolbox/core/Eigen/src/Geometry/Scaling.h +188 -0
  344. roboticstoolbox/core/Eigen/src/Geometry/Transform.h +1563 -0
  345. roboticstoolbox/core/Eigen/src/Geometry/Translation.h +202 -0
  346. roboticstoolbox/core/Eigen/src/Geometry/Umeyama.h +166 -0
  347. roboticstoolbox/core/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
  348. roboticstoolbox/core/Eigen/src/Householder/BlockHouseholder.h +110 -0
  349. roboticstoolbox/core/Eigen/src/Householder/Householder.h +176 -0
  350. roboticstoolbox/core/Eigen/src/Householder/HouseholderSequence.h +545 -0
  351. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
  352. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
  353. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
  354. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
  355. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
  356. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
  357. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
  358. roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
  359. roboticstoolbox/core/Eigen/src/Jacobi/Jacobi.h +483 -0
  360. roboticstoolbox/core/Eigen/src/KLUSupport/KLUSupport.h +358 -0
  361. roboticstoolbox/core/Eigen/src/LU/Determinant.h +117 -0
  362. roboticstoolbox/core/Eigen/src/LU/FullPivLU.h +877 -0
  363. roboticstoolbox/core/Eigen/src/LU/InverseImpl.h +432 -0
  364. roboticstoolbox/core/Eigen/src/LU/PartialPivLU.h +624 -0
  365. roboticstoolbox/core/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
  366. roboticstoolbox/core/Eigen/src/LU/arch/InverseSize4.h +351 -0
  367. roboticstoolbox/core/Eigen/src/MetisSupport/MetisSupport.h +137 -0
  368. roboticstoolbox/core/Eigen/src/OrderingMethods/Amd.h +435 -0
  369. roboticstoolbox/core/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
  370. roboticstoolbox/core/Eigen/src/OrderingMethods/Ordering.h +153 -0
  371. roboticstoolbox/core/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
  372. roboticstoolbox/core/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
  373. roboticstoolbox/core/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
  374. roboticstoolbox/core/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
  375. roboticstoolbox/core/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
  376. roboticstoolbox/core/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
  377. roboticstoolbox/core/Eigen/src/QR/HouseholderQR.h +434 -0
  378. roboticstoolbox/core/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
  379. roboticstoolbox/core/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
  380. roboticstoolbox/core/Eigen/src/SVD/BDCSVD.h +1366 -0
  381. roboticstoolbox/core/Eigen/src/SVD/JacobiSVD.h +812 -0
  382. roboticstoolbox/core/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
  383. roboticstoolbox/core/Eigen/src/SVD/SVDBase.h +376 -0
  384. roboticstoolbox/core/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
  385. roboticstoolbox/core/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
  386. roboticstoolbox/core/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
  387. roboticstoolbox/core/Eigen/src/SparseCore/AmbiVector.h +378 -0
  388. roboticstoolbox/core/Eigen/src/SparseCore/CompressedStorage.h +274 -0
  389. roboticstoolbox/core/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
  390. roboticstoolbox/core/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
  391. roboticstoolbox/core/Eigen/src/SparseCore/SparseAssign.h +270 -0
  392. roboticstoolbox/core/Eigen/src/SparseCore/SparseBlock.h +571 -0
  393. roboticstoolbox/core/Eigen/src/SparseCore/SparseColEtree.h +206 -0
  394. roboticstoolbox/core/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
  395. roboticstoolbox/core/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
  396. roboticstoolbox/core/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
  397. roboticstoolbox/core/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
  398. roboticstoolbox/core/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
  399. roboticstoolbox/core/Eigen/src/SparseCore/SparseDot.h +98 -0
  400. roboticstoolbox/core/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
  401. roboticstoolbox/core/Eigen/src/SparseCore/SparseMap.h +305 -0
  402. roboticstoolbox/core/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
  403. roboticstoolbox/core/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
  404. roboticstoolbox/core/Eigen/src/SparseCore/SparsePermutation.h +178 -0
  405. roboticstoolbox/core/Eigen/src/SparseCore/SparseProduct.h +181 -0
  406. roboticstoolbox/core/Eigen/src/SparseCore/SparseRedux.h +49 -0
  407. roboticstoolbox/core/Eigen/src/SparseCore/SparseRef.h +397 -0
  408. roboticstoolbox/core/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
  409. roboticstoolbox/core/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
  410. roboticstoolbox/core/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
  411. roboticstoolbox/core/Eigen/src/SparseCore/SparseTranspose.h +92 -0
  412. roboticstoolbox/core/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
  413. roboticstoolbox/core/Eigen/src/SparseCore/SparseUtil.h +186 -0
  414. roboticstoolbox/core/Eigen/src/SparseCore/SparseVector.h +478 -0
  415. roboticstoolbox/core/Eigen/src/SparseCore/SparseView.h +254 -0
  416. roboticstoolbox/core/Eigen/src/SparseCore/TriangularSolver.h +315 -0
  417. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU.h +923 -0
  418. roboticstoolbox/core/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
  419. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
  420. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
  421. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
  422. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
  423. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
  424. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
  425. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
  426. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
  427. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
  428. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
  429. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
  430. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
  431. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
  432. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
  433. roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
  434. roboticstoolbox/core/Eigen/src/SparseQR/SparseQR.h +758 -0
  435. roboticstoolbox/core/Eigen/src/StlSupport/StdDeque.h +116 -0
  436. roboticstoolbox/core/Eigen/src/StlSupport/StdList.h +106 -0
  437. roboticstoolbox/core/Eigen/src/StlSupport/StdVector.h +131 -0
  438. roboticstoolbox/core/Eigen/src/StlSupport/details.h +84 -0
  439. roboticstoolbox/core/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
  440. roboticstoolbox/core/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
  441. roboticstoolbox/core/Eigen/src/misc/Image.h +82 -0
  442. roboticstoolbox/core/Eigen/src/misc/Kernel.h +79 -0
  443. roboticstoolbox/core/Eigen/src/misc/RealSvd2x2.h +55 -0
  444. roboticstoolbox/core/Eigen/src/misc/blas.h +440 -0
  445. roboticstoolbox/core/Eigen/src/misc/lapack.h +152 -0
  446. roboticstoolbox/core/Eigen/src/misc/lapacke.h +16292 -0
  447. roboticstoolbox/core/Eigen/src/misc/lapacke_mangling.h +17 -0
  448. roboticstoolbox/core/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
  449. roboticstoolbox/core/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
  450. roboticstoolbox/core/Eigen/src/plugins/BlockMethods.h +1442 -0
  451. roboticstoolbox/core/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
  452. roboticstoolbox/core/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
  453. roboticstoolbox/core/Eigen/src/plugins/IndexedViewMethods.h +262 -0
  454. roboticstoolbox/core/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
  455. roboticstoolbox/core/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
  456. roboticstoolbox/core/Eigen/src/plugins/ReshapedMethods.h +149 -0
  457. roboticstoolbox/core/fknm.cpp +1557 -0
  458. roboticstoolbox/core/fknm.h +55 -0
  459. roboticstoolbox/core/frne.c +351 -0
  460. roboticstoolbox/core/frne.h +96 -0
  461. roboticstoolbox/core/ik.cpp +301 -0
  462. roboticstoolbox/core/ik.h +59 -0
  463. roboticstoolbox/core/linalg.cpp +316 -0
  464. roboticstoolbox/core/linalg.h +64 -0
  465. roboticstoolbox/core/methods.cpp +372 -0
  466. roboticstoolbox/core/methods.h +32 -0
  467. roboticstoolbox/core/ne.c +493 -0
  468. roboticstoolbox/core/structs.cpp +24 -0
  469. roboticstoolbox/core/structs.h +62 -0
  470. roboticstoolbox/core/vmath.c +163 -0
  471. roboticstoolbox/core/vmath.h +32 -0
  472. roboticstoolbox/fknm.cp313-win_amd64.pyd +0 -0
  473. roboticstoolbox/frne.cp313-win_amd64.pyd +0 -0
  474. roboticstoolbox/mobile/Animations.py +485 -0
  475. roboticstoolbox/mobile/Bug2.py +455 -0
  476. roboticstoolbox/mobile/CurvaturePolyPlanner.py +179 -0
  477. roboticstoolbox/mobile/DistanceTransformPlanner.py +395 -0
  478. roboticstoolbox/mobile/DstarPlanner.py +591 -0
  479. roboticstoolbox/mobile/DubinsPlanner.py +474 -0
  480. roboticstoolbox/mobile/EKF.py +1617 -0
  481. roboticstoolbox/mobile/LatticePlanner.py +419 -0
  482. roboticstoolbox/mobile/OccGrid.py +613 -0
  483. roboticstoolbox/mobile/PRMPlanner.py +348 -0
  484. roboticstoolbox/mobile/ParticleFilter.py +706 -0
  485. roboticstoolbox/mobile/PlannerBase.py +1009 -0
  486. roboticstoolbox/mobile/PoseGraph.py +544 -0
  487. roboticstoolbox/mobile/QuinticPolyPlanner.py +349 -0
  488. roboticstoolbox/mobile/RRTPlanner.py +359 -0
  489. roboticstoolbox/mobile/ReedsSheppPlanner.py +545 -0
  490. roboticstoolbox/mobile/Vehicle.py +1909 -0
  491. roboticstoolbox/mobile/__init__.py +193 -0
  492. roboticstoolbox/mobile/drivers.py +390 -0
  493. roboticstoolbox/mobile/landmarkmap.py +181 -0
  494. roboticstoolbox/mobile/sensors.py +771 -0
  495. roboticstoolbox/models/DH/AL5D.py +121 -0
  496. roboticstoolbox/models/DH/Ball.py +87 -0
  497. roboticstoolbox/models/DH/Baxter.py +91 -0
  498. roboticstoolbox/models/DH/Cobra600.py +63 -0
  499. roboticstoolbox/models/DH/Coil.py +80 -0
  500. roboticstoolbox/models/DH/Hyper.py +83 -0
  501. roboticstoolbox/models/DH/Hyper3d.py +85 -0
  502. roboticstoolbox/models/DH/IRB140.py +159 -0
  503. roboticstoolbox/models/DH/Jaco.py +102 -0
  504. roboticstoolbox/models/DH/KR5.py +112 -0
  505. roboticstoolbox/models/DH/LWR4.py +85 -0
  506. roboticstoolbox/models/DH/Mico.py +102 -0
  507. roboticstoolbox/models/DH/Orion5.py +91 -0
  508. roboticstoolbox/models/DH/P8.py +80 -0
  509. roboticstoolbox/models/DH/Panda.py +178 -0
  510. roboticstoolbox/models/DH/Planar2.py +69 -0
  511. roboticstoolbox/models/DH/Planar3.py +51 -0
  512. roboticstoolbox/models/DH/Puma560.py +326 -0
  513. roboticstoolbox/models/DH/README.md +216 -0
  514. roboticstoolbox/models/DH/Sawyer.py +85 -0
  515. roboticstoolbox/models/DH/Stanford.py +147 -0
  516. roboticstoolbox/models/DH/TwoLink.py +109 -0
  517. roboticstoolbox/models/DH/UR10.py +124 -0
  518. roboticstoolbox/models/DH/UR3.py +98 -0
  519. roboticstoolbox/models/DH/UR5.py +98 -0
  520. roboticstoolbox/models/DH/Uprighttl.py +24 -0
  521. roboticstoolbox/models/DH/__init__.py +52 -0
  522. roboticstoolbox/models/ETS/Frankie.py +90 -0
  523. roboticstoolbox/models/ETS/GenericSeven.py +54 -0
  524. roboticstoolbox/models/ETS/Omni.py +74 -0
  525. roboticstoolbox/models/ETS/Panda.py +69 -0
  526. roboticstoolbox/models/ETS/Planar2.py +49 -0
  527. roboticstoolbox/models/ETS/Planar_Y.py +65 -0
  528. roboticstoolbox/models/ETS/Puma560.py +69 -0
  529. roboticstoolbox/models/ETS/XYPanda.py +84 -0
  530. roboticstoolbox/models/ETS/__init__.py +20 -0
  531. roboticstoolbox/models/README.md +9 -0
  532. roboticstoolbox/models/URDF/AL5D.py +54 -0
  533. roboticstoolbox/models/URDF/Fetch.py +70 -0
  534. roboticstoolbox/models/URDF/FetchCamera.py +71 -0
  535. roboticstoolbox/models/URDF/Frankie.py +75 -0
  536. roboticstoolbox/models/URDF/FrankieOmni.py +94 -0
  537. roboticstoolbox/models/URDF/KinovaGen3.py +71 -0
  538. roboticstoolbox/models/URDF/LBR.py +59 -0
  539. roboticstoolbox/models/URDF/Mico.py +68 -0
  540. roboticstoolbox/models/URDF/PR2.py +64 -0
  541. roboticstoolbox/models/URDF/Panda.py +67 -0
  542. roboticstoolbox/models/URDF/Puma560.py +97 -0
  543. roboticstoolbox/models/URDF/UR10.py +53 -0
  544. roboticstoolbox/models/URDF/UR3.py +53 -0
  545. roboticstoolbox/models/URDF/UR5.py +74 -0
  546. roboticstoolbox/models/URDF/Valkyrie.py +84 -0
  547. roboticstoolbox/models/URDF/YuMi.py +109 -0
  548. roboticstoolbox/models/URDF/__init__.py +53 -0
  549. roboticstoolbox/models/URDF/px100.py +56 -0
  550. roboticstoolbox/models/URDF/px150.py +56 -0
  551. roboticstoolbox/models/URDF/rx150.py +56 -0
  552. roboticstoolbox/models/URDF/rx200.py +56 -0
  553. roboticstoolbox/models/URDF/vx300.py +56 -0
  554. roboticstoolbox/models/URDF/vx300s.py +56 -0
  555. roboticstoolbox/models/URDF/wx200.py +56 -0
  556. roboticstoolbox/models/URDF/wx250.py +56 -0
  557. roboticstoolbox/models/URDF/wx250s.py +56 -0
  558. roboticstoolbox/models/__init__.py +7 -0
  559. roboticstoolbox/models/list.py +119 -0
  560. roboticstoolbox/robot/BaseRobot.py +3133 -0
  561. roboticstoolbox/robot/DHFactor.py +522 -0
  562. roboticstoolbox/robot/DHLink.py +981 -0
  563. roboticstoolbox/robot/DHRobot.py +2520 -0
  564. roboticstoolbox/robot/Dynamics.py +1620 -0
  565. roboticstoolbox/robot/ELink.py +23 -0
  566. roboticstoolbox/robot/ERobot.py +25 -0
  567. roboticstoolbox/robot/ET.py +1097 -0
  568. roboticstoolbox/robot/ETS.py +3542 -0
  569. roboticstoolbox/robot/Gripper.py +282 -0
  570. roboticstoolbox/robot/IK.py +1522 -0
  571. roboticstoolbox/robot/Link.py +1698 -0
  572. roboticstoolbox/robot/PoERobot.py +348 -0
  573. roboticstoolbox/robot/Robot.py +2100 -0
  574. roboticstoolbox/robot/RobotKinematics.py +1725 -0
  575. roboticstoolbox/robot/RobotProto.py +92 -0
  576. roboticstoolbox/robot/__init__.py +54 -0
  577. roboticstoolbox/tools/DHFactor.py +375 -0
  578. roboticstoolbox/tools/Ticker.py +53 -0
  579. roboticstoolbox/tools/__init__.py +54 -0
  580. roboticstoolbox/tools/data.py +187 -0
  581. roboticstoolbox/tools/jsingu.py +51 -0
  582. roboticstoolbox/tools/null.py +48 -0
  583. roboticstoolbox/tools/numerical.py +96 -0
  584. roboticstoolbox/tools/p_servo.py +106 -0
  585. roboticstoolbox/tools/params.py +11 -0
  586. roboticstoolbox/tools/plot.py +109 -0
  587. roboticstoolbox/tools/trajectory.py +1152 -0
  588. roboticstoolbox/tools/types.py +13 -0
  589. roboticstoolbox/tools/urdf/__init__.py +45 -0
  590. roboticstoolbox/tools/urdf/tests/data/ur5.urdf +341 -0
  591. roboticstoolbox/tools/urdf/tests/test_urdf.py +116 -0
  592. roboticstoolbox/tools/urdf/urdf.py +1976 -0
  593. roboticstoolbox/tools/urdf/utils.py +50 -0
  594. roboticstoolbox/tools/xacro/__init__.py +1148 -0
  595. roboticstoolbox/tools/xacro/cli.py +128 -0
  596. roboticstoolbox/tools/xacro/color.py +66 -0
  597. roboticstoolbox/tools/xacro/tests/CMakeLists.txt +4 -0
  598. roboticstoolbox/tools/xacro/tests/broken.xacro +1 -0
  599. roboticstoolbox/tools/xacro/tests/emoji.xacro +5 -0
  600. roboticstoolbox/tools/xacro/tests/include1.xacro +4 -0
  601. roboticstoolbox/tools/xacro/tests/include1.xml +1 -0
  602. roboticstoolbox/tools/xacro/tests/include2.xacro +4 -0
  603. roboticstoolbox/tools/xacro/tests/include2.xml +1 -0
  604. roboticstoolbox/tools/xacro/tests/robots/README +4 -0
  605. roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.gazebo.xacro +59 -0
  606. roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.transmission.xacro +24 -0
  607. roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.urdf.xacro +264 -0
  608. roboticstoolbox/tools/xacro/tests/robots/pr2/common.xacro +71 -0
  609. roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.gazebo.xacro +36 -0
  610. roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.transmission.xacro +20 -0
  611. roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.urdf.xacro +130 -0
  612. roboticstoolbox/tools/xacro/tests/robots/pr2/gazebo/gazebo.urdf.xacro +24 -0
  613. roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.gazebo.xacro +288 -0
  614. roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.transmission.xacro +50 -0
  615. roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.urdf.xacro +374 -0
  616. roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.gazebo.xacro +16 -0
  617. roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.transmission.xacro +34 -0
  618. roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.urdf.xacro +147 -0
  619. roboticstoolbox/tools/xacro/tests/robots/pr2/materials.urdf.xacro +52 -0
  620. roboticstoolbox/tools/xacro/tests/robots/pr2/pr2.urdf.xacro +157 -0
  621. roboticstoolbox/tools/xacro/tests/robots/pr2/pr2_1.11.4.xml +3781 -0
  622. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/double_stereo_camera.gazebo.xacro +16 -0
  623. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/double_stereo_camera.urdf.xacro +61 -0
  624. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/head_sensor_package.gazebo.xacro +20 -0
  625. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/head_sensor_package.urdf.xacro +63 -0
  626. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/hokuyo_lx30_laser.gazebo.xacro +39 -0
  627. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/hokuyo_lx30_laser.urdf.xacro +27 -0
  628. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_camera.gazebo.xacro +87 -0
  629. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_camera.urdf.xacro +55 -0
  630. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_prosilica_camera.gazebo.xacro +193 -0
  631. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_prosilica_camera.urdf.xacro +181 -0
  632. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/microstrain_3dmgx2_imu.gazebo.xacro +20 -0
  633. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/microstrain_3dmgx2_imu.urdf.xacro +25 -0
  634. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/projector_wg6802418.gazebo.xacro +31 -0
  635. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/projector_wg6802418.urdf.xacro +42 -0
  636. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/prosilica_gc2450_camera.gazebo.xacro +43 -0
  637. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/prosilica_gc2450_camera.urdf.xacro +49 -0
  638. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/stereo_camera.gazebo.xacro +23 -0
  639. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/stereo_camera.urdf.xacro +71 -0
  640. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/wge100_camera.gazebo.xacro +46 -0
  641. roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/wge100_camera.urdf.xacro +47 -0
  642. roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.gazebo.xacro +40 -0
  643. roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.transmission.xacro +35 -0
  644. roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.urdf.xacro +167 -0
  645. roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.gazebo.xacro +11 -0
  646. roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.transmission.xacro +14 -0
  647. roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.urdf.xacro +60 -0
  648. roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.gazebo.xacro +37 -0
  649. roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.transmission.xacro +22 -0
  650. roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.urdf.xacro +122 -0
  651. roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.gazebo.xacro +39 -0
  652. roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.transmission.xacro +28 -0
  653. roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.urdf.xacro +173 -0
  654. roboticstoolbox/tools/xacro/tests/settings.yaml +9 -0
  655. roboticstoolbox/tools/xacro/tests/subdir/foo.xacro +3 -0
  656. roboticstoolbox/tools/xacro/tests/subdir/include-recursive.xacro +5 -0
  657. roboticstoolbox/tools/xacro/tests/subdir/include1.xml +1 -0
  658. roboticstoolbox/tools/xacro/tests/test_xacro.py +1418 -0
  659. roboticstoolbox/tools/xacro/xmlutils.py +152 -0
  660. roboticstoolbox_python-1.3.0.dist-info/METADATA +552 -0
  661. roboticstoolbox_python-1.3.0.dist-info/RECORD +673 -0
  662. roboticstoolbox_python-1.3.0.dist-info/WHEEL +5 -0
  663. roboticstoolbox_python-1.3.0.dist-info/entry_points.txt +6 -0
  664. roboticstoolbox_python-1.3.0.dist-info/licenses/LICENSE +21 -0
  665. spatialgeometry/__init__.py +32 -0
  666. spatialgeometry/geom/CollisionShape.py +419 -0
  667. spatialgeometry/geom/SceneGroup.py +26 -0
  668. spatialgeometry/geom/SceneNode.py +315 -0
  669. spatialgeometry/geom/Shape.py +420 -0
  670. spatialgeometry/geom/__init__.py +26 -0
  671. spatialgeometry/scene.py +107 -0
  672. spatialgeometry/tools/__init__.py +0 -0
  673. spatialgeometry/tools/stdout_supress.py +302 -0
@@ -0,0 +1,1148 @@
1
+ # Copyright (c) 2015, Open Source Robotics Foundation, Inc.
2
+ # Copyright (c) 2013, Willow Garage, Inc.
3
+ # All rights reserved.
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # * Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+ # * Redistributions in binary form must reproduce the above copyright
11
+ # notice, this list of conditions and the following disclaimer in the
12
+ # documentation and/or other materials provided with the distribution.
13
+ # * Neither the name of the Open Source Robotics Foundation, Inc.
14
+ # nor the names of its contributors may be used to endorse or promote
15
+ # products derived from this software without specific prior
16
+ # written permission.
17
+ #
18
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
+ # POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ # Authors: Stuart Glaser, William Woodall, Robert Haschke
31
+ # Maintainer: Morgan Quigley <morgan@osrfoundation.org>
32
+
33
+ from __future__ import print_function, division
34
+
35
+ import ast
36
+ import glob
37
+ import math
38
+ import os
39
+ import re
40
+ import sys
41
+ import xml.dom.minidom
42
+
43
+ from copy import deepcopy
44
+ from .color import error, warning
45
+ from .xmlutils import (
46
+ opt_attrs,
47
+ reqd_attrs,
48
+ first_child_element,
49
+ next_sibling_element,
50
+ replace_node,
51
+ )
52
+
53
+
54
+ _basestr = str
55
+ unicode = str
56
+ encoding = {}
57
+
58
+ # Dictionary of substitution args
59
+ substitution_args_context = {}
60
+
61
+
62
+ # Stack of currently processed files
63
+ filestack = []
64
+
65
+ # The top level directory
66
+ tld = ""
67
+
68
+
69
+ def push_file(filename):
70
+ """
71
+ Push a new filename to the filestack.
72
+ Instead of directly modifying filestack, a deep-copy is created and
73
+ modified,
74
+ while the old filestack is returned.
75
+ This allows to store the filestack that was active when a macro or
76
+ property is defined
77
+ """
78
+ global filestack
79
+ oldstack = filestack
80
+ filestack = deepcopy(filestack)
81
+ filestack.append(filename)
82
+ return oldstack
83
+
84
+
85
+ def restore_filestack(oldstack):
86
+ global filestack
87
+ filestack = oldstack
88
+
89
+
90
+ def abs_filename_spec(filename_spec):
91
+ """
92
+ Prepend the dirname of the currently processed file
93
+ if filename_spec is not yet absolute
94
+ """
95
+ if not os.path.isabs(filename_spec):
96
+ parent_filename = filestack[-1]
97
+ basedir = os.path.dirname(parent_filename) if parent_filename else "."
98
+ return os.path.join(basedir, filename_spec)
99
+ return filename_spec # pragma: no cover
100
+
101
+
102
+ class YamlDictWrapper(dict): # pragma: no cover
103
+ """Wrapper class providing dotted access to dict items"""
104
+
105
+ def __getattr__(self, item):
106
+ try:
107
+ result = super(YamlDictWrapper, self).__getitem__(item)
108
+ return YamlDictWrapper(result) if isinstance(result, dict) else result
109
+ except KeyError:
110
+ raise XacroException("No such key: '{}'".format(item))
111
+
112
+ __getitem__ = __getattr__
113
+
114
+
115
+ def load_yaml(filename): # pragma: no cover
116
+ try:
117
+ import yaml
118
+ except Exception:
119
+ raise XacroException("yaml support not available; install python-yaml")
120
+
121
+ filename = abs_filename_spec(filename)
122
+ f = open(filename)
123
+ oldstack = push_file(filename)
124
+ try:
125
+ return YamlDictWrapper(yaml.safe_load(f))
126
+ finally:
127
+ f.close()
128
+ restore_filestack(oldstack)
129
+ global all_includes
130
+ all_includes.append(filename)
131
+
132
+
133
+ # global symbols dictionary
134
+ # taking simple security measures to forbid access to __builtins__
135
+ # only the very few symbols explicitly listed are allowed
136
+ # for discussion, see:
137
+ # http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html
138
+ global_symbols = {
139
+ "__builtins__": {
140
+ k: __builtins__[k]
141
+ for k in [
142
+ "list",
143
+ "dict",
144
+ "map",
145
+ "len",
146
+ "str",
147
+ "float",
148
+ "int",
149
+ "True",
150
+ "False",
151
+ "min",
152
+ "max",
153
+ "round",
154
+ ]
155
+ }
156
+ }
157
+
158
+ # also define all math symbols and functions
159
+ global_symbols.update(math.__dict__)
160
+ # expose load_yaml and abs_filename
161
+ global_symbols.update(dict(load_yaml=load_yaml, abs_filename=abs_filename_spec))
162
+
163
+
164
+ class XacroException(Exception):
165
+ """
166
+ XacroException allows to wrap another exception (exc) and to augment
167
+ its error message: prefixing with msg and suffixing with suffix.
168
+ str(e) finally prints: msg str(exc) suffix
169
+ """
170
+
171
+ def __init__(self, msg=None, suffix=None, exc=None, macro=None):
172
+ super(XacroException, self).__init__(msg)
173
+ self.suffix = suffix
174
+ self.exc = exc
175
+ self.macros = [] if macro is None else [macro]
176
+
177
+ def __str__(self): # pragma: no cover
178
+ items = [super(XacroException, self).__str__(), self.exc, self.suffix]
179
+ return " ".join(
180
+ [s for s in [unicode(e) for e in items] if s not in ["", "None"]]
181
+ )
182
+
183
+
184
+ verbosity = 1
185
+
186
+
187
+ def check_attrs(tag, required, optional):
188
+ """
189
+ Helper routine to fetch required and optional attributes
190
+ and complain about any additional attributes.
191
+ :param tag (xml.dom.Element): DOM element node
192
+ :param required [str]: list of required attributes
193
+ :param optional [str]: list of optional attributes
194
+ """
195
+ result = reqd_attrs(tag, required)
196
+ result.extend(opt_attrs(tag, optional))
197
+ allowed = required + optional
198
+ extra = [
199
+ a
200
+ for a in tag.attributes.keys()
201
+ if a not in allowed and not a.startswith("xmlns:")
202
+ ]
203
+ if extra: # pragma: no cover
204
+ warning("%s: unknown attribute(s): %s" % (tag.nodeName, ", ".join(extra)))
205
+ if verbosity > 0:
206
+ print_location(filestack)
207
+ return result
208
+
209
+
210
+ class Macro(object):
211
+ def __init__(self):
212
+ self.body = None # original xml.dom.Node
213
+ self.params = [] # parsed parameter names
214
+ self.defaultmap = {} # default parameter values
215
+ self.history = [] # definition history
216
+
217
+
218
+ def eval_extension(s): # pragma: no cover
219
+
220
+ if s == "$(cwd)":
221
+ return os.getcwd()
222
+
223
+ if s.startswith("$(find"):
224
+ return tld
225
+ # return '..'
226
+
227
+ if s.startswith("$(arg"):
228
+ s = s.replace("$(arg ", "")
229
+ s = s[:-1]
230
+ return substitution_args_context["arg"][s]
231
+
232
+ try:
233
+ from roslaunch.substitution_args import resolve_args, ArgException
234
+ from rospkg.common import ResourceNotFound
235
+
236
+ return resolve_args(s, context=substitution_args_context, resolve_anon=False)
237
+ except ImportError:
238
+ return ""
239
+ # raise XacroException("substitution args not supported: ", exc=e)
240
+ except ArgException as e:
241
+ raise XacroException("Undefined substitution argument", exc=e)
242
+ except ResourceNotFound as e:
243
+ raise XacroException("resource not found:", exc=e)
244
+
245
+
246
+ class Table(object):
247
+ def __init__(self, parent=None):
248
+ self.parent = parent
249
+ self.table = {}
250
+ self.unevaluated = set() # set of unevaluated variables
251
+ # list of currently resolved vars (to resolve recursive definitions)
252
+ self.recursive = []
253
+ # the following variables are for debugging / checking only
254
+ self.depth = self.parent.depth + 1 if self.parent else 0
255
+
256
+ @staticmethod
257
+ def _eval_literal(value):
258
+ if isinstance(value, _basestr):
259
+ # remove single quotes from escaped string
260
+ if len(value) >= 2 and value[0] == "'" and value[-1] == "'":
261
+ return value[1:-1]
262
+ # Try to evaluate as number literal or boolean.
263
+ # This is needed to handle numbers in property definitions as
264
+ # numbers, not strings.
265
+ # python3 ignores/drops underscores in number literals
266
+ # (due to PEP515).
267
+ # Here, we want to handle literals with underscores as plain
268
+ # strings.
269
+ if "_" in value:
270
+ return value
271
+ # order of types is important!
272
+ for f in [int, float, lambda x: get_boolean_value(x, None)]:
273
+ try:
274
+ return f(value)
275
+ except Exception:
276
+ pass
277
+ return value
278
+
279
+ def _resolve_(self, key):
280
+ # lazy evaluation
281
+ if key in self.unevaluated:
282
+ if key in self.recursive:
283
+ raise XacroException(
284
+ "recursive variable definition: %s"
285
+ % " -> ".join(self.recursive + [key])
286
+ )
287
+ self.recursive.append(key)
288
+ self.table[key] = self._eval_literal(eval_text(self.table[key], self))
289
+ self.unevaluated.remove(key)
290
+ self.recursive.remove(key)
291
+
292
+ # return evaluated result
293
+ value = self.table[key]
294
+ if (
295
+ verbosity > 2 and self.parent is None
296
+ ) or verbosity > 3: # pragma: no cover # noqa
297
+ print(
298
+ "{indent}use {key}: {value} ({loc})".format(
299
+ indent=self.depth * " ", key=key, value=value, loc=filestack[-1]
300
+ ),
301
+ file=sys.stderr,
302
+ )
303
+ return value
304
+
305
+ def __getitem__(self, key):
306
+ if key in self.table:
307
+ return self._resolve_(key)
308
+ elif self.parent:
309
+ return self.parent[key]
310
+ else:
311
+ raise KeyError(key)
312
+
313
+ def _setitem(self, key, value, unevaluated):
314
+ if key in global_symbols:
315
+ warning("redefining global property: %s" % key)
316
+ print_location(filestack)
317
+
318
+ value = self._eval_literal(value)
319
+ self.table[key] = value
320
+ if unevaluated and isinstance(value, _basestr):
321
+ # literal evaluation failed: re-evaluate lazily at first access
322
+ self.unevaluated.add(key)
323
+ elif key in self.unevaluated: # pragma: no cover
324
+ # all other types cannot be evaluated
325
+ self.unevaluated.remove(key)
326
+ if (
327
+ verbosity > 2 and self.parent is None
328
+ ) or verbosity > 3: # pragma: no cover # noqa
329
+ print(
330
+ "{indent}set {key}: {value} ({loc})".format(
331
+ indent=self.depth * " ", key=key, value=value, loc=filestack[-1]
332
+ ),
333
+ file=sys.stderr,
334
+ )
335
+
336
+ def __setitem__(self, key, value):
337
+ self._setitem(key, value, unevaluated=True)
338
+
339
+ def __contains__(self, key):
340
+ return key in self.table or (self.parent and key in self.parent)
341
+
342
+ def __str__(self): # pragma: no cover
343
+ s = unicode(self.table)
344
+ if isinstance(self.parent, Table):
345
+ s += "\n parent: "
346
+ s += unicode(self.parent)
347
+ return s
348
+
349
+ def root(self):
350
+ p = self
351
+ while p.parent:
352
+ p = p.parent
353
+ return p
354
+
355
+
356
+ class NameSpace(object):
357
+ # dot access (namespace.property) is forwarded to getitem()
358
+ def __getattr__(self, item):
359
+ return self.__getitem__(item)
360
+
361
+
362
+ class PropertyNameSpace(Table, NameSpace):
363
+ def __init__(self, parent=None):
364
+ super(PropertyNameSpace, self).__init__(parent)
365
+
366
+
367
+ class MacroNameSpace(dict, NameSpace):
368
+ def __init__(self, *args, **kwargs):
369
+ super(MacroNameSpace, self).__init__(*args, **kwargs)
370
+
371
+
372
+ class QuickLexer(object):
373
+ def __init__(self, *args, **kwargs):
374
+ if args:
375
+ # copy attributes + variables from other instance
376
+ other = args[0]
377
+ self.__dict__.update(other.__dict__)
378
+ else:
379
+ self.res = []
380
+ for k, v in kwargs.items():
381
+ self.__setattr__(k, len(self.res))
382
+ self.res.append(re.compile(v))
383
+ self.str = ""
384
+ self.top = None
385
+
386
+ def lex(self, str):
387
+ self.str = str
388
+ self.top = None
389
+ self.next()
390
+
391
+ def peek(self):
392
+ return self.top
393
+
394
+ def next(self):
395
+ result = self.top
396
+ self.top = None
397
+ if not self.str: # empty string
398
+ return result
399
+ for i in range(len(self.res)):
400
+ m = self.res[i].match(self.str)
401
+ if m:
402
+ self.top = (i, m.group(0))
403
+ self.str = self.str[m.end() :]
404
+ return result
405
+ raise XacroException("invalid expression: " + self.str)
406
+
407
+
408
+ all_includes = []
409
+ include_no_matches_msg = """Include tag's filename spec \"{}\" matched "\" no files."""
410
+
411
+
412
+ def get_include_files(filename_spec, symbols):
413
+ try:
414
+ filename_spec = abs_filename_spec(eval_text(filename_spec, symbols))
415
+ except XacroException as e: # pragma: no cover
416
+ if e.exc and isinstance(e.exc, NameError) and symbols is None:
417
+ raise XacroException(
418
+ "variable filename is supported with in-order option only"
419
+ )
420
+ else:
421
+ raise
422
+
423
+ if re.search("[*[?]+", filename_spec): # pragma: no cover
424
+ # Globbing behaviour
425
+ filenames = sorted(glob.glob(filename_spec))
426
+ if len(filenames) == 0:
427
+ warning(include_no_matches_msg.format(filename_spec))
428
+ else:
429
+ # Default behaviour
430
+ filenames = [filename_spec]
431
+
432
+ for filename in filenames:
433
+ global all_includes
434
+ all_includes.append(filename)
435
+ yield filename
436
+
437
+
438
+ def import_xml_namespaces(parent, attributes):
439
+ """import all namespace declarations into parent"""
440
+ for name, value in attributes.items():
441
+ if name.startswith("xmlns:"):
442
+ oldAttr = parent.getAttributeNode(name)
443
+ if oldAttr and oldAttr.value != value:
444
+ warning(
445
+ "inconsistent namespace redefinitions for {name}:" # pragma: no cover # noqa
446
+ "\n old: {old}\n new: {new} ({new_file})".format(
447
+ name=name, old=oldAttr.value, new=value, new_file=filestack[-1]
448
+ )
449
+ )
450
+ else:
451
+ parent.setAttribute(name, value)
452
+
453
+
454
+ def process_include(elt, macros, symbols, func):
455
+ included = []
456
+ filename_spec, namespace_spec, optional = check_attrs(
457
+ elt, ["filename"], ["ns", "optional"]
458
+ )
459
+ if namespace_spec:
460
+ try:
461
+ namespace_spec = eval_text(namespace_spec, symbols)
462
+ macros[namespace_spec] = ns_macros = MacroNameSpace()
463
+ symbols[namespace_spec] = ns_symbols = PropertyNameSpace()
464
+ macros = ns_macros
465
+ symbols = ns_symbols
466
+ except TypeError: # pragma: no cover
467
+ raise XacroException("namespaces are supported with in-order option only")
468
+
469
+ optional = get_boolean_value(optional, None)
470
+
471
+ if first_child_element(elt):
472
+ warning(
473
+ "Child elements of a <xacro:include> tag are ignored"
474
+ ) # pragma: no cover # noqa
475
+ if verbosity > 0: # pragma: no cover
476
+ print_location(filestack)
477
+
478
+ for filename in get_include_files(filename_spec, symbols):
479
+ try:
480
+ # extend filestack
481
+ oldstack = push_file(filename)
482
+ include = parse(None, filename).documentElement
483
+
484
+ # recursive call to func
485
+ func(include, macros, symbols)
486
+ included.append(include)
487
+ import_xml_namespaces(elt.parentNode, include.attributes)
488
+ except XacroException as e:
489
+ if e.exc and isinstance(e.exc, IOError) and optional is True:
490
+ continue
491
+ else:
492
+ raise
493
+ finally:
494
+ # restore filestack
495
+ restore_filestack(oldstack)
496
+
497
+ remove_previous_comments(elt)
498
+ # replace the include tag with the nodes of the included file(s)
499
+ replace_node(elt, by=included, content_only=True)
500
+
501
+
502
+ def is_valid_name(name):
503
+ """
504
+ Checks whether name is a valid property or macro identifier.
505
+ With python-based evaluation, we need to avoid name clashes with python
506
+ keywords.
507
+ """
508
+ # Resulting AST of simple identifier is <Module [<Expr <Name "foo">>]>
509
+ try:
510
+ root = ast.parse(name)
511
+
512
+ if (
513
+ isinstance(root, ast.Module)
514
+ and len(root.body) == 1
515
+ and isinstance(root.body[0], ast.Expr)
516
+ and isinstance(root.body[0].value, ast.Name)
517
+ and root.body[0].value.id == name
518
+ ):
519
+ return True
520
+ except SyntaxError:
521
+ pass
522
+
523
+ return False
524
+
525
+
526
+ re_macro_arg = re.compile(
527
+ r"""\s*([^\s:=]+?):?=(\^\|?)?((?:(?:'[^']*')?[^\s'"]*?)*)(?:\s+|$)(.*)"""
528
+ ) # noqa
529
+ # space param := ^| <-- default --> space rest # noqa
530
+
531
+
532
+ def parse_macro_arg(s):
533
+ """
534
+ parse the first param spec from a macro parameter string s
535
+ accepting the following syntax: <param>[:=|=][^|]<default>
536
+ :param s: param spec string
537
+ :return: param, (forward, default), rest-of-string
538
+ forward will be either param or None (depending on whether
539
+ ^ was specified)
540
+ default will be the default string or None
541
+ If there is no default spec at all, the middle pair will be
542
+ replaced by None
543
+ """
544
+ m = re_macro_arg.match(s)
545
+ if m:
546
+ # there is a default value specified for param
547
+ param, forward, default, rest = m.groups()
548
+ if not default:
549
+ default = None
550
+ return param, (param if forward else None, default), rest
551
+ else:
552
+ # there is no default specified at all
553
+ result = s.lstrip().split(None, 1)
554
+ return result[0], None, result[1] if len(result) > 1 else ""
555
+
556
+
557
+ def grab_macro(elt, macros):
558
+ assert elt.tagName == "xacro:macro"
559
+ remove_previous_comments(elt)
560
+
561
+ name, params = check_attrs(elt, ["name"], ["params"])
562
+ if name == "call":
563
+ raise XacroException("Invalid use of macro name 'call'")
564
+ if name.find(".") != -1: # pragma: no cover
565
+ raise XacroException(
566
+ "macro names must not contain '.' (reserved for namespaces): %s" % name
567
+ )
568
+ if name.startswith("xacro:"):
569
+ warning("macro names must not contain prefix 'xacro:': %s" % name)
570
+ name = name[6:] # drop 'xacro:' prefix
571
+
572
+ # fetch existing or create new macro definition
573
+ macro = macros.get(name, Macro())
574
+ # append current filestack to history
575
+ macro.history.append(filestack)
576
+ macro.body = elt
577
+
578
+ # parse params and their defaults
579
+ macro.params = []
580
+ macro.defaultmap = {}
581
+ while params:
582
+ param, value, params = parse_macro_arg(params)
583
+ macro.params.append(param)
584
+ if value is not None:
585
+ macro.defaultmap[param] = value # parameter with default
586
+
587
+ macros[name] = macro
588
+ replace_node(elt, by=None)
589
+
590
+
591
+ def grab_property(elt, table):
592
+ assert elt.tagName == "xacro:property"
593
+ remove_previous_comments(elt)
594
+
595
+ name, value, default, scope = check_attrs(
596
+ elt, ["name"], ["value", "default", "scope"]
597
+ )
598
+ if not is_valid_name(name):
599
+ raise XacroException("Property names must be valid python identifiers: " + name)
600
+ if value is not None and default is not None: # pragma: no cover
601
+ raise XacroException(
602
+ "Property cannot define both a default and a value: " + name
603
+ )
604
+
605
+ if default is not None:
606
+ if scope is not None: # pragma: no cover
607
+ warning(
608
+ "%s: default property value can only be defined on local scope" % name
609
+ )
610
+ if name not in table:
611
+ value = default
612
+ else: # pragma: no cover
613
+ replace_node(elt, by=None)
614
+ return
615
+
616
+ if value is None:
617
+ name = "**" + name
618
+ value = elt # debug
619
+
620
+ replace_node(elt, by=None)
621
+
622
+ if scope and scope == "global":
623
+ target_table = table.root()
624
+ unevaluated = False
625
+ elif scope and scope == "parent":
626
+ if table.parent:
627
+ target_table = table.parent
628
+ unevaluated = False
629
+ else: # pragma: no cover
630
+ warning("%s: no parent scope at global scope " % name)
631
+ return # cannot store the value, no reason to evaluate it
632
+ else:
633
+ target_table = table
634
+ unevaluated = True
635
+
636
+ if not unevaluated and isinstance(value, _basestr):
637
+ value = eval_text(value, table)
638
+
639
+ target_table._setitem(name, value, unevaluated=unevaluated)
640
+
641
+
642
+ LEXER = QuickLexer(
643
+ # multiple $ in a row, followed by { or (
644
+ DOLLAR_DOLLAR_BRACE=r"^\$\$+(\{|\()",
645
+ EXPR=r"^\$\{[^\}]*\}", # stuff starting with ${
646
+ EXTENSION=r"^\$\([^\)]*\)", # stuff starting with $(
647
+ # any text w/o $ or $ following any chars except {($ or single $
648
+ TEXT=r"[^$]+|\$[^{($]+|\$$",
649
+ )
650
+
651
+
652
+ # evaluate text and return typed value
653
+ def eval_text(text, symbols):
654
+ def handle_expr(s):
655
+ try:
656
+ return eval(eval_text(s, symbols), global_symbols, symbols)
657
+ except Exception as e:
658
+ # re-raise as XacroException to add more context
659
+ raise XacroException(
660
+ exc=e, suffix=os.linesep + "when evaluating expression '%s'" % s
661
+ )
662
+
663
+ def handle_extension(s): # pragma: no cover
664
+ return eval_extension("$(%s)" % eval_text(s, symbols))
665
+
666
+ results = []
667
+ lex = QuickLexer(LEXER)
668
+ lex.lex(text)
669
+ while lex.peek():
670
+ id = lex.peek()[0]
671
+ if id == lex.EXPR:
672
+ results.append(handle_expr(lex.next()[1][2:-1]))
673
+ elif id == lex.EXTENSION: # pragma: no cover
674
+ results.append(handle_extension(lex.next()[1][2:-1]))
675
+ elif id == lex.TEXT:
676
+ results.append(lex.next()[1])
677
+ elif id == lex.DOLLAR_DOLLAR_BRACE:
678
+ results.append(lex.next()[1][1:])
679
+ # return single element as is, i.e. typed
680
+ if len(results) == 1:
681
+ return results[0]
682
+ # otherwise join elements to a string
683
+ else:
684
+ return "".join(map(unicode, results))
685
+
686
+
687
+ def eval_default_arg(forward_variable, default, symbols, macro):
688
+ if forward_variable is None:
689
+ return eval_text(default, symbols)
690
+ try:
691
+ return symbols[forward_variable]
692
+ except KeyError: # pragma: no cover
693
+ if default is not None:
694
+ return eval_text(default, symbols)
695
+ else:
696
+ raise XacroException(
697
+ "Undefined property to forward: " + forward_variable, macro=macro
698
+ )
699
+
700
+
701
+ def handle_dynamic_macro_call(node, macros, symbols):
702
+ (name,) = reqd_attrs(node, ["macro"])
703
+ if not name: # pragma: no cover
704
+ raise XacroException("xacro:call is missing the 'macro' attribute")
705
+ name = unicode(eval_text(name, symbols))
706
+
707
+ # remove 'macro' attribute and rename tag with resolved macro name
708
+ node.removeAttribute("macro")
709
+ node.tagName = "xacro:" + name
710
+ # forward to handle_macro_call
711
+ handle_macro_call(node, macros, symbols)
712
+ return True
713
+
714
+
715
+ def resolve_macro(fullname, macros):
716
+ # split name into namespaces and real name
717
+ namespaces = fullname.split(".")
718
+ name = namespaces.pop(-1)
719
+
720
+ def _resolve(namespaces, name, macros):
721
+ # traverse namespaces to actual macros dict
722
+ for ns in namespaces:
723
+ macros = macros[ns]
724
+ return macros[name]
725
+
726
+ # try fullname and (namespaces, name) in this order
727
+ try:
728
+ return _resolve([], fullname, macros)
729
+ except KeyError:
730
+ if namespaces:
731
+ return _resolve(namespaces, name, macros)
732
+ else:
733
+ raise
734
+
735
+
736
+ def handle_macro_call(node, macros, symbols):
737
+ if node.tagName == "xacro:call":
738
+ return handle_dynamic_macro_call(node, macros, symbols)
739
+ elif not node.tagName.startswith("xacro:"):
740
+ return False # no macro
741
+
742
+ name = node.tagName[6:] # drop 'xacro:' prefix
743
+ try:
744
+ m = resolve_macro(name, macros)
745
+ body = m.body.cloneNode(deep=True)
746
+
747
+ except KeyError:
748
+ raise XacroException("unknown macro name: %s" % node.tagName)
749
+
750
+ # Expand the macro
751
+ scoped = Table(symbols) # new local name space for macro evaluation
752
+ params = m.params[:] # deep copy macro's params list
753
+ for name, value in node.attributes.items():
754
+ if name not in params: # pragma: no cover
755
+ raise XacroException('Invalid parameter "%s"' % unicode(name), macro=m)
756
+ params.remove(name)
757
+ scoped._setitem(name, eval_text(value, symbols), unevaluated=False)
758
+ node.setAttribute(name, "") # suppress second evaluation in eval_all()
759
+
760
+ # Evaluate block parameters in node
761
+ eval_all(node, macros, symbols)
762
+
763
+ # Fetch block parameters, in order
764
+ block = first_child_element(node)
765
+ for param in params[:]:
766
+ if param[0] == "*":
767
+ if not block: # pragma: no cover
768
+ raise XacroException("Not enough blocks", macro=m)
769
+ params.remove(param)
770
+ scoped[param] = block
771
+ block = next_sibling_element(block)
772
+
773
+ if block is not None: # pragma: no cover
774
+ raise XacroException('Unused block "%s"' % block.tagName, macro=m)
775
+
776
+ # Try to load defaults for any remaining non-block parameters
777
+ for param in params[:]:
778
+ # block parameters are not supported for defaults
779
+ if param[0] == "*": # pragma: no cover
780
+ continue
781
+
782
+ # get default
783
+ name, default = m.defaultmap.get(param, (None, None))
784
+ if name is not None or default is not None:
785
+ scoped._setitem(
786
+ param, eval_default_arg(name, default, symbols, m), unevaluated=False
787
+ )
788
+ params.remove(param)
789
+
790
+ if params:
791
+ raise XacroException("Undefined parameters [%s]" % ",".join(params), macro=m)
792
+
793
+ try:
794
+ eval_all(body, macros, scoped)
795
+ except Exception as e: # pragma: no cover
796
+ # fill in macro call history for nice error reporting
797
+ if hasattr(e, "macros"):
798
+ e.macros.append(m)
799
+ else:
800
+ e.macros = [m]
801
+ raise
802
+
803
+ # Replaces the macro node with the expansion
804
+ remove_previous_comments(node)
805
+ replace_node(node, by=body, content_only=True)
806
+ return True
807
+
808
+
809
+ def get_boolean_value(value, condition):
810
+ """
811
+ Return a boolean value that corresponds to the given Xacro condition value.
812
+ Values "true", "1" and "1.0" are supposed to be True.
813
+ Values "false", "0" and "0.0" are supposed to be False.
814
+ All other values raise an exception.
815
+ :param value: The value to be evaluated. The value has to already be
816
+ evaluated by Xacro.
817
+ :param condition: The original condition text in the XML.
818
+ :return: The corresponding boolean value, or a Python expression that,
819
+ converted to boolean, corresponds to it.
820
+ :raises ValueError: If the condition value is incorrect.
821
+ """
822
+ try:
823
+ if isinstance(value, _basestr):
824
+ if value == "true" or value == "True":
825
+ return True
826
+ elif value == "false" or value == "False":
827
+ return False
828
+ else:
829
+ return bool(int(value))
830
+ else:
831
+ return bool(value)
832
+ except Exception:
833
+ raise XacroException(
834
+ 'Xacro conditional "%s" evaluated to "%s", '
835
+ "which is not a boolean expression." % (condition, value)
836
+ )
837
+
838
+
839
+ _empty_text_node = (
840
+ xml.dom.minidom.getDOMImplementation()
841
+ .createDocument(None, "dummy", None)
842
+ .createTextNode("\n\n")
843
+ )
844
+
845
+
846
+ def remove_previous_comments(node):
847
+ """remove consecutive comments in front of the xacro-specific node"""
848
+ next = node.nextSibling
849
+ previous = node.previousSibling
850
+ while previous:
851
+ if (
852
+ previous.nodeType == xml.dom.Node.TEXT_NODE
853
+ and previous.data.isspace()
854
+ and previous.data.count("\n") <= 1
855
+ ):
856
+ # skip a single empty text node (max 1 newline)
857
+ previous = previous.previousSibling
858
+
859
+ if previous and previous.nodeType == xml.dom.Node.COMMENT_NODE:
860
+ comment = previous
861
+ previous = previous.previousSibling
862
+ node.parentNode.removeChild(comment)
863
+ else:
864
+ # insert empty text node to stop removing of comments in future
865
+ # calls actually this moves the singleton instance to the new
866
+ # location
867
+ if next and _empty_text_node != next:
868
+ node.parentNode.insertBefore(_empty_text_node, next)
869
+ return
870
+
871
+
872
+ def eval_all(node, macros, symbols):
873
+ """
874
+ Recursively evaluate node, expanding macros, replacing properties,
875
+ and evaluating expressions
876
+ """
877
+ # evaluate the attributes
878
+ for name, value in node.attributes.items():
879
+ if name.startswith("xacro:"): # remove xacro:* attributes
880
+ node.removeAttribute(name)
881
+ else:
882
+ result = unicode(eval_text(value, symbols))
883
+ node.setAttribute(name, result)
884
+
885
+ # remove xacro namespace definition
886
+ try:
887
+ node.removeAttribute("xmlns:xacro")
888
+ except xml.dom.NotFoundErr:
889
+ pass
890
+
891
+ node = node.firstChild
892
+ while node:
893
+ next = node.nextSibling
894
+ if node.nodeType == xml.dom.Node.ELEMENT_NODE:
895
+ if node.tagName == "xacro:insert_block":
896
+ (name,) = check_attrs(node, ["name"], [])
897
+
898
+ if ("**" + name) in symbols:
899
+ # Multi-block
900
+ block = symbols["**" + name]
901
+ content_only = True
902
+ elif ("*" + name) in symbols:
903
+ # Single block
904
+ block = symbols["*" + name]
905
+ content_only = False
906
+ else: # pragma: no cover
907
+ raise XacroException('Undefined block "%s"' % name)
908
+
909
+ # cloning block allows to insert the same block multiple times
910
+ block = block.cloneNode(deep=True)
911
+ # recursively evaluate block
912
+ eval_all(block, macros, symbols)
913
+ replace_node(node, by=block, content_only=content_only)
914
+
915
+ elif node.tagName == "xacro:include":
916
+ process_include(node, macros, symbols, eval_all)
917
+
918
+ elif node.tagName == "xacro:property":
919
+ grab_property(node, symbols)
920
+
921
+ elif node.tagName == "xacro:macro":
922
+ grab_macro(node, macros)
923
+
924
+ elif node.tagName == "xacro:arg":
925
+ name, default = check_attrs(node, ["name", "default"], [])
926
+ if name not in substitution_args_context["arg"]:
927
+ substitution_args_context["arg"][name] = eval_text(default, symbols)
928
+
929
+ remove_previous_comments(node)
930
+ replace_node(node, by=None)
931
+
932
+ elif node.tagName == "xacro:element":
933
+ name = eval_text(*reqd_attrs(node, ["xacro:name"]), symbols=symbols)
934
+ if not name: # pragma: no cover
935
+ raise XacroException("xacro:element: empty name")
936
+
937
+ node.removeAttribute("xacro:name")
938
+ node.nodeName = node.tagName = name
939
+ continue # re-process the node with new tagName
940
+
941
+ elif node.tagName == "xacro:attribute":
942
+ name, value = [
943
+ eval_text(a, symbols) for a in reqd_attrs(node, ["name", "value"])
944
+ ]
945
+ if not name: # pragma: no cover
946
+ raise XacroException("xacro:attribute: empty name")
947
+
948
+ node.parentNode.setAttribute(name, value)
949
+ replace_node(node, by=None)
950
+
951
+ elif node.tagName in ["xacro:if", "xacro:unless"]:
952
+ remove_previous_comments(node)
953
+ (cond,) = check_attrs(node, ["value"], [])
954
+ keep = get_boolean_value(eval_text(cond, symbols), cond)
955
+ if node.tagName in ["unless", "xacro:unless"]:
956
+ keep = not keep
957
+
958
+ if keep:
959
+ eval_all(node, macros, symbols)
960
+ replace_node(node, by=node, content_only=True)
961
+ else:
962
+ replace_node(node, by=None)
963
+
964
+ elif handle_macro_call(node, macros, symbols):
965
+ # handle_macro_call does all the work of expanding the macro
966
+ pass
967
+
968
+ else:
969
+ eval_all(node, macros, symbols)
970
+
971
+ # TODO: Also evaluate content of COMMENT_NODEs?
972
+ elif node.nodeType == xml.dom.Node.TEXT_NODE:
973
+ node.data = unicode(eval_text(node.data, symbols))
974
+
975
+ node = next
976
+
977
+
978
+ def parse(inp, filename=None):
979
+ """
980
+ Parse input or filename into a DOM tree.
981
+ If inp is None, open filename and load from there.
982
+ Otherwise, parse inp, either as string or file object.
983
+ If inp is already a DOM tree, this function is a noop.
984
+ :return:xml.dom.minidom.Document
985
+ :raise: xml.parsers.expat.ExpatError
986
+ """
987
+
988
+ f = None
989
+ if inp is None:
990
+ try:
991
+ inp = f = open(filename)
992
+ except IOError as e:
993
+ # do not report currently processed file as "in file ..."
994
+ filestack.pop()
995
+ raise XacroException(e.strerror + ": " + e.filename, exc=e)
996
+
997
+ try:
998
+ if isinstance(inp, _basestr):
999
+ return xml.dom.minidom.parseString(inp)
1000
+ elif hasattr(inp, "read"):
1001
+ return xml.dom.minidom.parse(inp)
1002
+ return inp # pragma: no cover
1003
+
1004
+ finally:
1005
+ if f:
1006
+ f.close()
1007
+
1008
+
1009
+ def process_doc(doc, mappings=None, **kwargs):
1010
+ global verbosity
1011
+ verbosity = kwargs.get("verbosity", verbosity)
1012
+
1013
+ # set substitution args
1014
+ substitution_args_context["arg"] = {} if mappings is None else mappings
1015
+
1016
+ # if not yet defined: initialize filestack
1017
+ if not filestack:
1018
+ restore_filestack([None])
1019
+
1020
+ macros = {}
1021
+ symbols = Table()
1022
+
1023
+ # apply xacro:targetNamespace as global xmlns (if defined)
1024
+ targetNS = doc.documentElement.getAttribute("xacro:targetNamespace")
1025
+ if targetNS:
1026
+ doc.documentElement.removeAttribute("xacro:targetNamespace")
1027
+ doc.documentElement.setAttribute("xmlns", targetNS)
1028
+
1029
+ eval_all(doc.documentElement, macros, symbols)
1030
+
1031
+ # reset substitution args
1032
+ substitution_args_context["arg"] = {}
1033
+
1034
+
1035
+ def open_output(output_filename):
1036
+ if output_filename is None: # pragma: no cover
1037
+ return sys.stdout
1038
+ else: # pragma: no cover
1039
+ dir_name = os.path.dirname(output_filename)
1040
+ if dir_name:
1041
+ try:
1042
+ os.makedirs(dir_name)
1043
+ except os.error:
1044
+ # errors occur when dir_name exists or creation failed
1045
+ # ignore error here; opening of file will fail if directory
1046
+ # is still missing
1047
+ pass
1048
+
1049
+ try:
1050
+ return open(output_filename, "w")
1051
+ except IOError as e:
1052
+ raise XacroException("Failed to open output:", exc=e)
1053
+
1054
+
1055
+ def print_location(filestack, err=None, file=sys.stderr):
1056
+ macros = getattr(err, "macros", []) if err else []
1057
+ msg = "when instantiating macro:"
1058
+ for m in macros: # pragma: no cover
1059
+ name = m.body.getAttribute("name")
1060
+ location = "(%s)" % m.history[-1][-1]
1061
+ print(msg, name, location, file=file)
1062
+ msg = "instantiated from:"
1063
+
1064
+ msg = "in file:" if macros else "when processing file:"
1065
+ for f in reversed(filestack):
1066
+ if f is None:
1067
+ f = "string"
1068
+ print(msg, f, file=file)
1069
+ msg = "included from:"
1070
+
1071
+
1072
+ def process_file(input_file_name, **kwargs): # pragma: no cover
1073
+ """main processing pipeline"""
1074
+ # initialize file stack for error-reporting
1075
+ restore_filestack([input_file_name])
1076
+ # parse the document into a xml.dom tree
1077
+ doc = parse(None, input_file_name)
1078
+ # perform macro replacement
1079
+ process_doc(doc, **kwargs)
1080
+
1081
+ # add xacro auto-generated banner
1082
+ banner = [
1083
+ xml.dom.minidom.Comment(c)
1084
+ for c in [
1085
+ " %s " % ("=" * 83),
1086
+ " | This document was autogenerated by xacro from %-30s | "
1087
+ % input_file_name,
1088
+ " | EDITING THIS FILE BY HAND IS NOT RECOMMENDED %-30s | " % "",
1089
+ " %s " % ("=" * 83),
1090
+ ]
1091
+ ]
1092
+ first = doc.firstChild
1093
+ for comment in banner:
1094
+ doc.insertBefore(comment, first)
1095
+
1096
+ return doc
1097
+
1098
+
1099
+ def main(filename, tld_other=None): # pragma: no cover
1100
+ opts = {
1101
+ "output": None,
1102
+ "just_deps": False,
1103
+ "in_order": True,
1104
+ "verbosity": 1,
1105
+ "just_includes": False,
1106
+ "mappings": {},
1107
+ }
1108
+
1109
+ global tld
1110
+
1111
+ if tld_other is None:
1112
+ tld = ".."
1113
+ else:
1114
+ tld = tld_other
1115
+
1116
+ try:
1117
+ # open and process file
1118
+ doc = process_file(filename, **opts)
1119
+ # open the output file
1120
+ out = open_output(opts["output"])
1121
+
1122
+ except Exception as e:
1123
+ msg = unicode(e)
1124
+ if not msg:
1125
+ msg = repr(e)
1126
+ error(msg)
1127
+ if verbosity > 0:
1128
+ print_location(filestack, e)
1129
+ if verbosity > 1:
1130
+ print(file=sys.stderr) # add empty separator line before error
1131
+ raise # create stack trace
1132
+ else:
1133
+ sys.exit(2) # gracefully exit with error condition
1134
+
1135
+ # special output mode
1136
+ if opts["just_deps"]:
1137
+ out.write(" ".join(set(all_includes)))
1138
+ print()
1139
+ return
1140
+
1141
+ # write output
1142
+ # out.write(doc.toprettyxml(indent=' ', **encoding))
1143
+ # print()
1144
+ # only close output file, but not stdout
1145
+ if opts["output"]:
1146
+ out.close()
1147
+
1148
+ return doc.toprettyxml(indent=" ", **encoding)