-
Notifications
You must be signed in to change notification settings - Fork 33
/
ir2y.m
24 lines (20 loc) · 786 Bytes
/
ir2y.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function [y, pipe_percentage] = ir2y(ir)
%% Converts IR reading from the top to the distance in meters from the bottom
% Inputs:
% ~ ir: the IR reading from time of flight sensor
% Outputs:
% ~ y: the distance in [m] from the bottom to the ball
% ~ pipe_percentage: on a scale of 0 (bottom of pipe) to 1 (top of pipe)
% where is the ball
%
% Created by: Kyle Naddeo 2/2/2022
% Modified by: YOUR NAME and DATE
%% Parameters
% ir_bottom = % IR reading when ball is at bottom of pipe
% ir_top = % " " top of pipe
y_top = 0.9144; % Ball at top of the pipe [m]
%% Bound the IR reading and send error message
% (remeber the IR values are inverted ie small values == large height and large values == small height)
%% Set
% pipe_percentage =
% y =