CanHaptics Lab 4: Controlled actuation using PID

Task: create an actuated interaction using Haply and a PID controller

Goals

Materials

Tools

Tuning the PID

Proportional component

Derivative component

Integral component

Path tracking

For path tracking, I implemented the trajectory represented by the intersection of these three line equations:

y = 1.67x + 0.3
y = –x + 0.3
y = 0.33x 0.1
if (index < 3 && path) {
current_time = millis();
if(last_time == 0){
last_time = current_time;
}
if ((current_time - last_time) < movement_duration) {
if(index == 0 && xr <= 0){
xr = xr + 0.0001;
yr = 1.667*xr + 0.3;
} else if(index == 1 && xr <= 0.3) {
xr = xr + 0.0001;
yr = -1*xr + 0.3;
} else if(index == 2 && xr >= -0.3) {
xr = xr - 0.00015;
yr = 0.333*xr - 0.1;
}
} else {
index++;
last_time = current_time;
}
} else if (index == 3) {
index = 0;
xr = -0.3;
yr = -0.2;
}

Sampling rate

Reflections