-
Notifications
You must be signed in to change notification settings - Fork 42
/
robotIsOnSingleSupportQP.m
42 lines (35 loc) · 1.27 KB
/
robotIsOnSingleSupportQP.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
function onOneFoot = robotIsOnSingleSupportQP(feetContactStatus)
% ROBOTISONSINGLESUPPORTQP detects if the robot is balancing on single
% or double support.
%
% FORMAT: onOneFoot = robotIsOnSingleSupportQP(feetContactStatus)
%
% INPUT: - feetContactStatus = [2 x 1] a vector of booleans describing
% the feet contact status.
% Format: [leftFoot; rightFoot];
%
% OUTPUT: - onOneFoot = true if the robot is balancing on one foot, false
% otherwise.
%
% Authors: Daniele Pucci, Marie Charbonneau, Gabriele Nava
%
% all authors are with the Italian Istitute of Technology (IIT)
% email: [email protected]
%
% Genoa, Dec 2017
%
%% --- Initialization ---
CONTACT_THRESHOLD = 0.1;
if sum(feetContactStatus) > (2 - CONTACT_THRESHOLD)
% two feet balancing
onOneFoot = false;
return;
elseif sum(feetContactStatus) > (1 - CONTACT_THRESHOLD)
% one foot balancing
onOneFoot = true;
return;
else
onOneFoot = false;
return;
end
end