# 取得allocation matrix ![](https://hackmd.io/_uploads/B13TaS4T3.png) 首先,決定力與力矩的方向,利用物理可推出馬達(8個參數)轉換成力與力矩方向的參數(6個參數): ![image](https://hackmd.io/_uploads/HkTevQeBa.png) ![](https://hackmd.io/_uploads/Syc_vHN62.png) 推得的**matrix A**: ![](https://hackmd.io/_uploads/ByuwKS46n.png) 接下來,這裡是使用matlab內建的函式計算理論上的廣義反矩陣,以下為matlab code和廣義反矩陣: ``` A = [ 0, 0, 0, 0, 1 / sqrt(2), 1 / sqrt(2), 1 / sqrt(2), 1 / sqrt(2); 0, 0, 0, 0, 1 / sqrt(2), -1 / sqrt(2), -1 / sqrt(2), 1 / sqrt(2); 1, 1, 1, 1, 0, 0, 0, 0; -0.207, 0.207, -0.207, 0.207, 0.005 * sqrt(2), -0.005 * sqrt(2), -0.005 * sqrt(2), 0.005 * sqrt(2); -0.120, -0.120, 0.120, 0.120, -0.005 * sqrt(2), -0.005 * sqrt(2), -0.005 * sqrt(2), -0.005 * sqrt(2); 0, 0, 0, 0, -0.325412046, -0.325412046, 0.325412046, -0.325412046 ]; % 假設 A 是一個 6x8 的矩陣 %A = rand(6, 8); % 生成一個隨機的 6x8 矩陣 % 使用 pinv 函數計算廣義反矩陣 A_plus = pinv(A); B = A_plus * A; % 輸出結果 disp('原始矩陣 A:'); disp(A); disp('廣義反矩陣 A^+:'); disp(A_plus); disp('相乘') disp(B); ``` ![](https://hackmd.io/_uploads/HyE4srEan.png) (注意,此時的反矩陣還不是最後結果!) 最後步驟,參照上一版AUV的反矩陣資料,還要在數字分配上進行調整(ex:上圖位置1-6和位置1-7的數值由0.7071分配為0.3536),並且考慮到力與力矩各個方向後,得出**反矩陣matrix A_plus**: ![](https://hackmd.io/_uploads/BydLFHEpn.png) --- # 規格更新(-2023/12/17): ![image](https://hackmd.io/_uploads/HyMBoU3L6.png) ![image](https://hackmd.io/_uploads/BkpBiI28a.png) **注意: 機器重心會比馬達高45mm** 新matrix A: ```=matlab A = [ 0, 0, 0, 0, 1 / sqrt(2), 1 / sqrt(2), 1 / sqrt(2), 1 / sqrt(2); 0, 0, 0, 0, 1 / sqrt(2), -1 / sqrt(2), -1 / sqrt(2), 1 / sqrt(2); 1, 1, 1, 1, 0, 0, 0, 0; -0.237, 0.237, -0.237, 0.237, -0.045/sqrt(2), 0.045/sqrt(2), 0.045/sqrt(2), -0.045/sqrt(2); -0.150, -0.150, 0.150, 0.150, 0.045/sqrt(2), 0.045/sqrt(2), 0.045/sqrt(2), 0.045/sqrt(2); 0, 0, 0, 0, 0.213/sqrt(2) + 0.29651/sqrt(2) , -0.213/sqrt(2) - 0.29651/sqrt(2), 0.213/sqrt(2) + 0.29651/sqrt(2), -0.213/sqrt(2) - 0.29651/sqrt(2) ]; ``` 新反矩陣: ![image](https://hackmd.io/_uploads/H1e2v0I3Ia.png)