对于给定的节点,我有一个6自由度机械手的给定路径。路径(dof,纽结)
path_f=[-0.5131 -0.6587 -1.0058 -1.4202 -1.7674 -1.9130
-0.8696 -0.6711 -0.1980 0.3667 0.8399 1.0383
-0.8961 -0.7433 -0.3789 0.0560 0.4205 0.5733
1.1714 0.9639 0.4691 -0.1215 -0.6163 -0.8238
-3.1000 -2.5800 -1.3400 0.1400 1.3800 1.9000
-1.1514 -0.9439 -0.4491 0.1415 0.6363 0.8438]我在每个关节之间生成三次样条,每个时间间隔被定义为h(i),我试图找到最小h值,即h(1)+h(2)+h(3)+h(4)+h(5)。
为了解决这个问题,我写了一个代码:
options=optimset('Algorithm','sqp','Display','iter','DiffMinChange',1e-16,'DiffMaxChange',1e-4,'TolFun',1e-14,'TolX',1e-20,'MaxFunEvals',60000,'MaxIter',1000);
h0=[0.001; 0.001; 0.001; 0.001; 0.001]
h=fmincon(@(h)objecfun(h,path), h0, [], [], [], [], [0; 0; 0; 0; 0] , [], @(h) nonlconstraint(h,Robot,path_f,dof), options); 当我运行代码时,它说:
解决者过早地停止了。fmincon停止,因为它超过了迭代限制,options.MaxIter = 1000 (选定的值)。
在第5次迭代之后,f(x)值不变,结果如下:
Norm of First-order
Iter F-count f(x) Feasibility Steplength step optimality
0 6 2.500000e-01 2.001e+01 1.000e+00
1 12 3.903637e-01 8.013e+00 1.000e+00 6.374e-02 6.077e-01
2 18 5.115308e-01 2.485e+00 1.000e+00 5.914e-02 3.255e-01
3 24 5.519283e-01 4.258e-01 1.000e+00 2.941e-02 1.712e-01
4 30 5.528961e-01 1.288e-02 1.000e+00 5.382e-03 3.098e-02
5 36 5.530002e-01 4.399e-06 1.000e+00 2.153e-04 2.442e-02
6 42 5.530000e-01 3.403e-12 1.000e+00 1.305e-07 1.828e-06
7 48 5.530000e-01 8.704e-14 1.000e+00 1.050e-13 3.103e-07
8 54 5.530000e-01 8.349e-14 1.000e+00 3.211e-15 1.465e-07
9 65 5.530000e-01 6.573e-14 1.681e-01 2.713e-16 1.319e-07
10 72 5.530000e-01 3.020e-14 7.000e-01 9.286e-16 3.740e-08我不知道这背后的原因。你能帮帮我吗?
发布于 2015-07-30 12:13:38
你的f(x)可能正在改变,但你在这个分辨率中看不到它。看看你的步幅有多大。尝试扩展您的问题,或者(如果您的情况合理的话)增加DiffMinChange。
https://stackoverflow.com/questions/31722831
复制相似问题