how to export this type of vector locally, so i can call this vector as when i want, please tell me asap.
thank YOU.
If you mean saving to file, JLD2 should be able to do it. Or just the Julia Serializer
You probably don’t really want to use this type of vector though; it will be very slow.
Please don’t post images of code. Instead, copy and paste code as text, using triple backticks for formatting: Please read: make it easier to help you
I have to store a 4x4 matrix with corresponding 1x6 matrix and also a 1x1 element. and there are n element for a iteration and then in second iteration another 4x4 and 1x6 and 1x1 matrix , m sets.
so is there any efficient to store this.
thank you
This description is difficult to follow. Can’t you just copy and paste the text into your post instead?
If there is some power left in the star, could you cook some data example?
m = 6
data = Vector{Tuple{Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}}(undef,m)
for i in 1:m
data[i] = (rand(4,4), rand(1,6), rand(1,1))
end
It looks to me like it’s not a 1x1 matrix in there, but a regular scalar Float64
.
Where is “there”?
In the data, if you look at the printout, it seems like a Vector{Tuple{Matrix{Float64}, Float64, Matrix{Float64}}}
Or, maybe even a Vector{NTuple{?, Tuple{Matrix{Float64}, Float64, Matrix{Float64}}}}
, or something like that.
There is also “there”:
Yes, I think this description is wrong, because many people think a scalar is a 1x1 matrix.
Thus the whole point of providing a data example / MWE…
I converted the output in numpy array. i can’t post the output in above format because i cleared the cell output and for getting that i have to run the code for 3-4 hour.
6-element Vector{PyObject}:
PyObject ((array([[ 0.87215598, 0.16800895, 0.45991623, 0.25619071],
[-0.24644018, 0.96164168, 0.11793858, 1.02285986],
[-0.42303138, -0.21652808, 0.88012331, 0.00454955],
[ 0. , 0. , 0. , 1. ]]), 0.16358848772504414, array([[ 0. , 154.28571429, 12.85714286, 18.94736842,
113.68421053, 255. ]])), (array([[ 0.69464543, -0.36295442, -0.62139988, 1.63969446],
[ 0.09882529, 0.90264833, -0.41815853, 1.05226796],
[ 0.71251626, 0.22918143, 0.66351598, 0.00378875],
[ 0. , 0. , 0. , 1. ]]), 0.0448310935542113, array([[ 51.42857143, 128.57142857, 102.85714286, 104.21052632,
156.31578947, 330. ]])), (array([[ 0.7226713 , -0.34572214, -0.59885591, 1.71371418],
[ 0.15319068, 0.92383934, -0.34992927, 1.13174214],
[ 0.67402608, 0.16122903, 0.72121498, 0.0019016 ],
[ 0. , 0. , 0. , 1. ]]), 0.059379793036915166, array([[ 77.14285714, 154.28571429, 102.85714286, 28.42105263,
42.63157895, 135. ]])), (array([[ 0.99879064, 0.02455709, 0.04711907, 1.31948778],
[-0.02493593, 0.99903846, 0.0264076 , 0.74342861],
[-0.04698021, -0.02774248, 0.99873931, 0.00295867],
[ 0. , 0. , 0. , 1. ]]), 0.013052958469056573, array([[128.57142857, 115.71428571, 128.57142857, 47.36842105,
142.10526316, 60. ]])), (array([[ 9.51466654e-01, -1.23748339e-01, -2.82495229e-01,
1.60895782e+00],
[ 8.68040059e-02, 9.85674830e-01, -1.42503312e-01,
8.86856006e-01],
[ 2.95646985e-01, 1.11001989e-01, 9.49067131e-01,
7.83312505e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.024261659824236566, array([[128.57142857, 128.57142857, 115.71428571, 47.36842105,
142.10526316, 135. ]])), (array([[ 6.37202287e-01, -4.08987807e-01, -6.53535171e-01,
2.11708154e+00],
[ 1.23983825e-01, 8.90253485e-01, -4.37577128e-01,
1.35747996e+00],
[ 7.60656643e-01, 1.97933842e-01, 6.18611886e-01,
3.13678401e-05],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.03591254132920171, array([[128.57142857, 180. , 51.42857143, 104.21052632,
142.10526316, 15. ]])), (array([[ 0.99918397, -0.03815879, -0.02411001, 0.91280724],
[ 0.03928168, 0.99886726, 0.01086945, 0.63901858],
[ 0.02312483, -0.01196018, 0.99988959, 0.00204719],
[ 0. , 0. , 0. , 1. ]]), 0.09419470513399804, array([[154.28571429, 25.71428571, 180. , 37.89473684,
241.57894737, 150. ]])), (array([[ 0.94652163, 0.06422702, 0.3168244 , 1.51614997],
[-0.11324319, 0.98309342, 0.14177559, 0.81270454],
[-0.30295743, -0.17032928, 0.93790284, 0.00312568],
[ 0. , 0. , 0. , 1. ]]), 0.07506263774770203, array([[154.28571429, 102.85714286, 77.14285714, 151.57894737,
241.57894737, 75. ]])), (array([[ 0.94492167, 0.06364721, 0.32168009, 1.29572614],
[-0.11395676, 0.98283482, 0.14299151, 0.75250144],
[-0.3076532 , -0.172031 , 0.93606188, 0.00186139],
[ 0. , 0. , 0. , 1. ]]), 0.0342020858817436, array([[154.28571429, 102.85714286, 102.85714286, 37.89473684,
241.57894737, 75. ]])), (array([[ 0.91920192, -0.18736404, -0.34694171, 1.88326784],
[ 0.13757165, 0.97629759, -0.16526967, 1.13572785],
[ 0.369281 , 0.1041574 , 0.92370979, 0.00395556],
[ 0. , 0. , 0. , 1. ]]), 0.08634162407695677, array([[154.28571429, 141.42857143, 64.28571429, 37.89473684,
241.57894737, 225. ]])), (array([[ 4.72876120e-01, 8.57689251e-02, 8.77176075e-01,
1.92545675e-01],
[-5.43497540e-01, 8.11123333e-01, 2.14677346e-01,
4.53291572e-01],
[-6.93477570e-01, -5.78632424e-01, 4.29802721e-01,
1.38099167e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.020446832487348198, array([[154.28571429, 180. , 38.57142857, 18.94736842,
241.57894737, 120. ]])), (array([[ 0.44749704, 0.04611948, 0.89332267, 1.28691873],
[-0.50151372, 0.83919686, 0.20887702, 0.90846486],
[-0.74044118, -0.54183015, 0.39827621, 0.00373423],
[ 0. , 0. , 0. , 1. ]]), 0.15587273280143485, array([[180. , 90. , 38.57142857, 151.57894737,
184.73684211, 150. ]])), (array([[ 0.88549079, 0.11953331, 0.44947064, 0.96174253],
[-0.20079395, 0.96930467, 0.13973993, 0.65112677],
[-0.41955577, -0.21428898, 0.88233224, 0.00294597],
[ 0. , 0. , 0. , 1. ]]), 0.01271948183817658, array([[180. , 167.14285714, 128.57142857, 47.36842105,
184.73684211, 30. ]])), (array([[-0.148146 , -0.0844844 , 0.98555626, 0.7679319 ],
[-0.73676182, 0.67369379, -0.0521124 , 0.45044867],
[-0.65957069, -0.73414896, -0.16263089, 0.00460119],
[ 0. , 0. , 0. , 1. ]]), 0.10497938690259118, array([[282.85714286, 0. , 25.71428571, 75.78947368,
213.15789474, 165. ]])), (array([[ 9.96092541e-01, 6.44218369e-05, -9.05850159e-02,
1.33967693e+00],
[-1.64739386e-03, 9.99331590e-01, -2.70307173e-02,
1.03222899e+00],
[ 9.00101359e-02, 2.69136388e-02, 9.95806624e-01,
3.81884132e-03],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.017090233063511172, array([[282.85714286, 0. , 167.14285714, 28.42105263,
213.15789474, 270. ]])), (array([[ 0.80365435, 0.1563888 , 0.57453306, 1.7115821 ],
[-0.32090765, 0.92577015, 0.19840589, 0.77258644],
[-0.50140431, -0.34417657, 0.79409899, 0.00243759],
[ 0. , 0. , 0. , 1. ]]), 0.11221389319073302, array([[282.85714286, 12.85714286, 0. , 94.73684211,
213.15789474, 120. ]])), (array([[ 0.67914179, 0.14215728, 0.72039138, 1.60099328],
[-0.35476829, 0.92189995, 0.15374307, 0.77997084],
[-0.64279303, -0.36033701, 0.67633672, 0.00274123],
[ 0. , 0. , 0. , 1. ]]), 0.1057851497934145, array([[282.85714286, 12.85714286, 12.85714286, 75.78947368,
213.15789474, 120. ]])), (array([[ 0.37927792, 0.10478851, 0.91955077, 1.39129912],
[-0.53547814, 0.83462997, 0.12670035, 0.66942 ],
[-0.75457052, -0.54082955, 0.37226836, 0.00321633],
[ 0. , 0. , 0. , 1. ]]), 0.10687051640997026, array([[282.85714286, 12.85714286, 25.71428571, 18.94736842,
213.15789474, 45. ]])), (array([[ 0.10368061, -0.70039023, -0.70647707, 1.12662444],
[-0.01479131, 0.70816306, -0.70546672, 1.02218447],
[ 0.99467453, 0.08388163, 0.06358817, 0.00336678],
[ 0. , 0. , 0. , 1. ]]), 0.1612461561033475, array([[282.85714286, 102.85714286, 38.57142857, 161.05263158,
213.15789474, 105. ]])), (array([[ 0.29114046, -0.62367498, -0.72572223, 1.0138831 ],
[ 0.054934 , 0.76724626, -0.63852363, 0.97093318],
[ 0.95518363, 0.14629057, 0.25822529, 0.00315363],
[ 0. , 0. , 0. , 1. ]]), 0.1612461561033475, array([[282.85714286, 102.85714286, 38.57142857, 161.05263158,
213.15789474, 300. ]])), (array([[ 0.36051627, -0.61574547, -0.70092192, 0.97105429],
[ 0.11621374, 0.77425041, -0.62163307, 0.93407992],
[ 0.92554372, 0.14290279, 0.35128994, 0.00124941],
[ 0. , 0. , 0. , 1. ]]), 0.16263719813560537, array([[282.85714286, 102.85714286, 38.57142857, 180. ,
213.15789474, 300. ]])), (array([[ 0.60176899, -0.45311265, -0.6580038 , 0.99540548],
[ 0.12883043, 0.86708176, -0.48059228, 1.02449382],
[ 0.788214 , 0.20460124, 0.58078742, 0.00469094],
[ 0. , 0. , 0. , 1. ]]), 0.17817211935158672, array([[282.85714286, 102.85714286, 64.28571429, 47.36842105,
213.15789474, 225. ]])), (array([[ 0.66301684, -0.44611215, -0.60149699, 0.94362892],
[ 0.1743844 , 0.87228848, -0.45617966, 0.99313966],
[ 0.72803387, 0.19772278, 0.65675671, 0.00215223],
[ 0. , 0. , 0. , 1. ]]), 0.177864202632311, array([[282.85714286, 102.85714286, 64.28571429, 66.31578947,
213.15789474, 225. ]])), (array([[ 0.95962756, -0.08629508, -0.26846621, 0.54373623],
[ 0.05517706, 0.99039629, -0.12436911, 0.93003506],
[ 0.27617893, 0.10444807, 0.95565307, 0.00438484],
[ 0. , 0. , 0. , 1. ]]), 0.15701881893702857, array([[282.85714286, 128.57142857, 25.71428571, 85.26315789,
213.15789474, 75. ]])), (array([[-1.66750911e-01, -7.84927876e-01, -5.97066464e-01,
1.50219081e+00],
[-1.02697638e-01, 6.15067740e-01, -7.81371788e-01,
1.34602905e+00],
[ 9.80986043e-01, -6.86765583e-02, -1.82775584e-01,
8.30806273e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.14875974842646894, array([[282.85714286, 128.57142857, 25.71428571, 123.15789474,
213.15789474, 180. ]])), (array([[ 9.94554705e-01, -1.11349608e-04, 1.06145778e-01,
3.25871351e-01],
[ 1.46556989e-03, 9.99687395e-01, -4.46814411e-03,
9.16072619e-01],
[-1.06688749e-01, 4.43136972e-03, 9.94512380e-01,
3.64079346e-03],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.12719188889520214, array([[282.85714286, 154.28571429, 0. , 123.15789474,
213.15789474, 270. ]])), (array([[ 0.65646659, 0.14604574, 0.74035685, 0.72892016],
[-0.4275036 , 0.87972237, 0.2067032 , 0.77390287],
[-0.6216087 , -0.45257576, 0.63971463, 0.00300631],
[ 0. , 0. , 0. , 1. ]]), 0.012643033763809519, array([[282.85714286, 180. , 102.85714286, 132.63157895,
213.15789474, 315. ]])), (array([[ 9.93680106e-01, -2.11314481e-04, 1.14042987e-01,
1.19389359e+00],
[ 1.49741301e-03, 9.99691035e-01, -3.54866470e-03,
1.01556036e+00],
[-1.14585765e-01, 3.52875732e-03, 9.93637082e-01,
1.73407576e-03],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.009095348437286764, array([[282.85714286, 180. , 115.71428571, 113.68421053,
213.15789474, 270. ]])), (array([[ 0.97699891, 0.0365217 , 0.21105758, 0.67074775],
[-0.04988181, 0.99648862, 0.06260385, 0.65732949],
[-0.20862182, -0.07190421, 0.97558378, 0.00456595],
[ 0. , 0. , 0. , 1. ]]), 0.0933275021103765, array([[308.57142857, 115.71428571, 90. , 142.10526316,
213.15789474, 30. ]])), (array([[ 0.9565718 , -0.10718279, -0.2718239 , 1.28481079],
[ 0.06746914, 0.98540655, -0.15433356, 0.86468153],
[ 0.28395963, 0.12922496, 0.95032881, 0.00238673],
[ 0. , 0. , 0. , 1. ]]), 0.031000010178708952, array([[334.28571429, 128.57142857, 102.85714286, 113.68421053,
170.52631579, 120. ]])), (array([[ 0.79083918, -0.29527553, -0.53646226, 1.54844635],
[ 0.1155368 , 0.93150485, -0.34401593, 1.02451032],
[ 0.60104321, 0.21015172, 0.77138856, 0.00186479],
[ 0. , 0. , 0. , 1. ]]), 0.038793387087401245, array([[334.28571429, 141.42857143, 90. , 113.68421053,
170.52631579, 195. ]])), (array([[ 6.53691279e-01, -4.04014069e-01, -6.40208047e-01,
1.77627691e+00],
[ 1.10669837e-01, 8.86816483e-01, -4.48001911e-01,
1.28608707e+00],
[ 7.48616434e-01, 2.22145506e-01, 6.25045446e-01,
1.14170655e-03],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.04882258170114917, array([[334.28571429, 167.14285714, 64.28571429, 113.68421053,
170.52631579, 0. ]])), (array([[ 0.54632207, 0.14269268, 0.82557676, 0.32534988],
[-0.49277814, 0.85096518, 0.18006934, 0.7789421 ],
[-0.67727802, -0.50558948, 0.53491192, 0.00311316],
[ 0. , 0. , 0. , 1. ]]), 0.07744475320027942, array([[334.28571429, 180. , 64.28571429, 56.84210526,
170.52631579, 90. ]])))
PyObject ()
PyObject ()
PyObject ((array([[ 0.96501762, 0.14346151, -0.21879852, -1.12433594],
[-0.21565542, 0.90936689, -0.35562001, 0.4686873 ],
[ 0.1483133 , 0.38984922, 0.90858613, 0.00405382],
[ 0. , 0. , 0. , 1. ]]), 0.1162958116148175, array([[ 0. , 154.28571429, 64.28571429, 180. ,
227.36842105, 300. ]])), (array([[ 0.99813819, 0.04069566, -0.04215464, -1.02278425],
[-0.04263765, 0.99779729, -0.05003596, 0.08911549],
[ 0.04030343, 0.05116852, 0.9976299 , 0.00137583],
[ 0. , 0. , 0. , 1. ]]), 0.0440760478454455, array([[ 0. , 167.14285714, 90. , 9.47368421,
227.36842105, 225. ]])), (array([[ 0.97704377, -0.17826045, 0.1154196 , -0.74674729],
[ 0.12407366, 0.91992443, 0.37184105, 0.1429234 ],
[-0.17227265, -0.34954169, 0.9206795 , 0.00264189],
[ 0. , 0. , 0. , 1. ]]), 0.08619848854412032, array([[180. , 141.42857143, 25.71428571, 94.73684211,
85.26315789, 195. ]])), (array([[ 9.79384074e-01, 9.70097175e-02, -1.76377293e-01,
-7.96264693e-01],
[-1.43099513e-01, 9.51514926e-01, -2.72144952e-01,
3.67588382e-01],
[ 1.41749874e-01, 2.91228380e-01, 9.45833497e-01,
7.47779013e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.04806464893000367, array([[231.42857143, 180. , 38.57142857, 170.52631579,
198.94736842, 240. ]])), (array([[ 0.99860117, 0.01633564, -0.04734814, -1.1059916 ],
[-0.01751581, 0.99941703, -0.02792482, 0.05874556],
[ 0.04712737, 0.02813772, 0.9982461 , 0.00327377],
[ 0. , 0. , 0. , 1. ]]), 0.045171300039465956, array([[282.85714286, 167.14285714, 64.28571429, 113.68421053,
99.47368421, 90. ]])), (array([[ 0.97147488, -0.17661445, 0.15734326, -1.43765746],
[ 0.09569227, 0.90146571, 0.42204688, -0.60230815],
[-0.2161721 , -0.39549461, 0.89239097, 0.00283459],
[ 0. , 0. , 0. , 1. ]]), 0.05849975471151693, array([[308.57142857, 167.14285714, 64.28571429, 66.31578947,
113.68421053, 270. ]])), (array([[ 0.88123991, 0.18977522, -0.43256744, -0.81562897],
[-0.44098549, 0.65837937, -0.60990934, 0.71576322],
[ 0.16951867, 0.72785307, 0.66407931, 0.00400913],
[ 0. , 0. , 0. , 1. ]]), 0.06996217960173023, array([[308.57142857, 180. , 25.71428571, 180. ,
113.68421053, 300. ]])), (array([[ 9.46515249e-01, -2.63637949e-01, 1.85248255e-01,
-1.36806856e+00],
[ 1.19568069e-01, 8.20951865e-01, 5.58267420e-01,
-6.57430913e-01],
[-2.99068354e-01, -5.06770599e-01, 8.08238628e-01,
1.20579373e-03],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.02959518655202446, array([[308.57142857, 180. , 64.28571429, 9.47368421,
113.68421053, 0. ]])))
PyObject ()
PyObject ((array([[ 9.90336202e-01, -2.08492632e-02, -1.34143636e-01,
4.83482559e-01],
[ 2.06534451e-02, 9.99423798e-01, 7.12702613e-04,
7.28113445e-01],
[ 1.34359381e-01, -2.78807943e-03, 9.91281385e-01,
5.94072414e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.09949848355634622, array([[ 25.71428571, 154.28571429, 51.42857143, 161.05263158,
213.15789474, 30. ]])), (array([[ 0.86595486, -0.17005055, -0.46946778, 0.91489985],
[ 0.12911254, 0.98429289, -0.11735613, 0.82296117],
[ 0.48280359, 0.04171658, 0.87513394, 0.0033047 ],
[ 0. , 0. , 0. , 1. ]]), 0.09949848355634622, array([[ 25.71428571, 154.28571429, 51.42857143, 161.05263158,
213.15789474, 105. ]])), (array([[ 0.91856826, 0.08724865, 0.38446719, 0.36812927],
[-0.12197169, 0.99000366, 0.06550321, 0.60878192],
[-0.37527817, -0.10648136, 0.92115526, 0.0011632 ],
[ 0. , 0. , 0. , 1. ]]), 0.054227385332361745, array([[102.85714286, 167.14285714, 64.28571429, 123.15789474,
198.94736842, 105. ]])), (array([[ 9.27856970e-01, 1.57669918e-01, 3.36773870e-01,
6.55039945e-01],
[-1.70640673e-01, 9.84936111e-01, 7.59067842e-03,
6.64125369e-01],
[-3.30856223e-01, -6.38742937e-02, 9.41888122e-01,
6.07849498e-04],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
1.00000000e+00]]), 0.05611598709093224, array([[128.57142857, 167.14285714, 38.57142857, 170.52631579,
184.73684211, 315. ]])), (array([[ 0.92187831, 0.16072945, 0.35142769, 0.28163974],
[-0.19212766, 0.97947659, 0.05465875, 0.86684234],
[-0.33580353, -0.1173345 , 0.93496931, 0.00327662],
[ 0. , 0. , 0. , 1. ]]), 0.07116174351337434, array([[334.28571429, 180. , 64.28571429, 66.31578947,
99.47368421, 30. ]])))
using Rotations
using LinearAlgebra
function trans(x)
alpha=x[1]; a=x[2]; d=x[3]; t=x[4]
T=[ cos(t) -sin(t) 0 a;
sin(t)*cos(alpha) cos(t)*cos(alpha) -sin(alpha) -sin(alpha)*d;
sin(t)*sin(alpha) cos(t)*sin(alpha) cos(alpha) cos(alpha)*d;
0 0 0 1 ]
return T
end
function J(t)
t1= t[1] ; t2= t[2];
t3= t[3];
t4= t[4];
t5= t[5];
t6= t[6];
j=zeros(3,6)
j[1,1]= 0.227*sin(t1)*sin(t5)*cos(t2 + t3 + t4) - 0.095*sin(t1)*sin(t2 + t3 + t4) + 0.425*sin(t1)*cos(t2) + 0.392*sin(t1)*cos(t2 + t3) + 0.227*cos(t1)*cos(t5) + 0.109*cos(t1)
j[1,2]= 0.425*sin(t2)*cos(t1) + 0.227*sin(t5)*sin(t2 + t3 + t4)*cos(t1) + 0.392*sin(t2 + t3)*cos(t1) + 0.095*cos(t1)*cos(t2 + t3 + t4)
j[1,3]= 0.227*sin(t5)*sin(t2 + t3 + t4)*cos(t1) + 0.392*sin(t2 + t3)*cos(t1) + 0.095*cos(t1)*cos(t2 + t3 + t4)
j[1,4]= 0.227*sin(t5)*sin(t2 + t3 + t4)*cos(t1) + 0.095*cos(t1)*cos(t2 + t3 + t4)
j[1,5]= -0.227*sin(t1)*sin(t5) - 0.227*cos(t1)*cos(t5)*cos(t2 + t3 + t4)
j[1,6]= 0
j[2,1]= 0.227*sin(t1)*cos(t5) + 0.109*sin(t1) - 0.227*sin(t5)*cos(t1)*cos(t2 + t3 + t4) + 0.095*sin(t2 + t3 + t4)*cos(t1) - 0.425*cos(t1)*cos(t2) - 0.392*cos(t1)*cos(t2 + t3)
j[2,2]= 0.425*sin(t1)*sin(t2) + 0.227*sin(t1)*sin(t5)*sin(t2 + t3 + t4) + 0.392*sin(t1)*sin(t2 + t3) + 0.095*sin(t1)*cos(t2 + t3 + t4)
j[2,3]= 0.227*sin(t1)*sin(t5)*sin(t2 + t3 + t4) + 0.392*sin(t1)*sin(t2 + t3) + 0.095*sin(t1)*cos(t2 + t3 + t4)
j[2,4]= 0.227*sin(t1)*sin(t5)*sin(t2 + t3 + t4) + 0.095*sin(t1)*cos(t2 + t3 + t4)
j[2,5]= -0.227*sin(t1)*cos(t5)*cos(t2 + t3 + t4) + 0.227*sin(t5)*cos(t1)
j[2,6]= 0
j[3,1]= 0
j[3,2]= -0.227*sin(t5)*cos(t2 + t3 + t4) + 0.095*sin(t2 + t3 + t4) - 0.425*cos(t2) - 0.392*cos(t2 + t3)
j[3,3]= -0.227*sin(t5)*cos(t2 + t3 + t4) + 0.095*sin(t2 + t3 + t4) - 0.392*cos(t2 + t3)
j[3,4]= -0.227*sin(t5)*cos(t2 + t3 + t4) + 0.095*sin(t2 + t3 + t4)
j[3,5]= -0.227*sin(t2 + t3 + t4)*cos(t5)
j[3,6]= 0
return j
end
function CMP(e)
pos=[]
for i in range(1,size(e)[1])
te=e[i,1:3]; eff_ang=e[i,4:6]';
re = round.(RotXYZ(eff_ang[1],eff_ang[2],eff_ang[3]),digits=3);
Xwe=(vcat(hcat(re,te),[0 0 0 1]));
function CM(t)
t1= t[1] ; t2= t[2];
t3= t[3];
t4= t[4];
t5= t[5];
t6= t[6];
Xbe= Matrix(I,4,4) # e's coordinate in b's frame
a2=-.425 ; d3=-.120 ; a3=-0.392; d4=0.093; # all are in mm
dh=[0 -.1395 .482 t1;
pi/2 0 0.136 t2;
0 a2 d3 t3;
0 a3 d4 t4;
pi/2 0 .095 t5;
-pi/2 0 .227 t6;]
for i in 1:(size(dh)[1])
# display(trans(dh[i,:]))
Xbe= Xbe*trans(dh[i,:])
end
return Xwe*inv(Xbe), Xbe[1:3,1:3] ;
end
T=[]
for t1 in range(0,360,15)
for t2 in range(0,180,15)
for t3 in range(0,180,15)
for t4 in range(0,180,15)
for t5 in range(0,360,15)
for t6 in range(0,360,15)
t=[t1 t2 t3 t4 t5 t6];
p= CM(t);
c=Rotations.params(RotXYZ(p[2]))[1:2,1];
for i in range(1,2)
if c[i]<0
c[i]=2*pi+c[i];
end
end
if 0<abs(c[1]-eff_ang[1])<0.05 && 0<abs(c[2]-eff_ang[2])<0.05 && 0<=p[1][15]< 0.0025
l=J(t);
u=sqrt(abs(det(l*l')));
v=(p[1],u,t);
T=vcat(T,v);
end
end
end
end
end
end
end
pos=vcat(pos,Tuple(T));
end
return pos
end
res=CMP([0.75 0.1 0.72 .3 pi/8 pi/9])