roboticstoolbox-python 1.3.0__cp312-cp312-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.
- roboticstoolbox/__init__.py +104 -0
- roboticstoolbox/backends/Connector.py +107 -0
- roboticstoolbox/backends/Dynamixel/README.md +9 -0
- roboticstoolbox/backends/Dynamixel/dynamixel.json +581 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_io.py +450 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/LICENSE +201 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/README.md +28 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/ReleaseNote.md +181 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/__init__.py +27 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_bulk_read.py +163 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_bulk_write.py +109 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_sync_read.py +166 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/group_sync_write.py +99 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/packet_handler.py +33 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/port_handler.py +155 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/protocol1_packet_handler.py +548 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/protocol2_packet_handler.py +1080 -0
- roboticstoolbox/backends/Dynamixel/dynamixel_sdk/robotis_def.py +75 -0
- roboticstoolbox/backends/Dynamixel/dyndata.py +121 -0
- roboticstoolbox/backends/PyPlot/EllipsePlot.py +253 -0
- roboticstoolbox/backends/PyPlot/PyPlot.py +769 -0
- roboticstoolbox/backends/PyPlot/PyPlot2.py +526 -0
- roboticstoolbox/backends/PyPlot/README.md +67 -0
- roboticstoolbox/backends/PyPlot/RobotPlot.py +247 -0
- roboticstoolbox/backends/PyPlot/RobotPlot2.py +123 -0
- roboticstoolbox/backends/PyPlot/__init__.py +4 -0
- roboticstoolbox/backends/ROS/ROS.py +129 -0
- roboticstoolbox/backends/ROS/__init__.py +3 -0
- roboticstoolbox/backends/__init__.py +39 -0
- roboticstoolbox/backends/swift/__init__.py +26 -0
- roboticstoolbox/bin/__init__.py +0 -0
- roboticstoolbox/bin/rtbtool.py +307 -0
- roboticstoolbox/blocks/Icons/250x250/armplot.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/bicycle.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/camera.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/circlepath.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/coriolis.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/ctraj.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/delta2tr.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/diffsteer.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/fdyn.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/fdynx.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/fkine.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/gravload.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/idyn.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/idynx.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/ikine.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/inertia.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/jacobian.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/jtraj.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/lspb.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/multirotor.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/multirotormixer.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/multirotorplot.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/point2tr.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/tr2delta.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/tr2t.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/unicycle.png +0 -0
- roboticstoolbox/blocks/Icons/250x250/vehicleplot.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/armplot.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/bicycle.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/camera.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/circlepath.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/coriolis.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/delta2tr.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/diffsteer.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/fdyn.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/fdynx.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/fkine.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/gravload.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/idyn.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/idynx.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/ikine.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/inertia.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/jacobian.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/jtraj.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/lspb.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/multirotor.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/multirotormixer.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/multirotorplot.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/point2tr.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/tr2delta.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/tr2t.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/unicycle.png +0 -0
- roboticstoolbox/blocks/Icons/50x50/vehicleplot.png +0 -0
- roboticstoolbox/blocks/Icons/armplot.png +0 -0
- roboticstoolbox/blocks/Icons/bicycle.png +0 -0
- roboticstoolbox/blocks/Icons/camera.png +0 -0
- roboticstoolbox/blocks/Icons/circlepath.png +0 -0
- roboticstoolbox/blocks/Icons/coriolis.png +0 -0
- roboticstoolbox/blocks/Icons/ctraj.png +0 -0
- roboticstoolbox/blocks/Icons/delta2tr.png +0 -0
- roboticstoolbox/blocks/Icons/diffsteer.png +0 -0
- roboticstoolbox/blocks/Icons/fdyn.png +0 -0
- roboticstoolbox/blocks/Icons/fdynx.png +0 -0
- roboticstoolbox/blocks/Icons/fkine.png +0 -0
- roboticstoolbox/blocks/Icons/gravload.png +0 -0
- roboticstoolbox/blocks/Icons/idyn.png +0 -0
- roboticstoolbox/blocks/Icons/idynx.png +0 -0
- roboticstoolbox/blocks/Icons/ikine.png +0 -0
- roboticstoolbox/blocks/Icons/inertia.png +0 -0
- roboticstoolbox/blocks/Icons/jacobian.png +0 -0
- roboticstoolbox/blocks/Icons/jtraj.png +0 -0
- roboticstoolbox/blocks/Icons/lspb.png +0 -0
- roboticstoolbox/blocks/Icons/multirotor.png +0 -0
- roboticstoolbox/blocks/Icons/multirotormixer.png +0 -0
- roboticstoolbox/blocks/Icons/multirotorplot.png +0 -0
- roboticstoolbox/blocks/Icons/point2tr.png +0 -0
- roboticstoolbox/blocks/Icons/tr2delta.png +0 -0
- roboticstoolbox/blocks/Icons/tr2t.png +0 -0
- roboticstoolbox/blocks/Icons/unicycle.png +0 -0
- roboticstoolbox/blocks/Icons/vehicleplot.png +0 -0
- roboticstoolbox/blocks/README.md +43 -0
- roboticstoolbox/blocks/__init__.py +6 -0
- roboticstoolbox/blocks/arm.py +1587 -0
- roboticstoolbox/blocks/mobile.py +500 -0
- roboticstoolbox/blocks/quad_model.py +132 -0
- roboticstoolbox/blocks/spatial.py +245 -0
- roboticstoolbox/blocks/uav.py +949 -0
- roboticstoolbox/core/Eigen/Cholesky +45 -0
- roboticstoolbox/core/Eigen/CholmodSupport +48 -0
- roboticstoolbox/core/Eigen/Core +384 -0
- roboticstoolbox/core/Eigen/Dense +7 -0
- roboticstoolbox/core/Eigen/Eigen +2 -0
- roboticstoolbox/core/Eigen/Eigenvalues +60 -0
- roboticstoolbox/core/Eigen/Geometry +59 -0
- roboticstoolbox/core/Eigen/Householder +29 -0
- roboticstoolbox/core/Eigen/IterativeLinearSolvers +48 -0
- roboticstoolbox/core/Eigen/Jacobi +32 -0
- roboticstoolbox/core/Eigen/KLUSupport +41 -0
- roboticstoolbox/core/Eigen/LU +47 -0
- roboticstoolbox/core/Eigen/MetisSupport +35 -0
- roboticstoolbox/core/Eigen/OrderingMethods +70 -0
- roboticstoolbox/core/Eigen/PaStiXSupport +49 -0
- roboticstoolbox/core/Eigen/PardisoSupport +35 -0
- roboticstoolbox/core/Eigen/QR +50 -0
- roboticstoolbox/core/Eigen/QtAlignedMalloc +39 -0
- roboticstoolbox/core/Eigen/SPQRSupport +34 -0
- roboticstoolbox/core/Eigen/SVD +50 -0
- roboticstoolbox/core/Eigen/Sparse +34 -0
- roboticstoolbox/core/Eigen/SparseCholesky +37 -0
- roboticstoolbox/core/Eigen/SparseCore +69 -0
- roboticstoolbox/core/Eigen/SparseLU +50 -0
- roboticstoolbox/core/Eigen/SparseQR +36 -0
- roboticstoolbox/core/Eigen/StdDeque +27 -0
- roboticstoolbox/core/Eigen/StdList +26 -0
- roboticstoolbox/core/Eigen/StdVector +27 -0
- roboticstoolbox/core/Eigen/SuperLUSupport +64 -0
- roboticstoolbox/core/Eigen/UmfPackSupport +40 -0
- roboticstoolbox/core/Eigen/src/Cholesky/LDLT.h +688 -0
- roboticstoolbox/core/Eigen/src/Cholesky/LLT.h +558 -0
- roboticstoolbox/core/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- roboticstoolbox/core/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
- roboticstoolbox/core/Eigen/src/Core/ArithmeticSequence.h +413 -0
- roboticstoolbox/core/Eigen/src/Core/Array.h +417 -0
- roboticstoolbox/core/Eigen/src/Core/ArrayBase.h +226 -0
- roboticstoolbox/core/Eigen/src/Core/ArrayWrapper.h +209 -0
- roboticstoolbox/core/Eigen/src/Core/Assign.h +90 -0
- roboticstoolbox/core/Eigen/src/Core/AssignEvaluator.h +1010 -0
- roboticstoolbox/core/Eigen/src/Core/Assign_MKL.h +178 -0
- roboticstoolbox/core/Eigen/src/Core/BandMatrix.h +353 -0
- roboticstoolbox/core/Eigen/src/Core/Block.h +448 -0
- roboticstoolbox/core/Eigen/src/Core/BooleanRedux.h +162 -0
- roboticstoolbox/core/Eigen/src/Core/CommaInitializer.h +164 -0
- roboticstoolbox/core/Eigen/src/Core/ConditionEstimator.h +175 -0
- roboticstoolbox/core/Eigen/src/Core/CoreEvaluators.h +1741 -0
- roboticstoolbox/core/Eigen/src/Core/CoreIterators.h +132 -0
- roboticstoolbox/core/Eigen/src/Core/CwiseBinaryOp.h +183 -0
- roboticstoolbox/core/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
- roboticstoolbox/core/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- roboticstoolbox/core/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- roboticstoolbox/core/Eigen/src/Core/CwiseUnaryView.h +132 -0
- roboticstoolbox/core/Eigen/src/Core/DenseBase.h +701 -0
- roboticstoolbox/core/Eigen/src/Core/DenseCoeffsBase.h +685 -0
- roboticstoolbox/core/Eigen/src/Core/DenseStorage.h +652 -0
- roboticstoolbox/core/Eigen/src/Core/Diagonal.h +258 -0
- roboticstoolbox/core/Eigen/src/Core/DiagonalMatrix.h +391 -0
- roboticstoolbox/core/Eigen/src/Core/DiagonalProduct.h +28 -0
- roboticstoolbox/core/Eigen/src/Core/Dot.h +318 -0
- roboticstoolbox/core/Eigen/src/Core/EigenBase.h +160 -0
- roboticstoolbox/core/Eigen/src/Core/ForceAlignedAccess.h +150 -0
- roboticstoolbox/core/Eigen/src/Core/Fuzzy.h +155 -0
- roboticstoolbox/core/Eigen/src/Core/GeneralProduct.h +465 -0
- roboticstoolbox/core/Eigen/src/Core/GenericPacketMath.h +1040 -0
- roboticstoolbox/core/Eigen/src/Core/GlobalFunctions.h +194 -0
- roboticstoolbox/core/Eigen/src/Core/IO.h +258 -0
- roboticstoolbox/core/Eigen/src/Core/IndexedView.h +237 -0
- roboticstoolbox/core/Eigen/src/Core/Inverse.h +117 -0
- roboticstoolbox/core/Eigen/src/Core/Map.h +171 -0
- roboticstoolbox/core/Eigen/src/Core/MapBase.h +310 -0
- roboticstoolbox/core/Eigen/src/Core/MathFunctions.h +2057 -0
- roboticstoolbox/core/Eigen/src/Core/MathFunctionsImpl.h +200 -0
- roboticstoolbox/core/Eigen/src/Core/Matrix.h +565 -0
- roboticstoolbox/core/Eigen/src/Core/MatrixBase.h +547 -0
- roboticstoolbox/core/Eigen/src/Core/NestByValue.h +85 -0
- roboticstoolbox/core/Eigen/src/Core/NoAlias.h +109 -0
- roboticstoolbox/core/Eigen/src/Core/NumTraits.h +335 -0
- roboticstoolbox/core/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- roboticstoolbox/core/Eigen/src/Core/PermutationMatrix.h +605 -0
- roboticstoolbox/core/Eigen/src/Core/PlainObjectBase.h +1128 -0
- roboticstoolbox/core/Eigen/src/Core/Product.h +191 -0
- roboticstoolbox/core/Eigen/src/Core/ProductEvaluators.h +1179 -0
- roboticstoolbox/core/Eigen/src/Core/Random.h +218 -0
- roboticstoolbox/core/Eigen/src/Core/Redux.h +515 -0
- roboticstoolbox/core/Eigen/src/Core/Ref.h +381 -0
- roboticstoolbox/core/Eigen/src/Core/Replicate.h +142 -0
- roboticstoolbox/core/Eigen/src/Core/Reshaped.h +454 -0
- roboticstoolbox/core/Eigen/src/Core/ReturnByValue.h +119 -0
- roboticstoolbox/core/Eigen/src/Core/Reverse.h +217 -0
- roboticstoolbox/core/Eigen/src/Core/Select.h +164 -0
- roboticstoolbox/core/Eigen/src/Core/SelfAdjointView.h +365 -0
- roboticstoolbox/core/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- roboticstoolbox/core/Eigen/src/Core/Solve.h +188 -0
- roboticstoolbox/core/Eigen/src/Core/SolveTriangular.h +235 -0
- roboticstoolbox/core/Eigen/src/Core/SolverBase.h +168 -0
- roboticstoolbox/core/Eigen/src/Core/StableNorm.h +251 -0
- roboticstoolbox/core/Eigen/src/Core/StlIterators.h +463 -0
- roboticstoolbox/core/Eigen/src/Core/Stride.h +116 -0
- roboticstoolbox/core/Eigen/src/Core/Swap.h +68 -0
- roboticstoolbox/core/Eigen/src/Core/Transpose.h +464 -0
- roboticstoolbox/core/Eigen/src/Core/Transpositions.h +386 -0
- roboticstoolbox/core/Eigen/src/Core/TriangularMatrix.h +1001 -0
- roboticstoolbox/core/Eigen/src/Core/VectorBlock.h +96 -0
- roboticstoolbox/core/Eigen/src/Core/VectorwiseOp.h +784 -0
- roboticstoolbox/core/Eigen/src/Core/Visitor.h +381 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX/Complex.h +372 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- roboticstoolbox/core/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
- roboticstoolbox/core/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/Half.h +942 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/Settings.h +49 -0
- roboticstoolbox/core/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- roboticstoolbox/core/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
- roboticstoolbox/core/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- roboticstoolbox/core/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- roboticstoolbox/core/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- roboticstoolbox/core/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- roboticstoolbox/core/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- roboticstoolbox/core/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- roboticstoolbox/core/Eigen/src/Core/arch/NEON/Complex.h +584 -0
- roboticstoolbox/core/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- roboticstoolbox/core/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
- roboticstoolbox/core/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
- roboticstoolbox/core/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SSE/Complex.h +351 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- roboticstoolbox/core/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- roboticstoolbox/core/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
- roboticstoolbox/core/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
- roboticstoolbox/core/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
- roboticstoolbox/core/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
- roboticstoolbox/core/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
- roboticstoolbox/core/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
- roboticstoolbox/core/Eigen/src/Core/functors/StlFunctors.h +166 -0
- roboticstoolbox/core/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- roboticstoolbox/core/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
- roboticstoolbox/core/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- roboticstoolbox/core/Eigen/src/Core/products/Parallelizer.h +180 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- roboticstoolbox/core/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
- roboticstoolbox/core/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
- roboticstoolbox/core/Eigen/src/Core/util/BlasUtil.h +583 -0
- roboticstoolbox/core/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- roboticstoolbox/core/Eigen/src/Core/util/Constants.h +563 -0
- roboticstoolbox/core/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
- roboticstoolbox/core/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
- roboticstoolbox/core/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- roboticstoolbox/core/Eigen/src/Core/util/IntegralConstant.h +272 -0
- roboticstoolbox/core/Eigen/src/Core/util/MKL_support.h +137 -0
- roboticstoolbox/core/Eigen/src/Core/util/Macros.h +1464 -0
- roboticstoolbox/core/Eigen/src/Core/util/Memory.h +1163 -0
- roboticstoolbox/core/Eigen/src/Core/util/Meta.h +812 -0
- roboticstoolbox/core/Eigen/src/Core/util/NonMPL2.h +3 -0
- roboticstoolbox/core/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
- roboticstoolbox/core/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- roboticstoolbox/core/Eigen/src/Core/util/StaticAssert.h +221 -0
- roboticstoolbox/core/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- roboticstoolbox/core/Eigen/src/Core/util/XprHelper.h +856 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/RealQZ.h +657 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/RealSchur.h +558 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- roboticstoolbox/core/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
- roboticstoolbox/core/Eigen/src/Geometry/AlignedBox.h +486 -0
- roboticstoolbox/core/Eigen/src/Geometry/AngleAxis.h +247 -0
- roboticstoolbox/core/Eigen/src/Geometry/EulerAngles.h +114 -0
- roboticstoolbox/core/Eigen/src/Geometry/Homogeneous.h +501 -0
- roboticstoolbox/core/Eigen/src/Geometry/Hyperplane.h +282 -0
- roboticstoolbox/core/Eigen/src/Geometry/OrthoMethods.h +235 -0
- roboticstoolbox/core/Eigen/src/Geometry/ParametrizedLine.h +232 -0
- roboticstoolbox/core/Eigen/src/Geometry/Quaternion.h +870 -0
- roboticstoolbox/core/Eigen/src/Geometry/Rotation2D.h +199 -0
- roboticstoolbox/core/Eigen/src/Geometry/RotationBase.h +206 -0
- roboticstoolbox/core/Eigen/src/Geometry/Scaling.h +188 -0
- roboticstoolbox/core/Eigen/src/Geometry/Transform.h +1563 -0
- roboticstoolbox/core/Eigen/src/Geometry/Translation.h +202 -0
- roboticstoolbox/core/Eigen/src/Geometry/Umeyama.h +166 -0
- roboticstoolbox/core/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- roboticstoolbox/core/Eigen/src/Householder/BlockHouseholder.h +110 -0
- roboticstoolbox/core/Eigen/src/Householder/Householder.h +176 -0
- roboticstoolbox/core/Eigen/src/Householder/HouseholderSequence.h +545 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
- roboticstoolbox/core/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
- roboticstoolbox/core/Eigen/src/Jacobi/Jacobi.h +483 -0
- roboticstoolbox/core/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- roboticstoolbox/core/Eigen/src/LU/Determinant.h +117 -0
- roboticstoolbox/core/Eigen/src/LU/FullPivLU.h +877 -0
- roboticstoolbox/core/Eigen/src/LU/InverseImpl.h +432 -0
- roboticstoolbox/core/Eigen/src/LU/PartialPivLU.h +624 -0
- roboticstoolbox/core/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- roboticstoolbox/core/Eigen/src/LU/arch/InverseSize4.h +351 -0
- roboticstoolbox/core/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- roboticstoolbox/core/Eigen/src/OrderingMethods/Amd.h +435 -0
- roboticstoolbox/core/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
- roboticstoolbox/core/Eigen/src/OrderingMethods/Ordering.h +153 -0
- roboticstoolbox/core/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- roboticstoolbox/core/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
- roboticstoolbox/core/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
- roboticstoolbox/core/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- roboticstoolbox/core/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
- roboticstoolbox/core/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
- roboticstoolbox/core/Eigen/src/QR/HouseholderQR.h +434 -0
- roboticstoolbox/core/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- roboticstoolbox/core/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
- roboticstoolbox/core/Eigen/src/SVD/BDCSVD.h +1366 -0
- roboticstoolbox/core/Eigen/src/SVD/JacobiSVD.h +812 -0
- roboticstoolbox/core/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- roboticstoolbox/core/Eigen/src/SVD/SVDBase.h +376 -0
- roboticstoolbox/core/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- roboticstoolbox/core/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
- roboticstoolbox/core/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
- roboticstoolbox/core/Eigen/src/SparseCore/AmbiVector.h +378 -0
- roboticstoolbox/core/Eigen/src/SparseCore/CompressedStorage.h +274 -0
- roboticstoolbox/core/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- roboticstoolbox/core/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseAssign.h +270 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseBlock.h +571 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseDot.h +98 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseMap.h +305 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseProduct.h +181 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseRedux.h +49 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseRef.h +397 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseUtil.h +186 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseVector.h +478 -0
- roboticstoolbox/core/Eigen/src/SparseCore/SparseView.h +254 -0
- roboticstoolbox/core/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU.h +923 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- roboticstoolbox/core/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- roboticstoolbox/core/Eigen/src/SparseQR/SparseQR.h +758 -0
- roboticstoolbox/core/Eigen/src/StlSupport/StdDeque.h +116 -0
- roboticstoolbox/core/Eigen/src/StlSupport/StdList.h +106 -0
- roboticstoolbox/core/Eigen/src/StlSupport/StdVector.h +131 -0
- roboticstoolbox/core/Eigen/src/StlSupport/details.h +84 -0
- roboticstoolbox/core/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
- roboticstoolbox/core/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
- roboticstoolbox/core/Eigen/src/misc/Image.h +82 -0
- roboticstoolbox/core/Eigen/src/misc/Kernel.h +79 -0
- roboticstoolbox/core/Eigen/src/misc/RealSvd2x2.h +55 -0
- roboticstoolbox/core/Eigen/src/misc/blas.h +440 -0
- roboticstoolbox/core/Eigen/src/misc/lapack.h +152 -0
- roboticstoolbox/core/Eigen/src/misc/lapacke.h +16292 -0
- roboticstoolbox/core/Eigen/src/misc/lapacke_mangling.h +17 -0
- roboticstoolbox/core/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
- roboticstoolbox/core/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
- roboticstoolbox/core/Eigen/src/plugins/BlockMethods.h +1442 -0
- roboticstoolbox/core/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- roboticstoolbox/core/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
- roboticstoolbox/core/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- roboticstoolbox/core/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- roboticstoolbox/core/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
- roboticstoolbox/core/Eigen/src/plugins/ReshapedMethods.h +149 -0
- roboticstoolbox/core/fknm.cpp +1557 -0
- roboticstoolbox/core/fknm.h +55 -0
- roboticstoolbox/core/frne.c +351 -0
- roboticstoolbox/core/frne.h +96 -0
- roboticstoolbox/core/ik.cpp +301 -0
- roboticstoolbox/core/ik.h +59 -0
- roboticstoolbox/core/linalg.cpp +316 -0
- roboticstoolbox/core/linalg.h +64 -0
- roboticstoolbox/core/methods.cpp +372 -0
- roboticstoolbox/core/methods.h +32 -0
- roboticstoolbox/core/ne.c +493 -0
- roboticstoolbox/core/structs.cpp +24 -0
- roboticstoolbox/core/structs.h +62 -0
- roboticstoolbox/core/vmath.c +163 -0
- roboticstoolbox/core/vmath.h +32 -0
- roboticstoolbox/fknm.cp312-win_amd64.pyd +0 -0
- roboticstoolbox/frne.cp312-win_amd64.pyd +0 -0
- roboticstoolbox/mobile/Animations.py +485 -0
- roboticstoolbox/mobile/Bug2.py +455 -0
- roboticstoolbox/mobile/CurvaturePolyPlanner.py +179 -0
- roboticstoolbox/mobile/DistanceTransformPlanner.py +395 -0
- roboticstoolbox/mobile/DstarPlanner.py +591 -0
- roboticstoolbox/mobile/DubinsPlanner.py +474 -0
- roboticstoolbox/mobile/EKF.py +1617 -0
- roboticstoolbox/mobile/LatticePlanner.py +419 -0
- roboticstoolbox/mobile/OccGrid.py +613 -0
- roboticstoolbox/mobile/PRMPlanner.py +348 -0
- roboticstoolbox/mobile/ParticleFilter.py +706 -0
- roboticstoolbox/mobile/PlannerBase.py +1009 -0
- roboticstoolbox/mobile/PoseGraph.py +544 -0
- roboticstoolbox/mobile/QuinticPolyPlanner.py +349 -0
- roboticstoolbox/mobile/RRTPlanner.py +359 -0
- roboticstoolbox/mobile/ReedsSheppPlanner.py +545 -0
- roboticstoolbox/mobile/Vehicle.py +1909 -0
- roboticstoolbox/mobile/__init__.py +193 -0
- roboticstoolbox/mobile/drivers.py +390 -0
- roboticstoolbox/mobile/landmarkmap.py +181 -0
- roboticstoolbox/mobile/sensors.py +771 -0
- roboticstoolbox/models/DH/AL5D.py +121 -0
- roboticstoolbox/models/DH/Ball.py +87 -0
- roboticstoolbox/models/DH/Baxter.py +91 -0
- roboticstoolbox/models/DH/Cobra600.py +63 -0
- roboticstoolbox/models/DH/Coil.py +80 -0
- roboticstoolbox/models/DH/Hyper.py +83 -0
- roboticstoolbox/models/DH/Hyper3d.py +85 -0
- roboticstoolbox/models/DH/IRB140.py +159 -0
- roboticstoolbox/models/DH/Jaco.py +102 -0
- roboticstoolbox/models/DH/KR5.py +112 -0
- roboticstoolbox/models/DH/LWR4.py +85 -0
- roboticstoolbox/models/DH/Mico.py +102 -0
- roboticstoolbox/models/DH/Orion5.py +91 -0
- roboticstoolbox/models/DH/P8.py +80 -0
- roboticstoolbox/models/DH/Panda.py +178 -0
- roboticstoolbox/models/DH/Planar2.py +69 -0
- roboticstoolbox/models/DH/Planar3.py +51 -0
- roboticstoolbox/models/DH/Puma560.py +326 -0
- roboticstoolbox/models/DH/README.md +216 -0
- roboticstoolbox/models/DH/Sawyer.py +85 -0
- roboticstoolbox/models/DH/Stanford.py +147 -0
- roboticstoolbox/models/DH/TwoLink.py +109 -0
- roboticstoolbox/models/DH/UR10.py +124 -0
- roboticstoolbox/models/DH/UR3.py +98 -0
- roboticstoolbox/models/DH/UR5.py +98 -0
- roboticstoolbox/models/DH/Uprighttl.py +24 -0
- roboticstoolbox/models/DH/__init__.py +52 -0
- roboticstoolbox/models/ETS/Frankie.py +90 -0
- roboticstoolbox/models/ETS/GenericSeven.py +54 -0
- roboticstoolbox/models/ETS/Omni.py +74 -0
- roboticstoolbox/models/ETS/Panda.py +69 -0
- roboticstoolbox/models/ETS/Planar2.py +49 -0
- roboticstoolbox/models/ETS/Planar_Y.py +65 -0
- roboticstoolbox/models/ETS/Puma560.py +69 -0
- roboticstoolbox/models/ETS/XYPanda.py +84 -0
- roboticstoolbox/models/ETS/__init__.py +20 -0
- roboticstoolbox/models/README.md +9 -0
- roboticstoolbox/models/URDF/AL5D.py +54 -0
- roboticstoolbox/models/URDF/Fetch.py +70 -0
- roboticstoolbox/models/URDF/FetchCamera.py +71 -0
- roboticstoolbox/models/URDF/Frankie.py +75 -0
- roboticstoolbox/models/URDF/FrankieOmni.py +94 -0
- roboticstoolbox/models/URDF/KinovaGen3.py +71 -0
- roboticstoolbox/models/URDF/LBR.py +59 -0
- roboticstoolbox/models/URDF/Mico.py +68 -0
- roboticstoolbox/models/URDF/PR2.py +64 -0
- roboticstoolbox/models/URDF/Panda.py +67 -0
- roboticstoolbox/models/URDF/Puma560.py +97 -0
- roboticstoolbox/models/URDF/UR10.py +53 -0
- roboticstoolbox/models/URDF/UR3.py +53 -0
- roboticstoolbox/models/URDF/UR5.py +74 -0
- roboticstoolbox/models/URDF/Valkyrie.py +84 -0
- roboticstoolbox/models/URDF/YuMi.py +109 -0
- roboticstoolbox/models/URDF/__init__.py +53 -0
- roboticstoolbox/models/URDF/px100.py +56 -0
- roboticstoolbox/models/URDF/px150.py +56 -0
- roboticstoolbox/models/URDF/rx150.py +56 -0
- roboticstoolbox/models/URDF/rx200.py +56 -0
- roboticstoolbox/models/URDF/vx300.py +56 -0
- roboticstoolbox/models/URDF/vx300s.py +56 -0
- roboticstoolbox/models/URDF/wx200.py +56 -0
- roboticstoolbox/models/URDF/wx250.py +56 -0
- roboticstoolbox/models/URDF/wx250s.py +56 -0
- roboticstoolbox/models/__init__.py +7 -0
- roboticstoolbox/models/list.py +119 -0
- roboticstoolbox/robot/BaseRobot.py +3133 -0
- roboticstoolbox/robot/DHFactor.py +522 -0
- roboticstoolbox/robot/DHLink.py +981 -0
- roboticstoolbox/robot/DHRobot.py +2520 -0
- roboticstoolbox/robot/Dynamics.py +1620 -0
- roboticstoolbox/robot/ELink.py +23 -0
- roboticstoolbox/robot/ERobot.py +25 -0
- roboticstoolbox/robot/ET.py +1097 -0
- roboticstoolbox/robot/ETS.py +3542 -0
- roboticstoolbox/robot/Gripper.py +282 -0
- roboticstoolbox/robot/IK.py +1522 -0
- roboticstoolbox/robot/Link.py +1698 -0
- roboticstoolbox/robot/PoERobot.py +348 -0
- roboticstoolbox/robot/Robot.py +2100 -0
- roboticstoolbox/robot/RobotKinematics.py +1725 -0
- roboticstoolbox/robot/RobotProto.py +92 -0
- roboticstoolbox/robot/__init__.py +54 -0
- roboticstoolbox/tools/DHFactor.py +375 -0
- roboticstoolbox/tools/Ticker.py +53 -0
- roboticstoolbox/tools/__init__.py +54 -0
- roboticstoolbox/tools/data.py +187 -0
- roboticstoolbox/tools/jsingu.py +51 -0
- roboticstoolbox/tools/null.py +48 -0
- roboticstoolbox/tools/numerical.py +96 -0
- roboticstoolbox/tools/p_servo.py +106 -0
- roboticstoolbox/tools/params.py +11 -0
- roboticstoolbox/tools/plot.py +109 -0
- roboticstoolbox/tools/trajectory.py +1152 -0
- roboticstoolbox/tools/types.py +13 -0
- roboticstoolbox/tools/urdf/__init__.py +45 -0
- roboticstoolbox/tools/urdf/tests/data/ur5.urdf +341 -0
- roboticstoolbox/tools/urdf/tests/test_urdf.py +116 -0
- roboticstoolbox/tools/urdf/urdf.py +1976 -0
- roboticstoolbox/tools/urdf/utils.py +50 -0
- roboticstoolbox/tools/xacro/__init__.py +1148 -0
- roboticstoolbox/tools/xacro/cli.py +128 -0
- roboticstoolbox/tools/xacro/color.py +66 -0
- roboticstoolbox/tools/xacro/tests/CMakeLists.txt +4 -0
- roboticstoolbox/tools/xacro/tests/broken.xacro +1 -0
- roboticstoolbox/tools/xacro/tests/emoji.xacro +5 -0
- roboticstoolbox/tools/xacro/tests/include1.xacro +4 -0
- roboticstoolbox/tools/xacro/tests/include1.xml +1 -0
- roboticstoolbox/tools/xacro/tests/include2.xacro +4 -0
- roboticstoolbox/tools/xacro/tests/include2.xml +1 -0
- roboticstoolbox/tools/xacro/tests/robots/README +4 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.gazebo.xacro +59 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.transmission.xacro +24 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/base_v0/base.urdf.xacro +264 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/common.xacro +71 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.gazebo.xacro +36 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.transmission.xacro +20 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/forearm_v0/forearm.urdf.xacro +130 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/gazebo/gazebo.urdf.xacro +24 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.gazebo.xacro +288 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.transmission.xacro +50 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/gripper_v0/gripper.urdf.xacro +374 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.gazebo.xacro +16 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.transmission.xacro +34 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/head_v0/head.urdf.xacro +147 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/materials.urdf.xacro +52 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/pr2.urdf.xacro +157 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/pr2_1.11.4.xml +3781 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/double_stereo_camera.gazebo.xacro +16 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/double_stereo_camera.urdf.xacro +61 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/head_sensor_package.gazebo.xacro +20 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/head_sensor_package.urdf.xacro +63 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/hokuyo_lx30_laser.gazebo.xacro +39 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/hokuyo_lx30_laser.urdf.xacro +27 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_camera.gazebo.xacro +87 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_camera.urdf.xacro +55 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_prosilica_camera.gazebo.xacro +193 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/kinect_prosilica_camera.urdf.xacro +181 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/microstrain_3dmgx2_imu.gazebo.xacro +20 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/microstrain_3dmgx2_imu.urdf.xacro +25 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/projector_wg6802418.gazebo.xacro +31 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/projector_wg6802418.urdf.xacro +42 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/prosilica_gc2450_camera.gazebo.xacro +43 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/prosilica_gc2450_camera.urdf.xacro +49 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/stereo_camera.gazebo.xacro +23 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/stereo_camera.urdf.xacro +71 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/wge100_camera.gazebo.xacro +46 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/sensors/wge100_camera.urdf.xacro +47 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.gazebo.xacro +40 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.transmission.xacro +35 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/shoulder_v0/shoulder.urdf.xacro +167 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.gazebo.xacro +11 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.transmission.xacro +14 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/tilting_laser_v0/tilting_laser.urdf.xacro +60 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.gazebo.xacro +37 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.transmission.xacro +22 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/torso_v0/torso.urdf.xacro +122 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.gazebo.xacro +39 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.transmission.xacro +28 -0
- roboticstoolbox/tools/xacro/tests/robots/pr2/upper_arm_v0/upper_arm.urdf.xacro +173 -0
- roboticstoolbox/tools/xacro/tests/settings.yaml +9 -0
- roboticstoolbox/tools/xacro/tests/subdir/foo.xacro +3 -0
- roboticstoolbox/tools/xacro/tests/subdir/include-recursive.xacro +5 -0
- roboticstoolbox/tools/xacro/tests/subdir/include1.xml +1 -0
- roboticstoolbox/tools/xacro/tests/test_xacro.py +1418 -0
- roboticstoolbox/tools/xacro/xmlutils.py +152 -0
- roboticstoolbox_python-1.3.0.dist-info/METADATA +552 -0
- roboticstoolbox_python-1.3.0.dist-info/RECORD +673 -0
- roboticstoolbox_python-1.3.0.dist-info/WHEEL +5 -0
- roboticstoolbox_python-1.3.0.dist-info/entry_points.txt +6 -0
- roboticstoolbox_python-1.3.0.dist-info/licenses/LICENSE +21 -0
- spatialgeometry/__init__.py +32 -0
- spatialgeometry/geom/CollisionShape.py +419 -0
- spatialgeometry/geom/SceneGroup.py +26 -0
- spatialgeometry/geom/SceneNode.py +315 -0
- spatialgeometry/geom/Shape.py +420 -0
- spatialgeometry/geom/__init__.py +26 -0
- spatialgeometry/scene.py +107 -0
- spatialgeometry/tools/__init__.py +0 -0
- spatialgeometry/tools/stdout_supress.py +302 -0
|
@@ -0,0 +1,1418 @@
|
|
|
1
|
+
#! /usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
# Copyright (c) 2015, Open Source Robotics Foundation, Inc.
|
|
5
|
+
# Copyright (c) 2013, Willow Garage, Inc.
|
|
6
|
+
# All rights reserved.
|
|
7
|
+
#
|
|
8
|
+
# Redistribution and use in source and binary forms, with or without
|
|
9
|
+
# modification, are permitted provided that the following conditions are met:
|
|
10
|
+
#
|
|
11
|
+
# * Redistributions of source code must retain the above copyright
|
|
12
|
+
# notice, this list of conditions and the following disclaimer.
|
|
13
|
+
# * Redistributions in binary form must reproduce the above copyright
|
|
14
|
+
# notice, this list of conditions and the following disclaimer in the
|
|
15
|
+
# documentation and/or other materials provided with the distribution.
|
|
16
|
+
# * Neither the name of the Open Source Robotics Foundation, Inc.
|
|
17
|
+
# nor the names of its contributors may be used to endorse or promote
|
|
18
|
+
# products derived from this software without specific prior
|
|
19
|
+
# written permission.
|
|
20
|
+
#
|
|
21
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
22
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
23
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
24
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
25
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
26
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
27
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
28
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
29
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
30
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
31
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
|
32
|
+
|
|
33
|
+
# Authors: Stuart Glaser, William Woodall, Robert Haschke
|
|
34
|
+
# Maintainer: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
|
|
35
|
+
|
|
36
|
+
from __future__ import print_function
|
|
37
|
+
|
|
38
|
+
import ast
|
|
39
|
+
from contextlib import contextmanager
|
|
40
|
+
import os.path
|
|
41
|
+
import re
|
|
42
|
+
import subprocess
|
|
43
|
+
import sys
|
|
44
|
+
import unittest
|
|
45
|
+
from roboticstoolbox.tools import xacro
|
|
46
|
+
from roboticstoolbox.tools.xacro.cli import process_args
|
|
47
|
+
import xml.dom
|
|
48
|
+
from xml.dom.minidom import parseString
|
|
49
|
+
|
|
50
|
+
try:
|
|
51
|
+
from cStringIO import StringIO # Python 2.x
|
|
52
|
+
except ImportError:
|
|
53
|
+
from io import StringIO # Python 3.x
|
|
54
|
+
|
|
55
|
+
# regex to match whitespace
|
|
56
|
+
whitespace = re.compile(r"\s+")
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def text_values_match(a, b):
|
|
60
|
+
# generic comparison
|
|
61
|
+
if whitespace.sub(" ", a).strip() == whitespace.sub(" ", b).strip():
|
|
62
|
+
return True
|
|
63
|
+
|
|
64
|
+
try: # special handling of dicts: ignore order
|
|
65
|
+
a_dict = ast.literal_eval(a)
|
|
66
|
+
b_dict = ast.literal_eval(b)
|
|
67
|
+
if isinstance(a_dict, dict) and isinstance(b_dict, dict) and a_dict == b_dict:
|
|
68
|
+
return True
|
|
69
|
+
except Exception: # Attribute values aren't dicts
|
|
70
|
+
pass
|
|
71
|
+
|
|
72
|
+
# on failure, try to split a and b at whitespace and compare snippets
|
|
73
|
+
def match_splits(a_, b_): # pragma: no cover
|
|
74
|
+
if len(a_) != len(b_):
|
|
75
|
+
return False
|
|
76
|
+
for a, b in zip(a_, b_):
|
|
77
|
+
if a == b:
|
|
78
|
+
continue
|
|
79
|
+
try: # compare numeric values only up to some accuracy
|
|
80
|
+
if abs(float(a) - float(b)) > 1.0e-9:
|
|
81
|
+
return False
|
|
82
|
+
except ValueError: # values aren't numeric and not identical
|
|
83
|
+
return False
|
|
84
|
+
return True
|
|
85
|
+
|
|
86
|
+
return match_splits(a.split(), b.split())
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def all_attributes_match(a, b):
|
|
90
|
+
if len(a.attributes) != len(b.attributes): # pragma: no cover
|
|
91
|
+
print("Different number of attributes")
|
|
92
|
+
return False
|
|
93
|
+
a_atts = a.attributes.items()
|
|
94
|
+
b_atts = b.attributes.items()
|
|
95
|
+
a_atts.sort()
|
|
96
|
+
b_atts.sort()
|
|
97
|
+
|
|
98
|
+
for a, b in zip(a_atts, b_atts):
|
|
99
|
+
if a[0] != b[0]: # pragma: no cover
|
|
100
|
+
print("Different attribute names: %s and %s" % (a[0], b[0]))
|
|
101
|
+
return False
|
|
102
|
+
if not text_values_match(a[1], b[1]): # pragma: no cover
|
|
103
|
+
print("Different attribute values: %s and %s" % (a[1], b[1]))
|
|
104
|
+
return False
|
|
105
|
+
return True
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def text_matches(a, b):
|
|
109
|
+
if text_values_match(a, b):
|
|
110
|
+
return True
|
|
111
|
+
print("Different text values: '%s' and '%s'" % (a, b))
|
|
112
|
+
return False
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def nodes_match(a, b, ignore_nodes):
|
|
116
|
+
if not a and not b:
|
|
117
|
+
return True
|
|
118
|
+
if not a or not b: # pragma: no cover
|
|
119
|
+
return False
|
|
120
|
+
|
|
121
|
+
if a.nodeType != b.nodeType: # pragma: no cover
|
|
122
|
+
print("Different node types: %s and %s" % (a, b))
|
|
123
|
+
return False
|
|
124
|
+
|
|
125
|
+
# compare text-valued nodes
|
|
126
|
+
if a.nodeType in [
|
|
127
|
+
xml.dom.Node.TEXT_NODE,
|
|
128
|
+
xml.dom.Node.CDATA_SECTION_NODE,
|
|
129
|
+
xml.dom.Node.COMMENT_NODE,
|
|
130
|
+
]:
|
|
131
|
+
return text_matches(a.data, b.data)
|
|
132
|
+
|
|
133
|
+
# ignore all other nodes except ELEMENTs
|
|
134
|
+
if a.nodeType != xml.dom.Node.ELEMENT_NODE: # pragma: no cover
|
|
135
|
+
return True
|
|
136
|
+
|
|
137
|
+
# compare ELEMENT nodes
|
|
138
|
+
if a.nodeName != b.nodeName: # pragma: no cover
|
|
139
|
+
print("Different element names: %s and %s" % (a.nodeName, b.nodeName))
|
|
140
|
+
return False
|
|
141
|
+
|
|
142
|
+
if not all_attributes_match(a, b): # pragma: no cover
|
|
143
|
+
return False
|
|
144
|
+
|
|
145
|
+
a = a.firstChild
|
|
146
|
+
b = b.firstChild
|
|
147
|
+
while a or b:
|
|
148
|
+
# ignore whitespace-only text nodes
|
|
149
|
+
# we could have several text nodes in a row, due to replacements
|
|
150
|
+
while a and (
|
|
151
|
+
(a.nodeType in ignore_nodes)
|
|
152
|
+
or (
|
|
153
|
+
a.nodeType == xml.dom.Node.TEXT_NODE
|
|
154
|
+
and whitespace.sub("", a.data) == ""
|
|
155
|
+
)
|
|
156
|
+
):
|
|
157
|
+
a = a.nextSibling
|
|
158
|
+
while b and (
|
|
159
|
+
(b.nodeType in ignore_nodes)
|
|
160
|
+
or (
|
|
161
|
+
b.nodeType == xml.dom.Node.TEXT_NODE
|
|
162
|
+
and whitespace.sub("", b.data) == ""
|
|
163
|
+
)
|
|
164
|
+
):
|
|
165
|
+
b = b.nextSibling
|
|
166
|
+
|
|
167
|
+
if not nodes_match(a, b, ignore_nodes): # pragma: no cover
|
|
168
|
+
return False
|
|
169
|
+
|
|
170
|
+
if a:
|
|
171
|
+
a = a.nextSibling
|
|
172
|
+
if b:
|
|
173
|
+
b = b.nextSibling
|
|
174
|
+
|
|
175
|
+
return True
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def xml_matches(a, b, ignore_nodes=[]):
|
|
179
|
+
if isinstance(a, str):
|
|
180
|
+
return xml_matches(parseString(a).documentElement, b, ignore_nodes)
|
|
181
|
+
if isinstance(b, str):
|
|
182
|
+
return xml_matches(a, parseString(b).documentElement, ignore_nodes)
|
|
183
|
+
if a.nodeType == xml.dom.Node.DOCUMENT_NODE:
|
|
184
|
+
return xml_matches(a.documentElement, b, ignore_nodes)
|
|
185
|
+
if b.nodeType == xml.dom.Node.DOCUMENT_NODE:
|
|
186
|
+
return xml_matches(a, b.documentElement, ignore_nodes)
|
|
187
|
+
|
|
188
|
+
if not nodes_match(a, b, ignore_nodes): # pragma: no cover
|
|
189
|
+
print("Match failed:")
|
|
190
|
+
a.writexml(sys.stdout)
|
|
191
|
+
print()
|
|
192
|
+
print("=" * 78)
|
|
193
|
+
b.writexml(sys.stdout)
|
|
194
|
+
print()
|
|
195
|
+
return False
|
|
196
|
+
return True
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
# capture output going to file=sys.stdout | sys.stderr
|
|
200
|
+
@contextmanager
|
|
201
|
+
def capture_stderr(function, *args, **kwargs):
|
|
202
|
+
# temporarily replace sys.stderr with StringIO()
|
|
203
|
+
old, sys.stderr = sys.stderr, StringIO()
|
|
204
|
+
result = function(*args, **kwargs)
|
|
205
|
+
sys.stderr.seek(0)
|
|
206
|
+
yield (result, sys.stderr.read())
|
|
207
|
+
sys.stderr = old # restore sys.stderr
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class TestMatchXML(unittest.TestCase):
|
|
211
|
+
def test_normalize_whitespace_text(self):
|
|
212
|
+
self.assertTrue(text_matches("", " \t\n\r"))
|
|
213
|
+
|
|
214
|
+
def test_normalize_whitespace_trim(self):
|
|
215
|
+
self.assertTrue(text_matches(" foo bar ", "foo \t\n\r bar"))
|
|
216
|
+
|
|
217
|
+
def test_match_similar_numbers(self):
|
|
218
|
+
self.assertTrue(text_matches("0.123456789", "0.123456788"))
|
|
219
|
+
|
|
220
|
+
def test_mismatch_different_numbers(self):
|
|
221
|
+
self.assertFalse(text_matches("0.123456789", "0.1234567879"))
|
|
222
|
+
|
|
223
|
+
def test_match_unordered_dicts(self):
|
|
224
|
+
self.assertTrue(
|
|
225
|
+
text_matches("{'a': 1, 'b': 2, 'c': 3}", "{'c': 3, 'b': 2, 'a': 1}")
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def test_mismatch_different_dicts(self):
|
|
229
|
+
self.assertFalse(
|
|
230
|
+
text_matches("{'a': 1, 'b': 2, 'c': 3}", "{'c': 3, 'b': 2, 'a': 0}")
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
def test_empty_node_vs_whitespace(self):
|
|
234
|
+
self.assertTrue(xml_matches("""<foo/>""", """<foo> \t\n\r </foo>"""))
|
|
235
|
+
|
|
236
|
+
def test_whitespace_vs_empty_node(self):
|
|
237
|
+
self.assertTrue(xml_matches("""<foo> \t\n\r </foo>""", """<foo/>"""))
|
|
238
|
+
|
|
239
|
+
def test_normalize_whitespace_nested(self):
|
|
240
|
+
self.assertTrue(xml_matches("""<a><b/></a>""", """<a>\n<b> </b> </a>"""))
|
|
241
|
+
|
|
242
|
+
def test_ignore_comments(self):
|
|
243
|
+
self.assertTrue(
|
|
244
|
+
xml_matches(
|
|
245
|
+
"""<a><b/><!-- foo --> <!-- bar --></a>""",
|
|
246
|
+
"""<a><b/></a>""",
|
|
247
|
+
[xml.dom.Node.COMMENT_NODE],
|
|
248
|
+
)
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
class TestXacroFunctions(unittest.TestCase):
|
|
253
|
+
def test_is_valid_name(self):
|
|
254
|
+
self.assertTrue(xacro.is_valid_name("_valid_name_123"))
|
|
255
|
+
# syntactically correct keyword
|
|
256
|
+
self.assertFalse(xacro.is_valid_name("pass"))
|
|
257
|
+
self.assertFalse(xacro.is_valid_name("foo ")) # trailing whitespace
|
|
258
|
+
self.assertFalse(xacro.is_valid_name(" foo")) # leading whitespace
|
|
259
|
+
self.assertFalse(xacro.is_valid_name("1234")) # number
|
|
260
|
+
self.assertFalse(xacro.is_valid_name("1234abc")) # number and letters
|
|
261
|
+
self.assertFalse(xacro.is_valid_name("")) # empty string
|
|
262
|
+
self.assertFalse(xacro.is_valid_name(" ")) # whitespace only
|
|
263
|
+
self.assertFalse(xacro.is_valid_name("foo bar")) # several tokens
|
|
264
|
+
self.assertFalse(xacro.is_valid_name("no-dashed-names-for-you"))
|
|
265
|
+
# dot separates fields
|
|
266
|
+
self.assertFalse(xacro.is_valid_name("invalid.too"))
|
|
267
|
+
|
|
268
|
+
def test_resolve_macro(self):
|
|
269
|
+
# define three nested macro dicts with the same macro names (keys)
|
|
270
|
+
content = {"simple": "simple"}
|
|
271
|
+
ns2 = dict({k: v + "2" for k, v in content.items()})
|
|
272
|
+
ns1 = dict({k: v + "1" for k, v in content.items()})
|
|
273
|
+
ns1.update(ns2=ns2)
|
|
274
|
+
macros = dict(content)
|
|
275
|
+
macros.update(ns1=ns1)
|
|
276
|
+
|
|
277
|
+
self.assertEqual(xacro.resolve_macro("simple", macros), "simple")
|
|
278
|
+
self.assertEqual(xacro.resolve_macro("ns1.simple", macros), "simple1")
|
|
279
|
+
self.assertEqual(xacro.resolve_macro("ns1.ns2.simple", macros), "simple2")
|
|
280
|
+
|
|
281
|
+
def check_macro_arg(self, s, param, forward, default, rest):
|
|
282
|
+
p, v, r = xacro.parse_macro_arg(s)
|
|
283
|
+
self.assertEqual(p, param, msg="'{0}' != '{1}' parsing {2}".format(p, param, s))
|
|
284
|
+
if forward or default:
|
|
285
|
+
self.assertTrue(v is not None)
|
|
286
|
+
self.assertEqual(
|
|
287
|
+
v[0], forward, msg="'{0}' != '{1}' parsing {2}".format(v[0], forward, s)
|
|
288
|
+
)
|
|
289
|
+
self.assertEqual(
|
|
290
|
+
v[1], default, msg="'{0}' != '{1}' parsing {2}".format(v[1], default, s)
|
|
291
|
+
)
|
|
292
|
+
else:
|
|
293
|
+
self.assertTrue(v is None)
|
|
294
|
+
self.assertEqual(r, rest, msg="'{0}' != '{1}' parsing {2}".format(r, rest, s))
|
|
295
|
+
|
|
296
|
+
def test_parse_macro_arg(self):
|
|
297
|
+
for forward in ["", "^", "^|"]:
|
|
298
|
+
defaults = ["", "f('some string','some other')", "f('a b')"]
|
|
299
|
+
if forward == "^":
|
|
300
|
+
defaults = [""]
|
|
301
|
+
for default in defaults:
|
|
302
|
+
seps = ["=", ":="] if forward or default else [""]
|
|
303
|
+
for sep in seps:
|
|
304
|
+
for rest in ["", " ", " bar", " bar=42"]:
|
|
305
|
+
s = "foo{0}{1}{2}{3}".format(sep, forward, default, rest)
|
|
306
|
+
self.check_macro_arg(
|
|
307
|
+
s,
|
|
308
|
+
"foo",
|
|
309
|
+
"foo" if forward else None,
|
|
310
|
+
default if default else None,
|
|
311
|
+
rest.lstrip(),
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
def test_parse_macro_whitespace(self):
|
|
315
|
+
for ws in [" ", " \t ", " \n "]:
|
|
316
|
+
self.check_macro_arg(
|
|
317
|
+
ws + "foo" + ws + "bar=42" + ws, "foo", None, None, "bar=42" + ws
|
|
318
|
+
)
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
# base class providing some convenience functions
|
|
322
|
+
class TestXacroBase(unittest.TestCase):
|
|
323
|
+
def __init__(self, *args, **kwargs):
|
|
324
|
+
super(TestXacroBase, self).__init__(*args, **kwargs)
|
|
325
|
+
self.ignore_nodes = []
|
|
326
|
+
|
|
327
|
+
def assert_matches(self, a, b):
|
|
328
|
+
self.assertTrue(xml_matches(a, b, self.ignore_nodes))
|
|
329
|
+
|
|
330
|
+
def quick_xacro(self, xml, cli=None, **kwargs):
|
|
331
|
+
args = {}
|
|
332
|
+
if cli: # pragma nocover
|
|
333
|
+
opts, _ = process_args(cli, require_input=False)
|
|
334
|
+
args.update(vars(opts)) # initialize with cli args
|
|
335
|
+
args.update(kwargs) # explicit function args have highest priority
|
|
336
|
+
|
|
337
|
+
doc = xacro.parse(xml)
|
|
338
|
+
xacro.process_doc(doc, **args)
|
|
339
|
+
return doc
|
|
340
|
+
|
|
341
|
+
def run_xacro(self, input_path, *args): # pragma nocover
|
|
342
|
+
args = list(args)
|
|
343
|
+
subprocess.call(["xacro", input_path] + args)
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
# class to match XML docs while ignoring any comments
|
|
347
|
+
class TestXacroCommentsIgnored(TestXacroBase):
|
|
348
|
+
def __init__(self, *args, **kwargs):
|
|
349
|
+
super(TestXacroCommentsIgnored, self).__init__(*args, **kwargs)
|
|
350
|
+
self.ignore_nodes = [xml.dom.Node.COMMENT_NODE]
|
|
351
|
+
|
|
352
|
+
def test_pr2(self):
|
|
353
|
+
# run xacro on the pr2 tree snapshot
|
|
354
|
+
test_dir = os.path.abspath(os.path.dirname(__file__))
|
|
355
|
+
print(test_dir)
|
|
356
|
+
pr2_xacro_path = os.path.join(test_dir, "robots", "pr2", "pr2.urdf.xacro")
|
|
357
|
+
pr2_golden_parse_path = os.path.join(
|
|
358
|
+
test_dir, "robots", "pr2", "pr2_1.11.4.xml"
|
|
359
|
+
)
|
|
360
|
+
self.assert_matches(
|
|
361
|
+
xml.dom.minidom.parse(pr2_golden_parse_path),
|
|
362
|
+
self.quick_xacro(open(pr2_xacro_path)),
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
# standard test class (including the test from TestXacroCommentsIgnored)
|
|
367
|
+
class TestXacro(TestXacroCommentsIgnored):
|
|
368
|
+
def __init__(self, *args, **kwargs):
|
|
369
|
+
super(TestXacroCommentsIgnored, self).__init__(*args, **kwargs)
|
|
370
|
+
self.ignore_nodes = []
|
|
371
|
+
|
|
372
|
+
def test_invalid_property_name(self):
|
|
373
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
374
|
+
<xacro:property name="invalid.name"/></a>"""
|
|
375
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, src)
|
|
376
|
+
|
|
377
|
+
def test_dynamic_macro_names(self):
|
|
378
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
379
|
+
<xacro:macro name="foo"><a>foo</a></xacro:macro>
|
|
380
|
+
<xacro:macro name="bar"><b>bar</b></xacro:macro>
|
|
381
|
+
<xacro:property name="var" value="%s"/>
|
|
382
|
+
<xacro:call macro="${var}"/></a>"""
|
|
383
|
+
res = """<a>%s</a>"""
|
|
384
|
+
self.assert_matches(self.quick_xacro(src % "foo"), res % "<a>foo</a>")
|
|
385
|
+
self.assert_matches(self.quick_xacro(src % "bar"), res % "<b>bar</b>")
|
|
386
|
+
|
|
387
|
+
def test_dynamic_macro_name_clash(self):
|
|
388
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
389
|
+
<xacro:macro name="foo"><a name="foo"/></xacro:macro>
|
|
390
|
+
<xacro:macro name="call"><a name="bar"/></xacro:macro>
|
|
391
|
+
<xacro:call macro="foo"/></a>"""
|
|
392
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, src)
|
|
393
|
+
|
|
394
|
+
def test_dynamic_macro_undefined(self):
|
|
395
|
+
self.assertRaises(
|
|
396
|
+
xacro.XacroException,
|
|
397
|
+
self.quick_xacro,
|
|
398
|
+
"""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
399
|
+
<xacro:call macro="foo"/></a>""",
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
def test_macro_undefined(self):
|
|
403
|
+
self.assertRaises(
|
|
404
|
+
xacro.XacroException,
|
|
405
|
+
self.quick_xacro,
|
|
406
|
+
"""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
407
|
+
<xacro:undefined><foo/><bar/></xacro:undefined></a>""",
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
def test_xacro_element(self):
|
|
411
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
412
|
+
<xacro:macro name="foo" params="name"><xacro:element xacro:name="${name}"/></xacro:macro>
|
|
413
|
+
<xacro:foo name="A"/>
|
|
414
|
+
<xacro:foo name="B"/>
|
|
415
|
+
</a>""" # noqa
|
|
416
|
+
res = """<a><A/><B/></a>"""
|
|
417
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
418
|
+
|
|
419
|
+
def test_xacro_attribute(self):
|
|
420
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
421
|
+
<xacro:macro name="foo" params="name value">
|
|
422
|
+
<tag><xacro:attribute name="${name}" value="${value}"/></tag>
|
|
423
|
+
</xacro:macro>
|
|
424
|
+
<xacro:foo name="A" value="foo"/>
|
|
425
|
+
<xacro:foo name="B" value="bar"/>
|
|
426
|
+
</a>"""
|
|
427
|
+
res = """<a><tag A="foo"/><tag B="bar"/></a>"""
|
|
428
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
429
|
+
|
|
430
|
+
def test_inorder_processing(self):
|
|
431
|
+
src = """
|
|
432
|
+
<xml xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
433
|
+
<xacro:property name="foo" value="1.0"/>
|
|
434
|
+
<xacro:macro name="m" params="foo"><a foo="${foo}"/></xacro:macro>
|
|
435
|
+
<xacro:m foo="1 ${foo}"/>
|
|
436
|
+
<!-- now redefining the property and macro -->
|
|
437
|
+
<xacro:property name="foo" value="2.0"/>
|
|
438
|
+
<xacro:macro name="m" params="foo"><b bar="${foo}"/></xacro:macro>
|
|
439
|
+
<xacro:m foo="2 ${foo}"/>
|
|
440
|
+
</xml>"""
|
|
441
|
+
expected = """
|
|
442
|
+
<xml>
|
|
443
|
+
<a foo="1 1.0"/>
|
|
444
|
+
<b bar="2 2.0"/>
|
|
445
|
+
</xml>
|
|
446
|
+
"""
|
|
447
|
+
self.assert_matches(self.quick_xacro(src), expected)
|
|
448
|
+
|
|
449
|
+
def test_should_replace_before_macroexpand(self):
|
|
450
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
451
|
+
<xacro:macro name="inner" params="*the_block">
|
|
452
|
+
<in_the_inner><xacro:insert_block name="the_block" /></in_the_inner>
|
|
453
|
+
</xacro:macro>
|
|
454
|
+
<xacro:macro name="outer" params="*the_block">
|
|
455
|
+
<in_the_outer><xacro:inner><xacro:insert_block name="the_block" /></xacro:inner></in_the_outer>
|
|
456
|
+
</xacro:macro>
|
|
457
|
+
<xacro:outer><woot /></xacro:outer></a>""" # noqa
|
|
458
|
+
res = """<a><in_the_outer><in_the_inner><woot /></in_the_inner></in_the_outer></a>""" # noqa
|
|
459
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
460
|
+
|
|
461
|
+
def test_evaluate_macro_params_before_body(self):
|
|
462
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
463
|
+
<xacro:macro name="foo" params="lst">${lst[-1]}</xacro:macro>
|
|
464
|
+
<xacro:foo lst="${[1,2,3]}"/></a>"""
|
|
465
|
+
self.assert_matches(self.quick_xacro(src), """<a>3</a>""")
|
|
466
|
+
|
|
467
|
+
def test_macro_params_escaped_string(self):
|
|
468
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
469
|
+
<xacro:macro name="foo" params="a='1 -2' c=3"><bar a="${a}" c="${c}"/></xacro:macro>
|
|
470
|
+
<xacro:foo/></a>""" # noqa
|
|
471
|
+
self.assert_matches(self.quick_xacro(src), """<a><bar a="1 -2" c="3"/></a>""") # noqa
|
|
472
|
+
|
|
473
|
+
def test_property_replacement(self):
|
|
474
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
475
|
+
<xacro:property name="foo" value="42" />
|
|
476
|
+
<the_foo result="${foo}" />
|
|
477
|
+
</a>"""
|
|
478
|
+
res = """<a><the_foo result="42"/></a>"""
|
|
479
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
480
|
+
|
|
481
|
+
def test_property_scope_parent(self):
|
|
482
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
483
|
+
<xacro:macro name="foo" params="factor">
|
|
484
|
+
<xacro:property name="foo" value="${21*factor}" scope="parent"/>
|
|
485
|
+
</xacro:macro>
|
|
486
|
+
<xacro:foo factor="2"/><a foo="${foo}"/></a>"""
|
|
487
|
+
self.assert_matches(self.quick_xacro(src), """<a><a foo="42"/></a>""")
|
|
488
|
+
|
|
489
|
+
def test_property_scope_global(self):
|
|
490
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
491
|
+
<xacro:macro name="foo" params="factor">
|
|
492
|
+
<xacro:macro name="bar">
|
|
493
|
+
<xacro:property name="foo" value="${21*factor}" scope="global"/>
|
|
494
|
+
</xacro:macro>
|
|
495
|
+
<xacro:bar/>
|
|
496
|
+
</xacro:macro>
|
|
497
|
+
<xacro:foo factor="2"/><a foo="${foo}"/></a>"""
|
|
498
|
+
self.assert_matches(self.quick_xacro(src), """<a><a foo="42"/></a>""")
|
|
499
|
+
|
|
500
|
+
def test_math_ignores_spaces(self):
|
|
501
|
+
src = """<a><f v="${0.9 / 2 - 0.2}" /></a>"""
|
|
502
|
+
self.assert_matches(self.quick_xacro(src), """<a><f v="0.25" /></a>""")
|
|
503
|
+
|
|
504
|
+
# def test_substitution_args_find(self):
|
|
505
|
+
# self.assert_matches(self.quick_xacro('''<a><f v="$(find xacro)/test/test_xacro.py" /></a>'''), # noqa
|
|
506
|
+
# '''<a><f v="''' + os.path.abspath((__file__).replace(".pyc",".py") + '''" /></a>''')) # noqa
|
|
507
|
+
|
|
508
|
+
# def test_substitution_args_arg(self):
|
|
509
|
+
# res = '''<a><f v="my_arg" /></a>'''
|
|
510
|
+
# self.assert_matches(self.quick_xacro('''<a><f v="$(arg sub_arg)" /></a>''', cli=['sub_arg:=my_arg']), res) # noqa
|
|
511
|
+
|
|
512
|
+
def test_escaping_dollar_braces(self):
|
|
513
|
+
src = """<a b="$${foo}" c="$$${foo}" d="text $${foo}" e="text $$${foo}" f="$$(pwd)" />""" # noqa
|
|
514
|
+
res = """<a b="${foo}" c="$${foo}" d="text ${foo}" e="text $${foo}" f="$(pwd)" />""" # noqa
|
|
515
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
516
|
+
|
|
517
|
+
def test_just_a_dollar_sign(self):
|
|
518
|
+
src = """<a b="$" c="text $" d="text $ text"/>"""
|
|
519
|
+
self.assert_matches(self.quick_xacro(src), src)
|
|
520
|
+
|
|
521
|
+
def test_multiple_insert_blocks(self):
|
|
522
|
+
self.assert_matches(
|
|
523
|
+
self.quick_xacro("""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
524
|
+
<xacro:macro name="foo" params="*block">
|
|
525
|
+
<xacro:insert_block name="block" />
|
|
526
|
+
<xacro:insert_block name="block" />
|
|
527
|
+
</xacro:macro>
|
|
528
|
+
<xacro:foo>
|
|
529
|
+
<a_block />
|
|
530
|
+
</xacro:foo>
|
|
531
|
+
</a>"""),
|
|
532
|
+
"""<a>
|
|
533
|
+
<a_block />
|
|
534
|
+
<a_block />
|
|
535
|
+
</a>""",
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
def test_multiple_blocks(self):
|
|
539
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
540
|
+
<xacro:macro name="foo" params="*block{A} *block{B}">
|
|
541
|
+
<xacro:insert_block name="block1" />
|
|
542
|
+
<xacro:insert_block name="block2" />
|
|
543
|
+
</xacro:macro>
|
|
544
|
+
<xacro:foo>
|
|
545
|
+
<block1/>
|
|
546
|
+
<block2/>
|
|
547
|
+
</xacro:foo>
|
|
548
|
+
</a>"""
|
|
549
|
+
res = """<a>
|
|
550
|
+
<block{A}/>
|
|
551
|
+
<block{B}/>
|
|
552
|
+
</a>"""
|
|
553
|
+
# test both, reversal and non-reversal of block order
|
|
554
|
+
for d in [dict(A="1", B="2"), dict(A="2", B="1")]:
|
|
555
|
+
self.assert_matches(self.quick_xacro(src.format(**d)), res.format(**d))
|
|
556
|
+
|
|
557
|
+
def test_integer_stays_integer(self):
|
|
558
|
+
self.assert_matches(
|
|
559
|
+
self.quick_xacro("""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
560
|
+
<xacro:macro name="m" params="num">
|
|
561
|
+
<test number="${num}" />
|
|
562
|
+
</xacro:macro>
|
|
563
|
+
<xacro:m num="100" />
|
|
564
|
+
</a>"""),
|
|
565
|
+
"""
|
|
566
|
+
<a>
|
|
567
|
+
<test number="100" />
|
|
568
|
+
</a>""",
|
|
569
|
+
)
|
|
570
|
+
|
|
571
|
+
def test_insert_block_property(self):
|
|
572
|
+
self.assert_matches(
|
|
573
|
+
self.quick_xacro("""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
574
|
+
<xacro:macro name="bar">bar</xacro:macro>
|
|
575
|
+
<xacro:property name="val" value="2" />
|
|
576
|
+
<xacro:property name="some_block">
|
|
577
|
+
<some_block attr="${val}"><xacro:bar/></some_block>
|
|
578
|
+
</xacro:property>
|
|
579
|
+
<foo>
|
|
580
|
+
<xacro:insert_block name="some_block" />
|
|
581
|
+
</foo>
|
|
582
|
+
</a>"""),
|
|
583
|
+
"""
|
|
584
|
+
<a>
|
|
585
|
+
<foo><some_block attr="2">bar</some_block></foo>
|
|
586
|
+
</a>""",
|
|
587
|
+
)
|
|
588
|
+
|
|
589
|
+
# def test_include(self):
|
|
590
|
+
# src = '''<a xmlns:xacro="http://www.ros.org/xacro"><xacro:include filename="include1.xml"/></a>''' # noqa
|
|
591
|
+
# self.assert_matches(self.quick_xacro(src), '''<a><inc1/></a>''')
|
|
592
|
+
|
|
593
|
+
# def test_include_glob(self):
|
|
594
|
+
# src = '''<a xmlns:xacro="http://www.ros.org/xacro"><xacro:include filename="include{glob}.xml"/></a>''' # noqa
|
|
595
|
+
# res = '<a><inc1/><inc2/></a>'
|
|
596
|
+
# for pattern in ['*', '?', '[1-2]']:
|
|
597
|
+
# self.assert_matches(self.quick_xacro(src.format(glob=pattern)), res) # noqa
|
|
598
|
+
|
|
599
|
+
def test_include_nonexistent(self):
|
|
600
|
+
self.assertRaises(
|
|
601
|
+
xacro.XacroException,
|
|
602
|
+
self.quick_xacro,
|
|
603
|
+
"""<a xmlns:xacro="http://www.ros.org/xacro">
|
|
604
|
+
<xacro:include filename="include-nada.xml" /></a>""",
|
|
605
|
+
) # noqa
|
|
606
|
+
|
|
607
|
+
def test_include_deprecated(self):
|
|
608
|
+
# <include> tags with some non-trivial content should not issue the deprecation warning # noqa
|
|
609
|
+
src = """<a><include filename="nada"><tag/></include></a>"""
|
|
610
|
+
with capture_stderr(self.quick_xacro, src) as (result, output):
|
|
611
|
+
self.assert_matches(result, src)
|
|
612
|
+
self.assertEqual(output, "")
|
|
613
|
+
|
|
614
|
+
def test_include_from_variable(self):
|
|
615
|
+
doc = """<a xmlns:xacro="http://www.ros.org/xacro">
|
|
616
|
+
<xacro:property name="file" value="roboticstoolbox/tools/xacro/tests/include1.xml"/>
|
|
617
|
+
<xacro:include filename="${file}" /></a>""" # noqa
|
|
618
|
+
self.assert_matches(self.quick_xacro(doc), """<a><inc1/></a>""")
|
|
619
|
+
|
|
620
|
+
def test_include_with_namespace(self):
|
|
621
|
+
src = """
|
|
622
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
623
|
+
<xacro:property name="var" value="main"/>
|
|
624
|
+
<xacro:include filename="roboticstoolbox/tools/xacro/tests/include1.xacro" ns="A"/>
|
|
625
|
+
<xacro:include filename="roboticstoolbox/tools/xacro/tests/include2.xacro" ns="B"/>
|
|
626
|
+
<xacro:A.foo/><xacro:B.foo/>
|
|
627
|
+
<main var="${var}" A="${2*A.var}" B="${B.var+1}"/>
|
|
628
|
+
</a>""" # noqa
|
|
629
|
+
res = """
|
|
630
|
+
<a>
|
|
631
|
+
<inc1/><inc2/><main var="main" A="2" B="3"/>
|
|
632
|
+
</a>"""
|
|
633
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
634
|
+
|
|
635
|
+
def test_boolean_if_statement(self):
|
|
636
|
+
self.assert_matches(
|
|
637
|
+
self.quick_xacro("""
|
|
638
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
639
|
+
<xacro:if value="false">
|
|
640
|
+
<a />
|
|
641
|
+
</xacro:if>
|
|
642
|
+
<xacro:if value="true">
|
|
643
|
+
<b />
|
|
644
|
+
</xacro:if>
|
|
645
|
+
</robot>"""),
|
|
646
|
+
"""
|
|
647
|
+
<robot>
|
|
648
|
+
<b />
|
|
649
|
+
</robot>""",
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
def test_invalid_if_statement(self):
|
|
653
|
+
self.assertRaises(
|
|
654
|
+
xacro.XacroException,
|
|
655
|
+
self.quick_xacro,
|
|
656
|
+
"""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
657
|
+
<xacro:if value="nonsense"><foo/></xacro:if></a>""",
|
|
658
|
+
)
|
|
659
|
+
|
|
660
|
+
def test_integer_if_statement(self):
|
|
661
|
+
self.assert_matches(
|
|
662
|
+
self.quick_xacro("""
|
|
663
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
664
|
+
<xacro:if value="${0*42}">
|
|
665
|
+
<a />
|
|
666
|
+
</xacro:if>
|
|
667
|
+
<xacro:if value="0">
|
|
668
|
+
<b />
|
|
669
|
+
</xacro:if>
|
|
670
|
+
<xacro:if value="${0}">
|
|
671
|
+
<c />
|
|
672
|
+
</xacro:if>
|
|
673
|
+
<xacro:if value="${1*2+3}">
|
|
674
|
+
<d />
|
|
675
|
+
</xacro:if>
|
|
676
|
+
</robot>"""),
|
|
677
|
+
"""
|
|
678
|
+
<robot>
|
|
679
|
+
<d />
|
|
680
|
+
</robot>""",
|
|
681
|
+
)
|
|
682
|
+
|
|
683
|
+
def test_float_if_statement(self):
|
|
684
|
+
self.assert_matches(
|
|
685
|
+
self.quick_xacro("""
|
|
686
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
687
|
+
<xacro:if value="${3*0.0}">
|
|
688
|
+
<a />
|
|
689
|
+
</xacro:if>
|
|
690
|
+
<xacro:if value="${3*0.1}">
|
|
691
|
+
<b />
|
|
692
|
+
</xacro:if>
|
|
693
|
+
</robot>"""),
|
|
694
|
+
"""
|
|
695
|
+
<robot>
|
|
696
|
+
<b />
|
|
697
|
+
</robot>""",
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
def test_property_if_statement(self):
|
|
701
|
+
self.assert_matches(
|
|
702
|
+
self.quick_xacro("""
|
|
703
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
704
|
+
<xacro:property name="condT" value="${True}"/>
|
|
705
|
+
<xacro:property name="condF" value="${False}"/>
|
|
706
|
+
<xacro:if value="${condF}"><a /></xacro:if>
|
|
707
|
+
<xacro:if value="${condT}"><b /></xacro:if>
|
|
708
|
+
<xacro:if value="${True}"><c /></xacro:if>
|
|
709
|
+
</robot>"""),
|
|
710
|
+
"""
|
|
711
|
+
<robot>
|
|
712
|
+
<b /><c />
|
|
713
|
+
</robot>""",
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
def test_consecutive_if(self):
|
|
717
|
+
self.assert_matches(
|
|
718
|
+
self.quick_xacro("""
|
|
719
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
720
|
+
<xacro:if value="1"><xacro:if value="0"><a>bar</a></xacro:if></xacro:if>
|
|
721
|
+
</a>"""),
|
|
722
|
+
"""<a/>""",
|
|
723
|
+
)
|
|
724
|
+
|
|
725
|
+
def test_equality_expression_in_if_statement(self):
|
|
726
|
+
self.assert_matches(
|
|
727
|
+
self.quick_xacro("""
|
|
728
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
729
|
+
<xacro:property name="var" value="useit"/>
|
|
730
|
+
<xacro:if value="${var == 'useit'}"><foo>bar</foo></xacro:if>
|
|
731
|
+
<xacro:if value="${'use' in var}"><bar>foo</bar></xacro:if>
|
|
732
|
+
</a>"""),
|
|
733
|
+
"""
|
|
734
|
+
<a>
|
|
735
|
+
<foo>bar</foo>
|
|
736
|
+
<bar>foo</bar>
|
|
737
|
+
</a>""",
|
|
738
|
+
)
|
|
739
|
+
|
|
740
|
+
def test_no_evaluation(self):
|
|
741
|
+
self.assert_matches(
|
|
742
|
+
self.quick_xacro("""
|
|
743
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
744
|
+
<xacro:property name="xyz" value="5 -2"/>
|
|
745
|
+
<foo>${xyz}</foo>
|
|
746
|
+
</a>"""),
|
|
747
|
+
"""
|
|
748
|
+
<a>
|
|
749
|
+
<foo>5 -2</foo>
|
|
750
|
+
</a>""",
|
|
751
|
+
)
|
|
752
|
+
|
|
753
|
+
def test_math_expressions(self):
|
|
754
|
+
self.assert_matches(
|
|
755
|
+
self.quick_xacro("""
|
|
756
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
757
|
+
<foo function="${1. + sin(pi)}"/>
|
|
758
|
+
</a>"""),
|
|
759
|
+
"""
|
|
760
|
+
<a>
|
|
761
|
+
<foo function="1.0"/>
|
|
762
|
+
</a>""",
|
|
763
|
+
)
|
|
764
|
+
|
|
765
|
+
def test_consider_non_elements_if(self):
|
|
766
|
+
self.assert_matches(
|
|
767
|
+
self.quick_xacro("""
|
|
768
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
769
|
+
<xacro:if value="1"><!-- comment --> text <b>bar</b></xacro:if>
|
|
770
|
+
</a>"""),
|
|
771
|
+
"""
|
|
772
|
+
<a><!-- comment --> text <b>bar</b></a>""",
|
|
773
|
+
)
|
|
774
|
+
|
|
775
|
+
def test_consider_non_elements_block(self):
|
|
776
|
+
self.assert_matches(
|
|
777
|
+
self.quick_xacro("""<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
778
|
+
<xacro:macro name="foo" params="*block">
|
|
779
|
+
<!-- comment -->
|
|
780
|
+
foo
|
|
781
|
+
<xacro:insert_block name="block" />
|
|
782
|
+
</xacro:macro>
|
|
783
|
+
<xacro:foo>
|
|
784
|
+
<!-- ignored comment -->
|
|
785
|
+
ignored text
|
|
786
|
+
<a_block />
|
|
787
|
+
</xacro:foo>
|
|
788
|
+
</a>"""),
|
|
789
|
+
"""
|
|
790
|
+
<a>
|
|
791
|
+
<!-- comment -->
|
|
792
|
+
foo
|
|
793
|
+
<a_block />
|
|
794
|
+
</a>""",
|
|
795
|
+
)
|
|
796
|
+
|
|
797
|
+
def test_ignore_xacro_comments(self):
|
|
798
|
+
self.assert_matches(
|
|
799
|
+
self.quick_xacro("""
|
|
800
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
801
|
+
<!-- A -->
|
|
802
|
+
|
|
803
|
+
<!-- ignore multiline comments before any xacro tag -->
|
|
804
|
+
<!-- ignored -->
|
|
805
|
+
<xacro:property name="foo" value="1"/>
|
|
806
|
+
<!-- ignored -->
|
|
807
|
+
<xacro:if value="1"><!-- B --></xacro:if>
|
|
808
|
+
<!-- ignored -->
|
|
809
|
+
<xacro:macro name="foo"><!-- C --></xacro:macro>
|
|
810
|
+
<!-- ignored -->
|
|
811
|
+
<xacro:foo/>
|
|
812
|
+
</a>"""),
|
|
813
|
+
"""
|
|
814
|
+
<a><!-- A --><!-- B --><!-- C --></a>""",
|
|
815
|
+
)
|
|
816
|
+
|
|
817
|
+
def test_recursive_evaluation(self):
|
|
818
|
+
self.assert_matches(
|
|
819
|
+
self.quick_xacro("""
|
|
820
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
821
|
+
<xacro:property name="a" value=" 42 "/>
|
|
822
|
+
<xacro:property name="a2" value="${ 2 * a }"/>
|
|
823
|
+
<a doubled="${a2}"/>
|
|
824
|
+
</robot>"""),
|
|
825
|
+
"""
|
|
826
|
+
<robot>
|
|
827
|
+
<a doubled="84"/>
|
|
828
|
+
</robot>""",
|
|
829
|
+
)
|
|
830
|
+
|
|
831
|
+
def test_recursive_evaluation_wrong_order(self):
|
|
832
|
+
self.assert_matches(
|
|
833
|
+
self.quick_xacro("""
|
|
834
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
835
|
+
<xacro:property name="a2" value="${2*a}"/>
|
|
836
|
+
<xacro:property name="a" value="42"/>
|
|
837
|
+
<a doubled="${a2}"/>
|
|
838
|
+
</robot>"""),
|
|
839
|
+
"""
|
|
840
|
+
<robot>
|
|
841
|
+
<a doubled="84"/>
|
|
842
|
+
</robot>""",
|
|
843
|
+
)
|
|
844
|
+
|
|
845
|
+
def test_recursive_definition(self):
|
|
846
|
+
self.assertRaises(
|
|
847
|
+
xacro.XacroException,
|
|
848
|
+
self.quick_xacro,
|
|
849
|
+
"""
|
|
850
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
851
|
+
<xacro:property name="a" value="${a2}"/>
|
|
852
|
+
<xacro:property name="a2" value="${2*a}"/>
|
|
853
|
+
<a doubled="${a2}"/>
|
|
854
|
+
</robot>""",
|
|
855
|
+
)
|
|
856
|
+
|
|
857
|
+
def test_multiple_recursive_evaluation(self):
|
|
858
|
+
self.assert_matches(
|
|
859
|
+
self.quick_xacro("""
|
|
860
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
861
|
+
<xacro:property name="a" value="1"/>
|
|
862
|
+
<xacro:property name="b" value="2"/>
|
|
863
|
+
<xacro:property name="c" value="3"/>
|
|
864
|
+
<xacro:property name="product" value="${a*b*c}"/>
|
|
865
|
+
<answer product="${product}"/>
|
|
866
|
+
</robot>"""),
|
|
867
|
+
"""
|
|
868
|
+
<robot>
|
|
869
|
+
<answer product="6"/>
|
|
870
|
+
</robot>""",
|
|
871
|
+
)
|
|
872
|
+
|
|
873
|
+
def test_multiple_definition_and_evaluation(self):
|
|
874
|
+
self.assert_matches(
|
|
875
|
+
self.quick_xacro("""
|
|
876
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
877
|
+
<xacro:property name="a" value="42"/>
|
|
878
|
+
<xacro:property name="b" value="${a}"/>
|
|
879
|
+
<xacro:property name="b" value="${-a}"/>
|
|
880
|
+
<xacro:property name="b" value="${a}"/>
|
|
881
|
+
<answer b="${b} ${b} ${b}"/>
|
|
882
|
+
</robot>"""),
|
|
883
|
+
"""
|
|
884
|
+
<robot>
|
|
885
|
+
<answer b="42 42 42"/>
|
|
886
|
+
</robot>""",
|
|
887
|
+
)
|
|
888
|
+
|
|
889
|
+
def test_transitive_evaluation(self):
|
|
890
|
+
self.assert_matches(
|
|
891
|
+
self.quick_xacro("""
|
|
892
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
893
|
+
<xacro:property name="a" value="42"/>
|
|
894
|
+
<xacro:property name="b" value="${a}"/>
|
|
895
|
+
<xacro:property name="c" value="${b}"/>
|
|
896
|
+
<xacro:property name="d" value="${c}"/>
|
|
897
|
+
<answer d="${d}"/>
|
|
898
|
+
</robot>"""),
|
|
899
|
+
"""
|
|
900
|
+
<robot>
|
|
901
|
+
<answer d="42"/>
|
|
902
|
+
</robot>""",
|
|
903
|
+
)
|
|
904
|
+
|
|
905
|
+
def test_multi_tree_evaluation(self):
|
|
906
|
+
self.assert_matches(
|
|
907
|
+
self.quick_xacro("""
|
|
908
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
909
|
+
<xacro:property name="a" value="42"/>
|
|
910
|
+
<xacro:property name="b" value="2.1"/>
|
|
911
|
+
<xacro:property name="c" value="${a}"/>
|
|
912
|
+
<xacro:property name="d" value="${b}"/>
|
|
913
|
+
<xacro:property name="f" value="${c*d}"/>
|
|
914
|
+
<answer f="${f}"/>
|
|
915
|
+
</robot>"""),
|
|
916
|
+
"""
|
|
917
|
+
<robot>
|
|
918
|
+
<answer f="88.2"/>
|
|
919
|
+
</robot>""",
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
def test_from_issue(self):
|
|
923
|
+
self.assert_matches(
|
|
924
|
+
self.quick_xacro("""
|
|
925
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
926
|
+
<xacro:property name="x" value="42"/>
|
|
927
|
+
<xacro:property name="wheel_width" value="${x}"/>
|
|
928
|
+
<link name="my_link">
|
|
929
|
+
<origin xyz="0 0 ${wheel_width/2}"/>
|
|
930
|
+
</link>
|
|
931
|
+
</robot>"""),
|
|
932
|
+
"""
|
|
933
|
+
<robot>
|
|
934
|
+
<link name="my_link">
|
|
935
|
+
<origin xyz="0 0 21.0"/>
|
|
936
|
+
</link>
|
|
937
|
+
</robot>""",
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
def test_recursive_bad_math(self):
|
|
941
|
+
self.assertRaises(
|
|
942
|
+
xacro.XacroException,
|
|
943
|
+
self.quick_xacro,
|
|
944
|
+
"""
|
|
945
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
946
|
+
<xacro:property name="x" value="0"/>
|
|
947
|
+
<tag badness="${1/x}"/>
|
|
948
|
+
</robot>""",
|
|
949
|
+
)
|
|
950
|
+
|
|
951
|
+
def test_default_param(self):
|
|
952
|
+
self.assert_matches(
|
|
953
|
+
self.quick_xacro("""
|
|
954
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
955
|
+
<xacro:macro name="fixed_link" params="parent_link:=base_link child_link *joint_pose">
|
|
956
|
+
<link name="${child_link}"/>
|
|
957
|
+
<joint name="${child_link}_joint" type="fixed">
|
|
958
|
+
<xacro:insert_block name="joint_pose" />
|
|
959
|
+
<parent link="${parent_link}"/>
|
|
960
|
+
<child link="${child_link}" />
|
|
961
|
+
</joint>
|
|
962
|
+
</xacro:macro>
|
|
963
|
+
<xacro:fixed_link child_link="foo">
|
|
964
|
+
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
965
|
+
</xacro:fixed_link >
|
|
966
|
+
</robot>"""),
|
|
967
|
+
"""
|
|
968
|
+
<robot>
|
|
969
|
+
<link name="foo"/>
|
|
970
|
+
<joint name="foo_joint" type="fixed">
|
|
971
|
+
<origin rpy="0 0 0" xyz="0 0 0"/>
|
|
972
|
+
<parent link="base_link"/>
|
|
973
|
+
<child link="foo"/>
|
|
974
|
+
</joint>
|
|
975
|
+
</robot>""",
|
|
976
|
+
) # noqa
|
|
977
|
+
|
|
978
|
+
def test_default_param_override(self):
|
|
979
|
+
self.assert_matches(
|
|
980
|
+
self.quick_xacro("""
|
|
981
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
982
|
+
<xacro:macro name="fixed_link" params="parent_link:=base_link child_link *joint_pose">
|
|
983
|
+
<link name="${child_link}"/>
|
|
984
|
+
<joint name="${child_link}_joint" type="fixed">
|
|
985
|
+
<xacro:insert_block name="joint_pose" />
|
|
986
|
+
<parent link="${parent_link}"/>
|
|
987
|
+
<child link="${child_link}" />
|
|
988
|
+
</joint>
|
|
989
|
+
</xacro:macro>
|
|
990
|
+
<xacro:fixed_link child_link="foo" parent_link="bar">
|
|
991
|
+
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
992
|
+
</xacro:fixed_link >
|
|
993
|
+
</robot>"""),
|
|
994
|
+
"""
|
|
995
|
+
<robot>
|
|
996
|
+
<link name="foo"/>
|
|
997
|
+
<joint name="foo_joint" type="fixed">
|
|
998
|
+
<origin rpy="0 0 0" xyz="0 0 0"/>
|
|
999
|
+
<parent link="bar"/>
|
|
1000
|
+
<child link="foo"/>
|
|
1001
|
+
</joint>
|
|
1002
|
+
</robot>""",
|
|
1003
|
+
) # noqa
|
|
1004
|
+
|
|
1005
|
+
def test_param_missing(self):
|
|
1006
|
+
self.assertRaises(
|
|
1007
|
+
xacro.XacroException,
|
|
1008
|
+
self.quick_xacro,
|
|
1009
|
+
"""
|
|
1010
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1011
|
+
<xacro:macro name="fixed_link" params="parent_link child_link *joint_pose">
|
|
1012
|
+
<link name="${child_link}"/>
|
|
1013
|
+
<joint name="${child_link}_joint" type="fixed">
|
|
1014
|
+
<xacro:insert_block name="joint_pose" />
|
|
1015
|
+
<parent link="${parent_link}"/>
|
|
1016
|
+
<child link="${child_link}" />
|
|
1017
|
+
</joint>
|
|
1018
|
+
</xacro:macro>
|
|
1019
|
+
<xacro:fixed_link child_link="foo">
|
|
1020
|
+
<origin xyz="0 0 0" rpy="0 0 0" />
|
|
1021
|
+
</xacro:fixed_link >
|
|
1022
|
+
</robot>""",
|
|
1023
|
+
)
|
|
1024
|
+
|
|
1025
|
+
def test_default_arg(self):
|
|
1026
|
+
self.assert_matches(
|
|
1027
|
+
self.quick_xacro("""
|
|
1028
|
+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1029
|
+
<xacro:arg name="foo" default="2"/>
|
|
1030
|
+
<link name="my_link">
|
|
1031
|
+
<origin xyz="0 0 0"/>
|
|
1032
|
+
</link>
|
|
1033
|
+
</robot>
|
|
1034
|
+
"""),
|
|
1035
|
+
"""
|
|
1036
|
+
<robot>
|
|
1037
|
+
<link name="my_link">
|
|
1038
|
+
<origin xyz="0 0 0"/>
|
|
1039
|
+
</link>
|
|
1040
|
+
</robot>""",
|
|
1041
|
+
)
|
|
1042
|
+
|
|
1043
|
+
# def test_default_arg_override(self):
|
|
1044
|
+
# self.assert_matches(self.quick_xacro('''
|
|
1045
|
+
# <robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1046
|
+
# <xacro:arg name="foo" default="2"/>
|
|
1047
|
+
# <link name="my_link">
|
|
1048
|
+
# <origin xyz="0 0 $(arg foo)"/>
|
|
1049
|
+
# </link>
|
|
1050
|
+
# </robot>
|
|
1051
|
+
# ''', ['foo:=4']), '''
|
|
1052
|
+
# <robot>
|
|
1053
|
+
# <link name="my_link">
|
|
1054
|
+
# <origin xyz="0 0 4"/>
|
|
1055
|
+
# </link>
|
|
1056
|
+
# </robot>''')
|
|
1057
|
+
|
|
1058
|
+
# def test_default_arg_missing(self):
|
|
1059
|
+
# self.assertRaises(Exception, self.quick_xacro, '''
|
|
1060
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1061
|
+
# <a arg="$(arg foo)"/>
|
|
1062
|
+
# </a>
|
|
1063
|
+
# ''')
|
|
1064
|
+
|
|
1065
|
+
def test_default_arg_empty(self):
|
|
1066
|
+
self.assert_matches(
|
|
1067
|
+
self.quick_xacro("""
|
|
1068
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1069
|
+
<xacro:arg name="foo" default=""/></a>"""),
|
|
1070
|
+
"""<a/>""",
|
|
1071
|
+
)
|
|
1072
|
+
|
|
1073
|
+
def test_iterable_literals_plain(self):
|
|
1074
|
+
self.assert_matches(
|
|
1075
|
+
self.quick_xacro("""
|
|
1076
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1077
|
+
<xacro:property name="list" value="[0, 1+1, 2]"/>
|
|
1078
|
+
<xacro:property name="tuple" value="(0,1+1,2)"/>
|
|
1079
|
+
<xacro:property name="dict" value="{'a':0, 'b':1+1, 'c':2}"/>
|
|
1080
|
+
<a list="${list}" tuple="${tuple}" dict="${dict}"/>
|
|
1081
|
+
</a>"""),
|
|
1082
|
+
"""
|
|
1083
|
+
<a>
|
|
1084
|
+
<a list="[0, 1+1, 2]" tuple="(0,1+1,2)" dict="{'a':0, 'b':1+1, 'c':2}"/>
|
|
1085
|
+
</a>""",
|
|
1086
|
+
)
|
|
1087
|
+
|
|
1088
|
+
def test_iterable_literals_eval(self):
|
|
1089
|
+
self.assert_matches(
|
|
1090
|
+
self.quick_xacro("""
|
|
1091
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1092
|
+
<xacro:property name="list" value="${[0, 1+1, 2]}"/>
|
|
1093
|
+
<xacro:property name="tuple" value="${(0,1+1,2)}"/>
|
|
1094
|
+
<xacro:property name="dic" value="${dict(a=0, b=1+1, c=2)}"/>
|
|
1095
|
+
<a list="${list}" tuple="${tuple}" dict="${dic}"/>
|
|
1096
|
+
</a>"""),
|
|
1097
|
+
"""
|
|
1098
|
+
<a>
|
|
1099
|
+
<a list="[0, 2, 2]" tuple="(0, 2, 2)" dict="{'a': 0, 'c': 2, 'b': 2}"/>
|
|
1100
|
+
</a>""",
|
|
1101
|
+
)
|
|
1102
|
+
|
|
1103
|
+
def test_literals_eval(self):
|
|
1104
|
+
self.assert_matches(
|
|
1105
|
+
self.quick_xacro("""
|
|
1106
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1107
|
+
<xacro:property name="f" value="1.23"/>
|
|
1108
|
+
<xacro:property name="i" value="123"/>
|
|
1109
|
+
<xacro:property name="s" value="1_2_3"/>
|
|
1110
|
+
float=${f+1} int=${i+1} string=${s}
|
|
1111
|
+
</a>"""),
|
|
1112
|
+
"""
|
|
1113
|
+
<a>
|
|
1114
|
+
float=2.23 int=124 string=1_2_3
|
|
1115
|
+
</a>""",
|
|
1116
|
+
)
|
|
1117
|
+
|
|
1118
|
+
def test_enforce_xacro_ns(self):
|
|
1119
|
+
self.assert_matches(
|
|
1120
|
+
self.quick_xacro(
|
|
1121
|
+
"""
|
|
1122
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1123
|
+
<arg name="foo" value="bar"/>
|
|
1124
|
+
<include filename="foo"/>
|
|
1125
|
+
</a>""",
|
|
1126
|
+
xacro_ns=False,
|
|
1127
|
+
),
|
|
1128
|
+
"""
|
|
1129
|
+
<a>
|
|
1130
|
+
<arg name="foo" value="bar"/>
|
|
1131
|
+
<include filename="foo"/>
|
|
1132
|
+
</a>""",
|
|
1133
|
+
)
|
|
1134
|
+
|
|
1135
|
+
# def test_issue_68_numeric_arg(self):
|
|
1136
|
+
# # If a property is assigned from a substitution arg, then this properties' value was # noqa
|
|
1137
|
+
# # no longer converted to a python type, so that e.g. 0.5 remained u'0.5'. # noqa
|
|
1138
|
+
# # If this property is then used in a numerical expression an exception is thrown. # noqa
|
|
1139
|
+
# self.assert_matches(self.quick_xacro('''
|
|
1140
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1141
|
+
# <xacro:arg name="foo" default="0.5"/>
|
|
1142
|
+
# <xacro:property name="prop" value="$(arg foo)" />
|
|
1143
|
+
# <a prop="${prop-0.3}"/>
|
|
1144
|
+
# </a>
|
|
1145
|
+
# '''), '''
|
|
1146
|
+
# <a>
|
|
1147
|
+
# <a prop="0.2"/>
|
|
1148
|
+
# </a>''')
|
|
1149
|
+
|
|
1150
|
+
# def test_transitive_arg_evaluation(self):
|
|
1151
|
+
# self.assert_matches(self.quick_xacro('''
|
|
1152
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1153
|
+
# <xacro:arg name="foo" default="0.5"/>
|
|
1154
|
+
# <xacro:arg name="bar" default="$(arg foo)"/>
|
|
1155
|
+
# <xacro:property name="prop" value="$(arg bar)" />
|
|
1156
|
+
# <a prop="${prop-0.3}"/>
|
|
1157
|
+
# </a>
|
|
1158
|
+
# '''), '''
|
|
1159
|
+
# <a>
|
|
1160
|
+
# <a prop="0.2"/>
|
|
1161
|
+
# </a>''')
|
|
1162
|
+
|
|
1163
|
+
def test_macro_name_with_colon(self):
|
|
1164
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1165
|
+
<xacro:macro name="xacro:my_macro"><foo/></xacro:macro>
|
|
1166
|
+
<xacro:my_macro/>
|
|
1167
|
+
</a>"""
|
|
1168
|
+
res = """<a><foo/></a>"""
|
|
1169
|
+
with capture_stderr(self.quick_xacro, src) as (result, output):
|
|
1170
|
+
self.assert_matches(result, res)
|
|
1171
|
+
self.assertTrue("macro names must not contain prefix 'xacro:'" in output)
|
|
1172
|
+
|
|
1173
|
+
def test_overwrite_globals(self):
|
|
1174
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1175
|
+
<xacro:property name="pi" value="3.14"/></a>"""
|
|
1176
|
+
with capture_stderr(self.quick_xacro, src) as (result, output):
|
|
1177
|
+
self.assert_matches(result, "<a/>")
|
|
1178
|
+
self.assertTrue(output)
|
|
1179
|
+
|
|
1180
|
+
def test_no_double_evaluation(self):
|
|
1181
|
+
src = """
|
|
1182
|
+
<a xmlns:xacro="http://www.ros.org/xacro">
|
|
1183
|
+
<xacro:macro name="foo" params="a b:=${a} c:=$${a}"> a=${a} b=${b} c=${c} </xacro:macro>
|
|
1184
|
+
<xacro:property name="a" value="1"/>
|
|
1185
|
+
<xacro:property name="d" value="$${a}"/>
|
|
1186
|
+
<d d="${d}"><xacro:foo a="2"/></d>
|
|
1187
|
+
</a>""" # noqa
|
|
1188
|
+
res = """<a><d d="${a}"> a=2 b=1 c=${a} </d></a>"""
|
|
1189
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1190
|
+
|
|
1191
|
+
def test_property_forwarding(self):
|
|
1192
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1193
|
+
<xacro:property name="arg" value="42"/>
|
|
1194
|
+
<xacro:macro name="foo" params="arg:=^%s">${arg}</xacro:macro>
|
|
1195
|
+
<xacro:foo/>
|
|
1196
|
+
</a>"""
|
|
1197
|
+
res = """<a>%s</a>"""
|
|
1198
|
+
self.assert_matches(self.quick_xacro(src % ""), res % "42")
|
|
1199
|
+
self.assert_matches(self.quick_xacro(src % "|"), res % "42")
|
|
1200
|
+
self.assert_matches(self.quick_xacro(src % "|6"), res % "42")
|
|
1201
|
+
|
|
1202
|
+
# def test_extension_in_expression(self):
|
|
1203
|
+
# src = '''<a xmlns:xacro="http://www.ros.org/wiki/xacro">${2*'$(arg var)'}</a>''' # noqa
|
|
1204
|
+
# res = '''<a>%s</a>'''
|
|
1205
|
+
# self.assert_matches(self.quick_xacro(src, ['var:=xacro']), res % (2 * 'xacro')) # noqa
|
|
1206
|
+
|
|
1207
|
+
# def test_expression_in_extension(self):
|
|
1208
|
+
# src = '''<a xmlns:xacro="http://www.ros.org/wiki/xacro">$(arg ${'v'+'ar'})</a>''' # noqa
|
|
1209
|
+
# res = '''<a>%s</a>'''
|
|
1210
|
+
# self.assert_matches(self.quick_xacro(src, ['var:=xacro']), res % 'xacro') # noqa
|
|
1211
|
+
|
|
1212
|
+
def test_target_namespace(self):
|
|
1213
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro" xacro:targetNamespace="http://www.ros.org"/>""" # noqa
|
|
1214
|
+
res = """<a xmlns="http://www.ros.org"/>"""
|
|
1215
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1216
|
+
|
|
1217
|
+
def test_target_namespace_only_from_root(self):
|
|
1218
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro"><b xacro:targetNamespace="http://www.ros.org"/></a>""" # noqa
|
|
1219
|
+
res = """<a><b/></a>"""
|
|
1220
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1221
|
+
|
|
1222
|
+
# def test_include_lazy(self):
|
|
1223
|
+
# doc = ('''<a xmlns:xacro="http://www.ros.org/xacro">
|
|
1224
|
+
# <xacro:if value="false"><xacro:include filename="non-existent"/></xacro:if></a>''') # noqa
|
|
1225
|
+
# self.assert_matches(self.quick_xacro(doc), '''<a/>''')
|
|
1226
|
+
|
|
1227
|
+
# def test_issue_63_fixed_with_inorder_processing(self):
|
|
1228
|
+
# self.assert_matches(self.quick_xacro('''
|
|
1229
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1230
|
+
# <xacro:arg name="has_stuff" default="false"/>
|
|
1231
|
+
# <xacro:if value="$(arg has_stuff)">
|
|
1232
|
+
# <xacro:include file="$(find nonexistent_package)/stuff.urdf" />
|
|
1233
|
+
# </xacro:if>
|
|
1234
|
+
# </a>'''), '<a/>')
|
|
1235
|
+
|
|
1236
|
+
# def test_include_from_macro(self):
|
|
1237
|
+
# src = '''
|
|
1238
|
+
# <a xmlns:xacro="http://www.ros.org/xacro">
|
|
1239
|
+
# <xacro:macro name="foo" params="file:=include1.xml"><xacro:include filename="${file}"/></xacro:macro> # noqa
|
|
1240
|
+
# <xacro:foo/>
|
|
1241
|
+
# <xacro:foo file="${abs_filename('include1.xml')}"/>
|
|
1242
|
+
# <xacro:include filename="subdir/foo.xacro"/>
|
|
1243
|
+
# <xacro:foo file="$(cwd)/subdir/include1.xml"/>
|
|
1244
|
+
# </a>'''
|
|
1245
|
+
# res = '''<a><inc1/><inc1/><subdir_inc1/><subdir_inc1/></a>'''
|
|
1246
|
+
# self.assert_matches(self.quick_xacro(src), res)
|
|
1247
|
+
|
|
1248
|
+
# def test_yaml_support(self):
|
|
1249
|
+
# src = '''
|
|
1250
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1251
|
+
# <xacro:property name="settings" value="${load_yaml('settings.yaml')}"/>
|
|
1252
|
+
# <xacro:property name="type" value="$(arg type)"/>
|
|
1253
|
+
# <xacro:include filename="${settings['arms'][type]['file']}"/>
|
|
1254
|
+
# <xacro:call macro="${settings['arms'][type]['macro']}"/>
|
|
1255
|
+
# </a>'''
|
|
1256
|
+
# res = '''<a><{tag}/></a>'''
|
|
1257
|
+
# for i in ['inc1', 'inc2']:
|
|
1258
|
+
# self.assert_matches(self.quick_xacro(src, cli=['type:=%s' % i]),
|
|
1259
|
+
# res.format(tag=i))
|
|
1260
|
+
|
|
1261
|
+
# def test_yaml_support_dotted(self):
|
|
1262
|
+
# src = '''
|
|
1263
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1264
|
+
# <xacro:property name="settings" value="${load_yaml('settings.yaml')}"/>
|
|
1265
|
+
# <xacro:property name="type" value="$(arg type)"/>
|
|
1266
|
+
# <xacro:include filename="${settings.arms[type].file}"/>
|
|
1267
|
+
# <xacro:call macro="${settings.arms[type].macro}"/>
|
|
1268
|
+
# </a>'''
|
|
1269
|
+
# res = '''<a><{tag}/></a>'''
|
|
1270
|
+
# for i in ['inc1', 'inc2']:
|
|
1271
|
+
# self.assert_matches(self.quick_xacro(src, cli=['type:=%s' % i]),
|
|
1272
|
+
# res.format(tag=i))
|
|
1273
|
+
|
|
1274
|
+
# def test_yaml_support_dotted_key_error(self):
|
|
1275
|
+
# src = '''
|
|
1276
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1277
|
+
# <xacro:property name="settings" value="${load_yaml('settings.yaml')}"/>
|
|
1278
|
+
# <xacro:property name="bar" value="${settings.baz}"/>
|
|
1279
|
+
# ${bar}
|
|
1280
|
+
# </a>'''
|
|
1281
|
+
# self.assertRaises(xacro.XacroException, self.quick_xacro, src)
|
|
1282
|
+
|
|
1283
|
+
# def test_yaml_support_dotted_arith(self):
|
|
1284
|
+
# src = '''
|
|
1285
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1286
|
+
# <xacro:property name="settings" value="${load_yaml('settings.yaml')}"/>
|
|
1287
|
+
# <xacro:property name="bar" value="${settings.arms.inc2.props.port + 1}"/>
|
|
1288
|
+
# ${bar}
|
|
1289
|
+
# </a>'''
|
|
1290
|
+
# res = '''<a>4243</a>'''
|
|
1291
|
+
# self.assert_matches(self.quick_xacro(src), res)
|
|
1292
|
+
|
|
1293
|
+
# def test_yaml_support_key_in_dict(self):
|
|
1294
|
+
# src = '''
|
|
1295
|
+
# <a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1296
|
+
# <xacro:property name="settings" value="${load_yaml('settings.yaml')}"/>
|
|
1297
|
+
# ${'arms' in settings} ${'baz' in settings}
|
|
1298
|
+
# </a>'''
|
|
1299
|
+
# res = '''<a>True False</a>'''
|
|
1300
|
+
# self.assert_matches(self.quick_xacro(src), res)
|
|
1301
|
+
|
|
1302
|
+
def test_xacro_exist_required(self):
|
|
1303
|
+
src = """
|
|
1304
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1305
|
+
<xacro:include filename="non-existent.xacro"/>
|
|
1306
|
+
</a>"""
|
|
1307
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, src)
|
|
1308
|
+
|
|
1309
|
+
def test_xacro_exist_optional(self):
|
|
1310
|
+
src = """
|
|
1311
|
+
<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1312
|
+
<xacro:include filename="non-existent.xacro" optional="True"/>
|
|
1313
|
+
</a>"""
|
|
1314
|
+
res = """<a></a>"""
|
|
1315
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1316
|
+
|
|
1317
|
+
def test_macro_default_param_evaluation_order(self):
|
|
1318
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1319
|
+
<xacro:macro name="foo" params="arg:=${2*foo}">
|
|
1320
|
+
<xacro:property name="foo" value="-"/>
|
|
1321
|
+
<f val="${arg}"/>
|
|
1322
|
+
</xacro:macro>
|
|
1323
|
+
<xacro:property name="foo" value="${3*7}"/>
|
|
1324
|
+
<xacro:foo/>
|
|
1325
|
+
<xacro:property name="foo" value="*"/>
|
|
1326
|
+
<xacro:foo/>
|
|
1327
|
+
</a>"""
|
|
1328
|
+
res = """<a>
|
|
1329
|
+
<f val="42"/><f val="**"/></a>"""
|
|
1330
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1331
|
+
|
|
1332
|
+
def test_default_property(self):
|
|
1333
|
+
src = """
|
|
1334
|
+
<a xmlns:xacro="http://www.ros.org/xacro">
|
|
1335
|
+
<xacro:property name="prop" default="false"/>
|
|
1336
|
+
<xacro:unless value="${prop}">
|
|
1337
|
+
<foo/>
|
|
1338
|
+
<xacro:property name="prop" value="true"/>
|
|
1339
|
+
</xacro:unless>
|
|
1340
|
+
|
|
1341
|
+
<!-- second foo should be ignored -->
|
|
1342
|
+
<xacro:unless value="${prop}">
|
|
1343
|
+
<foo/>
|
|
1344
|
+
<xacro:property name="prop" value="true"/>
|
|
1345
|
+
</xacro:unless>
|
|
1346
|
+
</a>"""
|
|
1347
|
+
res = """<a><foo/></a>"""
|
|
1348
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1349
|
+
|
|
1350
|
+
def test_unicode_literal_parsing(self):
|
|
1351
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">🍔 </a>"""
|
|
1352
|
+
self.assert_matches(self.quick_xacro(src), """<a>🍔 </a>""")
|
|
1353
|
+
|
|
1354
|
+
def test_unicode_property(self):
|
|
1355
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1356
|
+
<xacro:property name="burger" value="🍔"/>
|
|
1357
|
+
${burger}</a>"""
|
|
1358
|
+
res = """<a>🍔</a>"""
|
|
1359
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1360
|
+
|
|
1361
|
+
def test_unicode_property_attribute(self):
|
|
1362
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1363
|
+
<xacro:property name="burger" value="🍔"/>
|
|
1364
|
+
<b c="${burger}"/></a>"""
|
|
1365
|
+
res = """<a><b c="🍔"/></a>"""
|
|
1366
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1367
|
+
|
|
1368
|
+
def test_unicode_property_block(self):
|
|
1369
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1370
|
+
<xacro:property name="burger">
|
|
1371
|
+
🍔
|
|
1372
|
+
</xacro:property>
|
|
1373
|
+
<xacro:insert_block name="burger"/></a>"""
|
|
1374
|
+
res = """<a>🍔</a>"""
|
|
1375
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1376
|
+
|
|
1377
|
+
def test_unicode_conditional(self):
|
|
1378
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1379
|
+
<xacro:property name="burger" value="🍔"/>
|
|
1380
|
+
<xacro:if value="${burger == u'🍔'}">
|
|
1381
|
+
🍟
|
|
1382
|
+
</xacro:if>
|
|
1383
|
+
</a>"""
|
|
1384
|
+
res = """<a>🍟</a>"""
|
|
1385
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1386
|
+
|
|
1387
|
+
def test_unicode_macro(self):
|
|
1388
|
+
src = """<a xmlns:xacro="http://www.ros.org/wiki/xacro">
|
|
1389
|
+
<xacro:macro name="burger" params="how_many">
|
|
1390
|
+
${u'🍔' * how_many}
|
|
1391
|
+
</xacro:macro>
|
|
1392
|
+
<xacro:burger how_many="4"/>
|
|
1393
|
+
</a>"""
|
|
1394
|
+
res = """<a>🍔🍔🍔🍔</a>"""
|
|
1395
|
+
self.assert_matches(self.quick_xacro(src), res)
|
|
1396
|
+
|
|
1397
|
+
# def test_unicode_file(self):
|
|
1398
|
+
# # run the full xacro processing pipeline on a file with
|
|
1399
|
+
# # unicode characters in it and make sure the output is correct
|
|
1400
|
+
# test_dir = os.path.abspath(os.path.dirname(__file__))
|
|
1401
|
+
# input_path = os.path.join(test_dir, 'emoji.xacro')
|
|
1402
|
+
# tmp_dir_name = tempfile.mkdtemp() # create directory we can trash
|
|
1403
|
+
# output_path = os.path.join(tmp_dir_name, "out.xml")
|
|
1404
|
+
# self.run_xacro(input_path, '-o', output_path)
|
|
1405
|
+
# self.assertTrue(os.path.isfile(output_path))
|
|
1406
|
+
# self.assert_matches(xml.dom.minidom.parse(output_path), '''<robot>🍔</robot>''') # noqa
|
|
1407
|
+
# shutil.rmtree(tmp_dir_name) # clean up after ourselves
|
|
1408
|
+
|
|
1409
|
+
def test_invalid_syntax(self):
|
|
1410
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, "<a>a${</a>")
|
|
1411
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, "<a>${b</a>")
|
|
1412
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, "<a>${{}}</a>")
|
|
1413
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, "<a>a$(</a>")
|
|
1414
|
+
self.assertRaises(xacro.XacroException, self.quick_xacro, "<a>$(b</a>")
|
|
1415
|
+
|
|
1416
|
+
|
|
1417
|
+
if __name__ == "__main__": # pragma nocover
|
|
1418
|
+
unittest.main()
|