-
Notifications
You must be signed in to change notification settings - Fork 1
/
MBabsAngle.m
54 lines (44 loc) · 1.33 KB
/
MBabsAngle.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
44
45
46
47
48
49
50
51
52
53
54
classdef MBabsAngle < MBconstraint
properties
end
methods
function obj = MBabsAngle(varargin)
data = varargin{1};
obj = obj@MBconstraint(data.id, 1, data.body1, [], data.fun);
end
function print(obj)
print@MBconstraint(obj);
end
function [Phi, Phi_q, Nu, Gamma] = eval(obj, t, qi, qdi, flags)
phi = qi(3);
Phi = [];
Phi_q = [];
Nu = [];
Gamma = [];
if flags(1)
Phi = phi - obj.fun(t);
end
if flags(2)
Phi_q = [0, 0, 1];
end
if flags(3)
Nu = obj.funD(t);
end
if flags(4)
Gamma = obj.funDD(t);
end
end
function [] = evalAndPrint(obj, t, qi, qdi)
[Phi, Phi_q, Nu, Gamma] = obj.eval(t, qi, qdi, [1,1,1,1]);
fprintf('Phi = [ %10.4f ]\n', Phi);
fprintf('Phi_qi = [ %10.4f %10.4f %10.4f ]\n', Phi_q);
fprintf('Nu = [ %10.4f ]\n', Nu);
fprintf('Gamma = [ %10.4f ]\n', Gamma);
end
end
methods(Static)
function type = getType()
type = 'AbsoluteAngle';
end
end
end