Skip to the content.

Lab 8 Stun (Task: flip!)

Overview

int stage;
stage = 1;

// stage 1
if (stage == 1)
{
    if (tof > setpoint)
    {
        run to wall with const u;
    }
    else
    {
        stage = 2;
        t2 = millis(); // record stage2 start time as t2
    }
}
else if (stage == 2)
{
    // stage 2 flip
    if (t2 - millis() < 1000)
    {
        large negative u;
    }
    else
    {
        stage = 3;
    }
}
else if (stage == 3)
{
    lab5 stop on setpoint;
}
else
{
    appendLog(-2, ); // represent errors occured
}

Chanllenges to flip

Showcase: