-
Notifications
You must be signed in to change notification settings - Fork 0
/
Phone.m
43 lines (34 loc) · 1.03 KB
/
Phone.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
40
41
42
43
function [v_r, fbd, v_s] = Phone(varargin)
% dimensions
% width, height, mass, friction, drop velocity
[a, b, m, mu, v0] = PhoneParameters();
mu_mat = diag([mu mu]);
% sim params
h = ceil((m * v0 / 2) * 10) / 10;
N_Routh = 10;
M_Routh = 2 ^ 14;
% construct system
fbd = FreeBodyDiagram();
% rimless wheel
fbd = fbd.addFrame('base', 'object', 'floating');
fbd = fbd.addBox('object', 'phone', a, b, m, 'y');
% floor
fbd = fbd.addWall('floor', [0 1], 0, 'l2');
% construct initial condition
fbd.Configuration = [0 b/2 0]';
fbd.Velocity = [0 -v0 0]';
% set up labelling callback
label_callback = @(f, s) f.labelVelocity('phone', [0 0]', v_of_stage(s), 'r');
% run experiment
[v_r, v_s] = TwoContactExperiment(fbd, mu_mat, M_Routh, N_Routh, h, ...
label_callback, varargin{:});
end
function l = v_of_stage(stage)
l = '$v$';
if stage == -1
l = '$v^-$';
end
if stage == 1
l = '$v^+$';
end
end