-
Notifications
You must be signed in to change notification settings - Fork 11
/
test2.m
39 lines (30 loc) · 1.22 KB
/
test2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Differences from test.m
% 1. boarder gap between points
% 2. make start faster, see `qs = Ts2q(myRobot, q0, 2, Ts, conInfo, true);` for details
clc
clear
tic
%% add pth
addpath . ./utils/ ./pose/ ./traj/ ./collision_detection/
%% read target model, stl
% [v, f, n] = readStlModel("/Users/junr/Documents/Works/graduation-project/code/planning/123.stl");
stlPath = "/Users/junr/Documents/Works/graduation-project/code/face_traj/gongjian.stl";
[v, f, n] = readStlModel(stlPath);
%% clusters
clusters = divideIntoFaces(v, f ,n);
%% get path and normal vectors
[pointsPath, pointsPathIdx, clustersIdx] = generatePathFromClusters(clusters, v, f, n, 2, 0);
normalVecs = n(pointsPathIdx, :);
normalVecsM = modifyNormalVec(normalVecs);
%% after modify normal vectors, all the normal vectors points to inside
% and closer to z-
% so we will use normalVecs as original vectors, which points to outside.
%% connect different clusters
[Ts, conInfo] = connectPaths(pointsPath, normalVecsM, clustersIdx);
%% get arm robot model and do inverse mech
[myRobot, q0, speed_limit, qlimit] = getRobotModel();
qs = Ts2q(myRobot, q0, 2, Ts, conInfo, true);
array2txt(qs, '2018-5-17_t1');
% myRobot.plot(qs(:, 1:6))
toc
% disp(['Running time: ',num2str(toc)]);