Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Robotics

Name: Anonymous 2010-12-01 23:38

So I'm making a robot follow a line using an IR sensor.

This is the main part of the program, every other function is listed in their own voids.

I can't test it out because the robots aren't available yet. Are there any like "OH SHIT NIGGER WHAT ARE YOU DOING" errors?

PROGRAM:



void GoForward() //Self Explainatory
{
    mav(0,300);
    mav(3,300);
}

void SeekLeft()
{
    mav(0,-200);
    mav(3,200);
    sleep(0.8);
}

void SeekRight()
{
    mav(0,200);
    mav(3,-200);
    sleep(0.8);
}

void ReturnLeft()
{
    SeekRight();
}



void ReturnRight()//SeekLeft, SeekRight, ReturnLeft, and ReturnRight are used to correct the robot if it goes off of the line
{
    SeekLeft();
}

void FinalAttempt() //The robot flails around to the left endlessly
{
    mav(0,500);
    mav(3,-500);
}

void FollowLine()
{
    while(1) //Makes the program always happen
{
GoForward(); //It moves forward until
}   
if(analog(3)<180) //The sensor shows a value of <180 (light) meaning it has moved off of the tape, then it will
{
    SeekLeft(); //Turn to the left very briefly
    if(analog(3)>180)//If the sensor shows a value of >180 (dark) meaning it is back on the tape, it will
    {
        printf("Line found; Curving to the left.\n"); //Display this on the screen
        return; //go back to main, which makes it go forward again
    }
    ReturnLeft();//If turning right fails, it will center itself again, and then
    SeekRight();
    if(analog(3)>180)
    {
        printf("Line found; Curving to the Right.\n");
        return; //Same thing as before. However, if it fails to detect the line a second time after turning,

    }
    ReturnRight(); //It centers itself, and then
    FinalAttempt(); //Flails around trying to find some sort of line
    if(analog(3)>180)
    {
        printf("Line Found on Final Attempt. WARNING: Robot is probably following line in opposite direction.\n");
        return;
    }
    ao(); //If that fails, which shouldn't happen, then it will just shut off.
    printf("Error: Line lost. Write a better program!/n");
}
}

int main()
{
    FollowLine(); //Runs the FollowLine program. Just a way of making things simple in the main.
}

Name: Anonymous 2010-12-01 23:44

FAGGOTRY.c:3:5: warning: implicit declaration of function 'mav' is invalid in
      C99 [-Wimplicit-function-declaration]
    mav(0,300);
    ^
FAGGOTRY.c:11:5: warning: implicit declaration of function 'sleep' is invalid in
      C99 [-Wimplicit-function-declaration]
    sleep(0.8);
    ^
FAGGOTRY.c:45:4: warning: implicit declaration of function 'analog' is invalid
      in C99 [-Wimplicit-function-declaration]
if(analog(3)<180) //The sensor shows a value of <180 (light) meaning it ...
   ^
FAGGOTRY.c:50:9: warning: implicitly declaring C library function 'printf' with
      type 'int (const char *, ...)'
        printf("Line found; Curving to the left.\n"); //Display this on ...
        ^
FAGGOTRY.c:50:9: note: please include the header <stdio.h> or explicitly provide
      a declaration for 'printf'
FAGGOTRY.c:68:5: warning: implicit declaration of function 'ao' is invalid in
      C99 [-Wimplicit-function-declaration]
    ao(); //If that fails, which shouldn't happen, then it will just shut off.
    ^
5 warnings generated.
Undefined symbols:
  "_mav", referenced from:
      _GoForward in cc-OeTenn.o
      _GoForward in cc-OeTenn.o
      _SeekLeft in cc-OeTenn.o
      _SeekLeft in cc-OeTenn.o
      _SeekRight in cc-OeTenn.o
      _SeekRight in cc-OeTenn.o
      _ReturnLeft in cc-OeTenn.o
      _ReturnLeft in cc-OeTenn.o
      _ReturnRight in cc-OeTenn.o
      _ReturnRight in cc-OeTenn.o
      _FinalAttempt in cc-OeTenn.o
      _FinalAttempt in cc-OeTenn.o
      _FollowLine in cc-OeTenn.o
      _FollowLine in cc-OeTenn.o
ld: symbol(s) not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Name: Anonymous 2010-12-01 23:46

Your compiler went full retard.

I asked if anything was wrong with it, not for you to click "compile" and c/p the results.

Dayumn.

Name: Anonymous 2010-12-02 0:14

why are you doing one line functions that send you to another function to actually do the work. fucking stupid.

Name: Anonymous 2010-12-02 0:18

void GoForward() //Self Explainatory[sic]
See kids, this is what happens to your brain when you don't use the [code] tags.

Name: Anonymous 2010-12-02 2:28

Are there any like "OH SHIT NIGGER WHAT ARE YOU DOING" errors?
Yes. Yes, there are.
I'd list some of them, but you should probably be writing this as a state machine anyway.

Name: Anonymous 2010-12-02 7:37

    printf("Error: Line lost. Write a better program!/n");
At least you have a sense of humour.

Name: Anonymous 2011-02-03 1:30

Name: Anonymous 2011-02-18 13:51

<-- check 'em

Name: s Lagoon 2013-07-28 10:09

SHERMAN'S LAGOON   BY JIM TOOMEY

Megan : "I SAW THIS ADVERTISED ON TV AND I HAD TO GET ONE."

Sherman : "A ROBOT?"

Megan : "NOT JUST ANY ROBOT. IT'S A GENIE 4000. IT'S GOING TO TAKE MY PLACE WHILE I'M GONE.

WITH THE GENIE 4000, YOU CAN GO OUT OF TOWN, AND WHEN YOU RETURN, ALL THE CHORES HAVE BEEN DONE.

OKAY, I'M LEAVING NOW. SEE YOU IN A WEEK."

Sherman : "HAVE FUN, MEGAN."

Silence

Sherman : "I'M CURIOUS TO SEE HOW THIS THING WORKS."

Robot : "BEEP BZZZZT!

EMPTY THE DISHWASHER."

Hawthorne : "I THINK IT'S TALKING TO YOU."


www.shermanslagoon.com

7-28 © 2013 Jim Toomey. Dist by King Features Syndicate, Inc

Name: Anonymous 2013-07-28 10:57

I AM HELPING CHILDREN
OH SHIT NIGGER WHAT I ARE ERROR

Don't change these.
Name: Email:
Entire Thread Thread List