From 82ea021a249356412d48ec104c9af388a08b82ed Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Wed, 19 Jun 2019 13:15:17 -0700 Subject: [PATCH 01/10] Switched to finding the optimal front wheel inertia and restricting to physically realizable wheels. --- objective.m | 52 ++++++++++++++++++++++++++++++++++++++++++----- optimal_bicycle.m | 18 ++++++++++++---- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/objective.m b/objective.m index fb101f8..732769d 100644 --- a/objective.m +++ b/objective.m @@ -1,21 +1,58 @@ function [peak_hqm] = objective(unknowns) +% OBJECTIVE - Returns the maximum value of the HQM transfer function +% magnitude if the system is closed loop stable or a large value based on +% how large the closed loop poles are if the system is closed loop unstable. +% +% Syntax: peak_hqm = objective(unknowns) +% +% Inputs: +% unknowns - Vector of the optimization parameters (c trail, w wheelbase, +% lam steer axis tilt, IFyy front wheel rotational inertia), +% size 4x1. +% Outputs: +% peak_hqm - Maximum scalar value of the HQM magnitude. + +% NOTE : This value has to be manually set to be the target speed for the +% optimal design. +% TODO : Move setting this into "optimal_bicycle.m". +speed = 5.0; display('==========================================') +display('Values passed into the objective function:') unknowns freqs = linspace(0.01, 40, 200); +% NOTE : This has to be manually set and match that in "optimal_bicycle.m". par = par_text_to_struct('parameters/BenchmarkPar.txt'); +% NOTE : Here to try for fun to see if different bicycle designs are needed +% for riding in low gravity. %par.g = 1.6; % acceleration due to gravity on the moon %par.g = 3.71; % acceleration due to gravity on mars -par.c = unknowns(1); -par.w = unknowns(2); -par.lam = unknowns(3); -par.rF = unknowns(4); -speed = 5.0; +par.c = unknowns(1); % trail +par.w = unknowns(2); % wheelbase +par.lam = unknowns(3); % steer axis tilt + +% Given an existing wheel with a rotational inertia, mass, and radius that +% approximately adhere to I=m*r^2, make sure that this relationship holds +% for the optimal front wheel inertias and that we only have to add mass to +% the existing wheel while keeping the radius constant or reduce the radius +% while keeping mass constant. These should be physically realizable barring +% that the radius doesn't get too tiny. +IFyy_opt = unknowns(4); + +if IFyy_opt < par.IFyy + % keep the mass the same but reduce the wheel radius + par.rF = sqrt(IFyy_opt ./ par.mF); +else IFyy_opt > par.IFyy + % keep radius of the wheel the same but add mass + par.mF = IFyy_opt / par.rF.^2; +end + +par.IFyy = IFyy_opt; % front wheel rotational inertia [A, B, C, D] = whipple_pull_force_abcd(par, speed); @@ -30,6 +67,10 @@ lateral_dev_loop = minreal(tf(data.closedLoops.Y.num, data.closedLoops.Y.den)); if ~isstable(lateral_dev_loop) + % TODO : It may be best to return NAN here as per the CMAES statement + % "An easy way to implement a hard non-linear constraint is to return + % NaN. Then, this function evaluation is not counted and a newly sampled + % point is tried immediately." peak_hqm = max(10, 100 * max(real(pole(lateral_dev_loop)))); else num = data.handlingMetric.num; @@ -38,4 +79,5 @@ peak_hqm = max(mag); end +display('Value of the objective function:') peak_hqm diff --git a/optimal_bicycle.m b/optimal_bicycle.m index 650a01e..4ed24cd 100644 --- a/optimal_bicycle.m +++ b/optimal_bicycle.m @@ -4,15 +4,25 @@ guess(1) = par.c; guess(2) = par.w; guess(3) = par.lam; -guess(4) = par.rF; +guess(4) = par.IFyy; % wheelbase should always accomdate the mass center min_wheelbase = (par.mH * par.xH + par.mB * par.xB) / (par.mH + par.mB); -opts.LBounds = [-inf; min_wheelbase; -pi/2; 1e-10]; -opts.UBounds = [inf; inf; pi/2; inf]; +opts.LBounds = [-inf; % c + min_wheelbase; % w + -pi/2; % lam + 0.0]; % IFyy -sigma = [0.5; 3.0; 0.3 * pi; 0.2]; +opts.UBounds = [inf; % c + inf; % w + pi/2; % lam + inf]; % IFyy + +sigma = [0.5; + 3.0; + 0.3 * pi; + 0.07]; %sigma = sqrt(var(guess')'); [optimal_par, hqm] = cmaes('objective', guess, sigma, opts); From ebd552338d973de121316f2aa8b27993428e092f Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 17:00:07 -0700 Subject: [PATCH 02/10] Switch to pista at 4 m/s in optimization. --- objective.m | 4 ++-- optimal_bicycle.m | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/objective.m b/objective.m index 732769d..b201398 100644 --- a/objective.m +++ b/objective.m @@ -15,7 +15,7 @@ % NOTE : This value has to be manually set to be the target speed for the % optimal design. % TODO : Move setting this into "optimal_bicycle.m". -speed = 5.0; +speed = 4.0; display('==========================================') @@ -25,7 +25,7 @@ freqs = linspace(0.01, 40, 200); % NOTE : This has to be manually set and match that in "optimal_bicycle.m". -par = par_text_to_struct('parameters/BenchmarkPar.txt'); +par = par_text_to_struct('parameters/PistaPar.txt'); % NOTE : Here to try for fun to see if different bicycle designs are needed % for riding in low gravity. diff --git a/optimal_bicycle.m b/optimal_bicycle.m index 4ed24cd..9cd551e 100644 --- a/optimal_bicycle.m +++ b/optimal_bicycle.m @@ -1,4 +1,4 @@ -par = par_text_to_struct('parameters/BenchmarkPar.txt'); +par = par_text_to_struct('parameters/PistaPar.txt'); guess = zeros(4, 1); guess(1) = par.c; From 44f5944d39e34bccb22bc85892cbc8d2607105e7 Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 17:00:36 -0700 Subject: [PATCH 03/10] Added all the optimal bikes from the BMD 2016 work. --- gains/FalkorheadonbenchmarkSteerGains.txt | 14 +++++++ gains/Optimal02SteerGains.txt | 31 +++++++++++++++ gains/Optimal04SteerGains.txt | 27 +++++++++++++ gains/Optimal05SteerGains.txt | 27 +++++++++++++ gains/Optimal06SteerGains.txt | 22 +++++++++++ gains/Optimal08SteerGains.txt | 22 +++++++++++ gains/Optimal10SteerGains.txt | 48 +++++++++++++++++++++++ gains/Optimalmars05SteerGains.txt | 13 ++++++ parameters/FalkorheadonbenchmarkPar.txt | 26 ++++++++++++ parameters/Optimal02Par.txt | 26 ++++++++++++ parameters/Optimal04Par.txt | 26 ++++++++++++ parameters/Optimal05Par.txt | 26 ++++++++++++ parameters/Optimal06Par.txt | 26 ++++++++++++ parameters/Optimal08Par.txt | 26 ++++++++++++ parameters/Optimal10Par.txt | 26 ++++++++++++ parameters/Optimalmars05Par.txt | 26 ++++++++++++ parameters/README.rst | 21 ++++++++++ 17 files changed, 433 insertions(+) create mode 100644 gains/FalkorheadonbenchmarkSteerGains.txt create mode 100644 gains/Optimal02SteerGains.txt create mode 100644 gains/Optimal04SteerGains.txt create mode 100644 gains/Optimal05SteerGains.txt create mode 100644 gains/Optimal06SteerGains.txt create mode 100644 gains/Optimal08SteerGains.txt create mode 100644 gains/Optimal10SteerGains.txt create mode 100644 gains/Optimalmars05SteerGains.txt create mode 100644 parameters/FalkorheadonbenchmarkPar.txt create mode 100644 parameters/Optimal02Par.txt create mode 100644 parameters/Optimal04Par.txt create mode 100644 parameters/Optimal05Par.txt create mode 100644 parameters/Optimal06Par.txt create mode 100644 parameters/Optimal08Par.txt create mode 100644 parameters/Optimal10Par.txt create mode 100644 parameters/Optimalmars05Par.txt diff --git a/gains/FalkorheadonbenchmarkSteerGains.txt b/gains/FalkorheadonbenchmarkSteerGains.txt new file mode 100644 index 0000000..acd1e67 --- /dev/null +++ b/gains/FalkorheadonbenchmarkSteerGains.txt @@ -0,0 +1,14 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.500,144.1752,-0.0689,16.1935,0.0759,0.1376 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +5.000,215.5129,-0.0382,15.0117,0.1157,0.1014 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal02SteerGains.txt b/gains/Optimal02SteerGains.txt new file mode 100644 index 0000000..2f07e2d --- /dev/null +++ b/gains/Optimal02SteerGains.txt @@ -0,0 +1,31 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,311.5004,-0.2918,3.8696,0.1129,0.1715 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.105,821.4058,-0.0270,12.0137,0.1165,0.1156 +4.474,905.2327,-0.0224,12.2133,0.1273,0.1077 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +4.842,989.1959,-0.0191,12.2579,0.1390,0.1006 +5.000,-0.6068,3.0111,17.2088,0.1442,0.0989 +5.211,1073.2493,-0.0167,12.2016,0.1516,0.0942 +5.500,1139.3338,-0.0152,12.1099,0.1620,0.0896 +5.579,1157.3617,-0.0148,12.0795,0.1649,0.0884 +5.947,1241.5124,-0.0133,11.9152,0.1791,0.0832 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +6.316,1325.6887,-0.0121,11.7249,0.1941,0.0785 +6.684,1409.8832,-0.0110,11.5197,0.2099,0.0742 +7.000,1482.0620,-0.0103,11.3381,0.2242,0.0709 +7.053,1494.0929,-0.0102,11.3076,0.2266,0.0703 +7.421,1578.3175,-0.0095,11.0943,0.2443,0.0668 +7.789,1662.5592,-0.0089,10.8838,0.2628,0.0636 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.158,1746.8217,-0.0083,10.6789,0.2824,0.0606 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +8.526,1831.1097,-0.0078,10.4815,0.3029,0.0579 +8.895,1915.4290,-0.0074,10.2931,0.3245,0.0554 +9.263,1999.7856,-0.0071,10.1144,0.3470,0.0531 +9.632,2084.1863,-0.0067,9.9459,0.3706,0.0509 +10.000,2168.6381,-0.0064,9.7879,0.3953,0.0490 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal04SteerGains.txt b/gains/Optimal04SteerGains.txt new file mode 100644 index 0000000..4f3eec1 --- /dev/null +++ b/gains/Optimal04SteerGains.txt @@ -0,0 +1,27 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.105,-0.3749,1.8823,19.3699,0.0982,0.1242 +4.474,-0.6225,1.0383,18.7669,0.1178,0.1120 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +4.842,-1.0854,0.5445,18.3366,0.1417,0.1018 +5.000,-0.6068,3.0111,17.2088,0.1442,0.0989 +5.211,0.0001,-6446.9872,14.7763,0.1708,0.0931 +5.579,-2.8913,0.1680,18.0114,0.2069,0.0859 +5.947,-4.5572,0.0942,18.1838,0.2534,0.0798 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +6.316,0.0001,-4469.2803,18.2847,0.2592,0.0758 +6.684,0.0002,-2490.2489,17.6984,0.2973,0.0713 +7.053,0.0003,-1628.3005,17.1108,0.3377,0.0675 +7.421,0.0002,-2969.8471,18.6536,0.3751,0.0641 +7.789,0.0001,-7196.3209,21.8977,0.4113,0.0612 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.158,0.0000,-11662.4844,25.6245,0.4492,0.0585 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +8.526,0.0000,-65884.1947,57.7695,0.4766,0.0561 +8.895,0.0000,-25500.0050,40.5162,0.5256,0.0538 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal05SteerGains.txt b/gains/Optimal05SteerGains.txt new file mode 100644 index 0000000..4f3eec1 --- /dev/null +++ b/gains/Optimal05SteerGains.txt @@ -0,0 +1,27 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.105,-0.3749,1.8823,19.3699,0.0982,0.1242 +4.474,-0.6225,1.0383,18.7669,0.1178,0.1120 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +4.842,-1.0854,0.5445,18.3366,0.1417,0.1018 +5.000,-0.6068,3.0111,17.2088,0.1442,0.0989 +5.211,0.0001,-6446.9872,14.7763,0.1708,0.0931 +5.579,-2.8913,0.1680,18.0114,0.2069,0.0859 +5.947,-4.5572,0.0942,18.1838,0.2534,0.0798 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +6.316,0.0001,-4469.2803,18.2847,0.2592,0.0758 +6.684,0.0002,-2490.2489,17.6984,0.2973,0.0713 +7.053,0.0003,-1628.3005,17.1108,0.3377,0.0675 +7.421,0.0002,-2969.8471,18.6536,0.3751,0.0641 +7.789,0.0001,-7196.3209,21.8977,0.4113,0.0612 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.158,0.0000,-11662.4844,25.6245,0.4492,0.0585 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +8.526,0.0000,-65884.1947,57.7695,0.4766,0.0561 +8.895,0.0000,-25500.0050,40.5162,0.5256,0.0538 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal06SteerGains.txt b/gains/Optimal06SteerGains.txt new file mode 100644 index 0000000..d0e9027 --- /dev/null +++ b/gains/Optimal06SteerGains.txt @@ -0,0 +1,22 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.000,-8.2363,0.0557,92.7496,0.3642,0.1616 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.368,-13.1052,0.2174,18.6312,0.4135,0.1450 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +3.737,-11.7081,0.2788,18.6241,0.4389,0.1306 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.105,-10.8632,0.2971,20.8508,0.4708,0.1190 +4.474,-10.9320,0.3012,22.3764,0.5072,0.1094 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +4.842,-11.4335,0.3000,23.3435,0.5455,0.1012 +5.000,-0.6068,3.0111,17.2088,0.1442,0.0989 +5.211,-12.2945,0.2963,23.7511,0.5850,0.0942 +5.579,-13.5338,0.2913,23.6074,0.6253,0.0881 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +7.053,-23.7843,0.2683,19.0172,0.7918,0.0701 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal08SteerGains.txt b/gains/Optimal08SteerGains.txt new file mode 100644 index 0000000..37af02a --- /dev/null +++ b/gains/Optimal08SteerGains.txt @@ -0,0 +1,22 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +3.737,1.3987,-0.4997,43.6541,0.3797,0.1285 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +5.000,-0.6068,3.0111,17.2088,0.1442,0.0989 +5.211,-14.8123,0.0352,79.7172,0.5848,0.0946 +5.579,-20.4195,0.1454,16.6546,0.6294,0.0886 +5.947,-22.8666,0.1739,13.7752,0.6642,0.0831 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +6.316,-17.4130,0.2041,16.2553,0.6805,0.0781 +6.684,-15.9894,0.2170,17.6029,0.7102,0.0737 +7.053,-15.4422,0.2245,18.5890,0.7433,0.0699 +7.421,-15.3563,0.2287,19.3058,0.7782,0.0665 +7.789,-15.5941,0.2309,19.7807,0.8143,0.0633 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimal10SteerGains.txt b/gains/Optimal10SteerGains.txt new file mode 100644 index 0000000..8e28b24 --- /dev/null +++ b/gains/Optimal10SteerGains.txt @@ -0,0 +1,48 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,4.1135,-0.2302,24.5118,0.0352,0.2440 +2.421,5.4851,-0.1598,22.6481,0.0479,0.2072 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +2.842,6.7233,-0.1219,21.0287,0.0624,0.1776 +3.000,7.1503,-0.1120,20.4874,0.0683,0.1681 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.263,7.8139,-0.0988,19.6629,0.0791,0.1541 +3.368,8.0620,-0.0944,19.3593,0.0837,0.1489 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +3.684,8.7442,-0.0836,18.5344,0.0989,0.1352 +3.737,8.8486,-0.0821,18.4090,0.1016,0.1331 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.105,9.5015,-0.0731,17.6231,0.1223,0.1200 +4.474,10.0117,-0.0665,16.9905,0.1464,0.1091 +4.526,10.0723,-0.0657,16.9121,0.1501,0.1077 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +4.842,10.3692,-0.0616,16.5024,0.1742,0.1000 +4.947,10.4417,-0.0605,16.3885,0.1829,0.0976 +5.000,10.4728,-0.0599,16.3357,0.1874,0.0965 +5.211,10.5622,-0.0581,16.1523,0.2062,0.0923 +5.368,10.5911,-0.0570,16.0434,0.2212,0.0894 +5.579,10.5762,-0.0558,15.9360,0.2425,0.0858 +5.789,10.4968,-0.0549,15.8715,0.2653,0.0825 +5.947,10.3922,-0.0545,15.8510,0.2833,0.0802 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +6.211,10.1251,-0.0544,15.8701,0.3152,0.0767 +6.316,9.9833,-0.0546,15.8964,0.3287,0.0754 +6.632,9.4234,-0.0558,16.0404,0.3712,0.0719 +6.684,9.3084,-0.0562,16.0740,0.3786,0.0713 +7.053,8.2938,-0.0603,16.3909,0.4335,0.0677 +7.421,6.7729,-0.0703,16.8704,0.4945,0.0645 +7.474,6.4920,-0.0727,16.9557,0.5039,0.0641 +7.789,4.0156,-0.1102,17.6338,0.5687,0.0617 +7.895,1.9012,-0.2211,18.0799,0.6046,0.0611 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.158,1.8414,-0.2339,18.1218,0.6374,0.0592 +8.316,1.7510,-0.2486,18.2096,0.6574,0.0582 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +8.526,1.6999,-0.2635,18.0954,0.6834,0.0568 +8.737,1.5396,-0.3009,17.8906,0.7103,0.0555 +8.895,1.4174,-0.3335,17.8153,0.7303,0.0546 +9.158,0.0001,-1969.1882,50.0027,0.7593,0.0531 +9.263,0.0001,-1552.6772,50.5874,0.7712,0.0525 +9.579,0.0000,-11546.3103,68.7793,0.8049,0.0509 +9.632,0.0000,-24748.0694,177.2319,0.8072,0.0506 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/gains/Optimalmars05SteerGains.txt b/gains/Optimalmars05SteerGains.txt new file mode 100644 index 0000000..0625a63 --- /dev/null +++ b/gains/Optimalmars05SteerGains.txt @@ -0,0 +1,13 @@ +speed,kDelta,kPhiDot,kPhi,kPsi,kY +2.000,83.7617,-0.5858,2.0631,0.0891,0.2011 +2.500,22.0000,-0.0900,23.3000,0.0580,0.1950 +3.200,29.2830,-0.0490,25.6400,0.0870,0.1500 +3.600,33.1311,-0.0535,19.8266,0.1056,0.1338 +4.000,-0.3393,2.1328,19.5752,0.0932,0.1281 +4.800,44.6406,-0.0529,13.2253,0.1720,0.1001 +5.000,-19.8563,0.2679,22.5997,1.3403,0.0994 +6.000,-15.4890,0.2849,22.8328,0.6720,0.0821 +8.000,-15.8532,0.2315,19.9489,0.8353,0.0617 +8.340,78.2238,-0.0388,9.2493,0.4676,0.0571 +10.000,0.0000,-402936.9975,1406.8634,0.8467,0.0488 +12.000,115.3790,-0.0290,9.2800,0.8550,0.0400 diff --git a/parameters/FalkorheadonbenchmarkPar.txt b/parameters/FalkorheadonbenchmarkPar.txt new file mode 100644 index 0000000..87c552c --- /dev/null +++ b/parameters/FalkorheadonbenchmarkPar.txt @@ -0,0 +1,26 @@ +w = 1.02+/-0.0 +c = 0.08+/-0.0 +lam = 0.314159265358979323846+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 1.08614354714667+/-0.0 +zH = -0.836145570231909+/-0.0 +mH = 9.987419+/-0.0 +IHxx = 0.364470171978049+/-0.0 +IHyy = 0.858126183578914+/-0.0 +IHzz = 0.811258699792091+/-0.0 +IHxz = 0.161532798228031+/-0.0 +rF = 0.35+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal02Par.txt b/parameters/Optimal02Par.txt new file mode 100644 index 0000000..0d14fd0 --- /dev/null +++ b/parameters/Optimal02Par.txt @@ -0,0 +1,26 @@ +w = 0.326966292134831+/-0.0 +c = 0.328479672899277+/-0.0 +lam = 0.523599572020184+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.331065548645305+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal04Par.txt b/parameters/Optimal04Par.txt new file mode 100644 index 0000000..084d19f --- /dev/null +++ b/parameters/Optimal04Par.txt @@ -0,0 +1,26 @@ +w = 1.102635437169494+/-0.0 +c = -0.205975736896489+/-0.0 +lam = 0.264957942874967+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.477373500334235+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal05Par.txt b/parameters/Optimal05Par.txt new file mode 100644 index 0000000..0a7eb19 --- /dev/null +++ b/parameters/Optimal05Par.txt @@ -0,0 +1,26 @@ +w = 1.507286469014997+/-0.0 +c = -0.239348385100141+/-0.0 +lam = 0.678170610472069+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.187689569212885+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal06Par.txt b/parameters/Optimal06Par.txt new file mode 100644 index 0000000..31673d9 --- /dev/null +++ b/parameters/Optimal06Par.txt @@ -0,0 +1,26 @@ +w = 0.816911478331684+/-0.0 +c = 0.026063868538996+/-0.0 +lam = 0.058403771605918+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.036858622669284+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal08Par.txt b/parameters/Optimal08Par.txt new file mode 100644 index 0000000..7d63a02 --- /dev/null +++ b/parameters/Optimal08Par.txt @@ -0,0 +1,26 @@ +w = 0.992688165625778+/-0.0 +c = 0.202428473997644+/-0.0 +lam = 0.207479161885578+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.080213284316253+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimal10Par.txt b/parameters/Optimal10Par.txt new file mode 100644 index 0000000..def90bd --- /dev/null +++ b/parameters/Optimal10Par.txt @@ -0,0 +1,26 @@ +w = 0.875541900008060+/-0.0 +c = -0.123609064969935+/-0.0 +lam = 0.127121477812460+/-0.0 +g = 9.81+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.490206363561080+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/Optimalmars05Par.txt b/parameters/Optimalmars05Par.txt new file mode 100644 index 0000000..7ed13ef --- /dev/null +++ b/parameters/Optimalmars05Par.txt @@ -0,0 +1,26 @@ +w = 0.865968490527746+/-0.0 +c = 0.136080685785875+/-0.0 +lam = 0.035089181484298+/-0.0 +g = 3.71+/-0.0 +rR = 0.3+/-0.0 +mR = 2.0+/-0.0 +IRxx = 0.0603+/-0.0 +IRyy = 0.12+/-0.0 +xB = 0.3+/-0.0 +zB = -0.9+/-0.0 +mB = 85.0+/-0.0 +IBxx = 9.2+/-0.0 +IByy = 11.0+/-0.0 +IBzz = 2.8+/-0.0 +IBxz = 2.4+/-0.0 +xH = 0.9+/-0.0 +zH = -0.7+/-0.0 +mH = 4.0+/-0.0 +IHxx = 0.05892+/-0.0 +IHyy = 0.06+/-0.0 +IHzz = 0.00708+/-0.0 +IHxz = -0.00756+/-0.0 +rF = 0.029246492023939+/-0.0 +mF = 3.0+/-0.0 +IFxx = 0.1405+/-0.0 +IFyy = 0.28+/-0.0 diff --git a/parameters/README.rst b/parameters/README.rst index 5ffb482..f0fc536 100644 --- a/parameters/README.rst +++ b/parameters/README.rst @@ -29,8 +29,25 @@ EtaV2 EtaV3 A faired recumbent bicycle with 66.2 degree head tube angle and 76 mm of trail as reported in [Selwa2016]_. +Falkorheadonbenchmark + A very large and bulky dragon head was added to the handlebars of the + Benchmark bicycle. Reported on in the BMD 2016 presentation. Fisher A Gary Fisher mountain bike with rider "Jason" as reported in [Moore2012a]_. +Optimal02 + An optimally handling bicycle for 2 m/s presented in [Moore2016]_. +Optimal04 + An optimally handling bicycle for 4 m/s presented in [Moore2016]_. +Optimal05 + An optimally handling bicycle for 5 m/s presented in [Moore2016]_. +Optimal06 + An optimally handling bicycle for 6 m/s presented in [Moore2016]_. +Optimal08 + An optimally handling bicycle for 8 m/s presented in [Moore2016]_. +Optimal10 + An optimally handling bicycle for 10 m/s presented in [Moore2016]_. +Optimalmars05Par.txt + An optimally handling bicycle for 5 m/s with gravity set to that of Mars. Pista A Bianchi Pista track bicycle with rider "Jason" as reported in [Moore2012a]_. @@ -51,6 +68,7 @@ Yellowrev The same road bike as above with its fork reversed with rider "Jason" as reported in [Moore2012a]_. + References ========== @@ -65,3 +83,6 @@ References https://github.com/moorepants/BicycleParameters .. [Selwa2016] Selwa, Alexander. (2016). Stability and Control of Streamlined Bicycles. University of Toronto. +.. [Moore2016] J. Moore, M. Hubbard, and R. A. Hess, "An Optimal Handling + Bicycle," in Proceedings of the 2016 Bicycle and Motorcycle Dynamics + Conference, 2016. From 2dcba9bccb766f2c166acd4603a2f877a6925ade Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 17:24:47 -0700 Subject: [PATCH 04/10] Try 6 m/s and display unknowns better. --- objective.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/objective.m b/objective.m index b201398..14a6297 100644 --- a/objective.m +++ b/objective.m @@ -15,12 +15,15 @@ % NOTE : This value has to be manually set to be the target speed for the % optimal design. % TODO : Move setting this into "optimal_bicycle.m". -speed = 4.0; +speed = 6.0; display('==========================================') display('Values passed into the objective function:') -unknowns +display(sprintf('c: %1.4f ', unknowns(1))) +display(sprintf('w: %1.4f ', unknowns(2))) +display(sprintf('lam: %1.4f ', unknowns(3))) +display(sprintf('IFyy: %1.4f ', unknowns(4))) freqs = linspace(0.01, 40, 200); From a9b91a7597cf1086da964ca511b0ba85f7ad18ab Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 17:25:48 -0700 Subject: [PATCH 05/10] IFyy lower bound cannot be zero, set to value of mass 0.1 kg and radius of disc 0.0254 m. --- optimal_bicycle.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optimal_bicycle.m b/optimal_bicycle.m index 9cd551e..550a811 100644 --- a/optimal_bicycle.m +++ b/optimal_bicycle.m @@ -12,7 +12,7 @@ opts.LBounds = [-inf; % c min_wheelbase; % w -pi/2; % lam - 0.0]; % IFyy + 3e-5]; % IFyy opts.UBounds = [inf; % c inf; % w From eedbcc8ee1afbacc7136ba3963d07579e795f57a Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 21:41:05 -0700 Subject: [PATCH 06/10] Steps to consistency in setting all the right parameters in the optimization. --- objective.m | 35 +++++++++++++++++++++-------------- optimal_bicycle.m | 5 ++++- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/objective.m b/objective.m index 14a6297..076de8e 100644 --- a/objective.m +++ b/objective.m @@ -1,7 +1,8 @@ function [peak_hqm] = objective(unknowns) % OBJECTIVE - Returns the maximum value of the HQM transfer function -% magnitude if the system is closed loop stable or a large value based on -% how large the closed loop poles are if the system is closed loop unstable. +% magnitude if the system is closed loop stable or an order of magnitude +% larger value based on the largest closed loop poles are if the system is +% closed loop unstable. % % Syntax: peak_hqm = objective(unknowns) % @@ -12,26 +13,27 @@ % Outputs: % peak_hqm - Maximum scalar value of the HQM magnitude. -% NOTE : This value has to be manually set to be the target speed for the +% NOTE : These have to be manually set to be the target speed for the % optimal design. % TODO : Move setting this into "optimal_bicycle.m". -speed = 6.0; +speed = 3.0; +bicycle = 'Pista'; display('==========================================') - display('Values passed into the objective function:') -display(sprintf('c: %1.4f ', unknowns(1))) -display(sprintf('w: %1.4f ', unknowns(2))) -display(sprintf('lam: %1.4f ', unknowns(3))) -display(sprintf('IFyy: %1.4f ', unknowns(4))) +display(sprintf('c: %1.5f ', unknowns(1))) +display(sprintf('w: %1.5f ', unknowns(2))) +display(sprintf('lam: %1.5f ', unknowns(3))) +display(sprintf('IFyy: %1.5f ', unknowns(4))) freqs = linspace(0.01, 40, 200); % NOTE : This has to be manually set and match that in "optimal_bicycle.m". -par = par_text_to_struct('parameters/PistaPar.txt'); +par = par_text_to_struct(['parameters/' bicycle 'Par.txt']); % NOTE : Here to try for fun to see if different bicycle designs are needed % for riding in low gravity. +% TODO : These should be moved to "optimal_bicycle.m". %par.g = 1.6; % acceleration due to gravity on the moon %par.g = 3.71; % acceleration due to gravity on mars @@ -50,16 +52,19 @@ if IFyy_opt < par.IFyy % keep the mass the same but reduce the wheel radius par.rF = sqrt(IFyy_opt ./ par.mF); -else IFyy_opt > par.IFyy +elseif IFyy_opt > par.IFyy % keep radius of the wheel the same but add mass - par.mF = IFyy_opt / par.rF.^2; + par.mF = IFyy_opt ./ par.rF.^2; end +display(sprintf('rF: %1.5f ', par.rF)) +display(sprintf('mF: %1.5f ', par.mF)) + par.IFyy = IFyy_opt; % front wheel rotational inertia [A, B, C, D] = whipple_pull_force_abcd(par, speed); -data = generate_data('Benchmark', speed, ... +data = generate_data(bicycle, speed, ... 'simulate', false, ... 'forceTransfer', {}, ... 'fullSystem', false, ... @@ -73,7 +78,8 @@ % TODO : It may be best to return NAN here as per the CMAES statement % "An easy way to implement a hard non-linear constraint is to return % NaN. Then, this function evaluation is not counted and a newly sampled - % point is tried immediately." + % point is tried immediately." Right now it returns a large number + % relative to the target low HQM values. peak_hqm = max(10, 100 * max(real(pole(lateral_dev_loop)))); else num = data.handlingMetric.num; @@ -84,3 +90,4 @@ display('Value of the objective function:') peak_hqm +display('==========================================') diff --git a/optimal_bicycle.m b/optimal_bicycle.m index 550a811..9ed4ad4 100644 --- a/optimal_bicycle.m +++ b/optimal_bicycle.m @@ -1,4 +1,5 @@ -par = par_text_to_struct('parameters/PistaPar.txt'); +bicycle = 'Pista'; +par = par_text_to_struct(['parameters/' bicycle 'Par.txt']); guess = zeros(4, 1); guess(1) = par.c; @@ -9,6 +10,8 @@ % wheelbase should always accomdate the mass center min_wheelbase = (par.mH * par.xH + par.mB * par.xB) / (par.mH + par.mB); +fprintf('The minimum possible wheelbase is %1.4f\n', min_wheelbase); + opts.LBounds = [-inf; % c min_wheelbase; % w -pi/2; % lam From 7a899026bc49eee460cd962ec7a1a68ceb4818cc Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 21:44:26 -0700 Subject: [PATCH 07/10] Fixed hanging merge conflict. --- parameters/README.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/parameters/README.rst b/parameters/README.rst index 434ab3f..d13a984 100644 --- a/parameters/README.rst +++ b/parameters/README.rst @@ -46,11 +46,7 @@ Optimal08 An optimally handling bicycle for 8 m/s presented in [Moore2016]_. Optimal10 An optimally handling bicycle for 10 m/s presented in [Moore2016]_. -<<<<<<< HEAD -Optimalmars05Par.txt -======= Optimalmars05 ->>>>>>> master An optimally handling bicycle for 5 m/s with gravity set to that of Mars. Pista A Bianchi Pista track bicycle with rider "Jason" as reported in From c1cac544dc2d8ef973aa681dccc64a3a2038e135 Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 22:07:04 -0700 Subject: [PATCH 08/10] bicycle and speed are now only set in the optimization script --- objective.m | 18 +++++++----------- optimal_bicycle.m | 11 +++++++++-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/objective.m b/objective.m index 076de8e..86928ae 100644 --- a/objective.m +++ b/objective.m @@ -1,25 +1,22 @@ -function [peak_hqm] = objective(unknowns) +function [peak_hqm] = objective(unknowns, bicycle, speed) % OBJECTIVE - Returns the maximum value of the HQM transfer function % magnitude if the system is closed loop stable or an order of magnitude % larger value based on the largest closed loop poles are if the system is % closed loop unstable. % -% Syntax: peak_hqm = objective(unknowns) +% Syntax: peak_hqm = objective(unknowns, bicycle, speed) % % Inputs: % unknowns - Vector of the optimization parameters (c trail, w wheelbase, % lam steer axis tilt, IFyy front wheel rotational inertia), % size 4x1. +% bicycle - A char for the bicycle name, e.g. 'Benchmark', 'Pista', etc. +% speed - Scalar value for the design speed. +% % Outputs: % peak_hqm - Maximum scalar value of the HQM magnitude. -% NOTE : These have to be manually set to be the target speed for the -% optimal design. -% TODO : Move setting this into "optimal_bicycle.m". -speed = 3.0; -bicycle = 'Pista'; - -display('==========================================') +display(sprintf(repmat('=', 1, 79))) display('Values passed into the objective function:') display(sprintf('c: %1.5f ', unknowns(1))) display(sprintf('w: %1.5f ', unknowns(2))) @@ -28,7 +25,6 @@ freqs = linspace(0.01, 40, 200); -% NOTE : This has to be manually set and match that in "optimal_bicycle.m". par = par_text_to_struct(['parameters/' bicycle 'Par.txt']); % NOTE : Here to try for fun to see if different bicycle designs are needed @@ -90,4 +86,4 @@ display('Value of the objective function:') peak_hqm -display('==========================================') +display(sprintf(repmat('=', 1, 79))) diff --git a/optimal_bicycle.m b/optimal_bicycle.m index 9ed4ad4..1260b70 100644 --- a/optimal_bicycle.m +++ b/optimal_bicycle.m @@ -1,4 +1,10 @@ +% Searches for a set of four parameters (c, w, lam, IFyy) that minimizes the +% peak HQM magnitude for a specific design speed. + +% Set the design speed and the base bicycle here: +speed = 3.0; % m/s bicycle = 'Pista'; + par = par_text_to_struct(['parameters/' bicycle 'Par.txt']); guess = zeros(4, 1); @@ -7,7 +13,8 @@ guess(3) = par.lam; guess(4) = par.IFyy; -% wheelbase should always accomdate the mass center +% wheelbase should always accomdate the mass center (bicycle doesn't pitch +% foward) min_wheelbase = (par.mH * par.xH + par.mB * par.xB) / (par.mH + par.mB); fprintf('The minimum possible wheelbase is %1.4f\n', min_wheelbase); @@ -28,4 +35,4 @@ 0.07]; %sigma = sqrt(var(guess')'); -[optimal_par, hqm] = cmaes('objective', guess, sigma, opts); +[optimal_par, hqm] = cmaes('objective', guess, sigma, opts, bicycle, speed); From 334662adf1c7662f11f85ed4a5f113f46a029164 Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 22:10:26 -0700 Subject: [PATCH 09/10] Fixed errors in the warning message. --- generate_data.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/generate_data.m b/generate_data.m index ab29ac4..9e1d94f 100644 --- a/generate_data.m +++ b/generate_data.m @@ -467,16 +467,15 @@ display(sprintf(repmat('*', 1, 76))) s = ['The closed loop system is not stable with these selected ', ... 'controller gains. The Handling Quality Metric is not valid\n', ... - 'because the system is closed loop unstable. The simulations,', ... + 'because the system is closed loop unstable. The simulations ', ... 'will reflect the instabilities, but may be useful if\n', ... - 'marginally stable. It is best to provide improved gain guesses', ... + 'marginally stable. It is best to provide improved gain guesses ', ... 'or supply the gains manually.\n']; display(sprintf(s)) display(sprintf(repmat('*', 1, 76))) display('Closed loop system eigenvalues:') eig(A) - display('Gains selected:') - display(settings.gains) + settings.gains else % if not unstable % only save gains if not user supplied and the neuro frequency is % default From 660dc73b98546dc9d5efb718c9b57bae6eea12d7 Mon Sep 17 00:00:00 2001 From: "Jason K. Moore" Date: Fri, 21 Jun 2019 22:31:01 -0700 Subject: [PATCH 10/10] Word wrapped the unstable warning more nicely. --- generate_data.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/generate_data.m b/generate_data.m index 9e1d94f..ea76e90 100644 --- a/generate_data.m +++ b/generate_data.m @@ -465,12 +465,11 @@ display(sprintf(repmat('*', 1, 76))) display('Warning') display(sprintf(repmat('*', 1, 76))) - s = ['The closed loop system is not stable with these selected ', ... - 'controller gains. The Handling Quality Metric is not valid\n', ... - 'because the system is closed loop unstable. The simulations ', ... - 'will reflect the instabilities, but may be useful if\n', ... - 'marginally stable. It is best to provide improved gain guesses ', ... - 'or supply the gains manually.\n']; + s = ['The closed loop system is not stable with these selected controller gains.\n', ... + 'The Handling Quality Metric is not valid because the system is closed loop\n', ... + 'unstable. The simulations will reflect the instabilities, but may be useful\n', ... + 'if marginally stable. It is best to provide improved gain guesses or supply\n', ... + 'the gains manually.']; display(sprintf(s)) display(sprintf(repmat('*', 1, 76))) display('Closed loop system eigenvalues:')