Author Topic: $50 robot programing  (Read 7276 times)

0 Members and 1 Guest are viewing this topic.

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
$50 robot programing
« on: August 04, 2008, 04:55:38 PM »
I want to find out if you can program the $50 robot to like go forward for so long, stop, turn, go forward, stop.

this is my first robot that I built and I don't know any codes for programing. please give me the code (if the robot can do this) so I can look at it.  thanks
young people can build robots to!!!

Offline Kohanbash

  • Supreme Robot
  • *****
  • Posts: 430
  • Helpful? 1
Re: $50 robot programing
« Reply #1 on: August 05, 2008, 09:52:32 PM »
Hi
Yes the $50 robot can do that.
In psuedocode you would tell the robot to:

driveLeftWheelForward
driveRightWheelForward
sleep(whateverTimeYouWant)

stopLeftWheel
stopRightWheel
sleep(whateverTimeYouWant)

driveLeftWheelForward
driveRightWheelReverse
sleep(whateverTimeYouWant)

etc...

See http://www.societyofrobots.com/programming_differentialdrive.shtml for driving information
Robots for Roboticists Blog - http://robotsforroboticists.com/

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
Re: $50 robot programing
« Reply #2 on: August 06, 2008, 10:53:36 AM »
i'm not sure if its psuedocode. i do know that i'm just changing the code that admin (or whoever wrote that tutorial) told me to download and compile.

when i compiled it this is the type of code that it had on it:

{
servo_left(25)
servo_right(44)           this is straight. this is one of the things he  had on the code.
}

is it psuedocode?    ???
and if its not can you give me what i told you in this type of code ?           
young people can build robots to!!!

Offline Kohanbash

  • Supreme Robot
  • *****
  • Posts: 430
  • Helpful? 1
Re: $50 robot programing
« Reply #3 on: August 06, 2008, 11:48:55 AM »
hi
psuedocode is part me being lazy and part making it general.
so the admin gave C code which is what you need to program the robot with, the psuedocode is just an english version of what needs to be coded.

so anytime I wrote
driveLeftWheelForward you would replace it with servo_left(25)

etc...

You may need to experiment to change the values in the parentheses to some other value
Robots for Roboticists Blog - http://robotsforroboticists.com/

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
Re: $50 robot programing
« Reply #4 on: August 06, 2008, 11:57:27 AM »
what about sleep( )  ?

i put it in between the servo code and clicked build and it had an error. this is what i typed:
      {
      servo_left(25);
      servo_right(44);
      }
                               
      sleep(500)

      {
      servo_left(44);
      servo_right(44);
      }

    
    }

      
   }


anything wrong with it?

and how do I stop the robot?
« Last Edit: August 06, 2008, 12:01:24 PM by ert481 »
young people can build robots to!!!

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: $50 robot programing
« Reply #5 on: August 06, 2008, 12:22:18 PM »
theres no function called sleep...thats pseudocode also.


look in the SoR_Utils.h file for the delay function.

There are already simplified functions in there also.

robot_go_straight();

robot_turn_left();

etc.

to make it stop just call the function

robot_hold_position();
« Last Edit: August 06, 2008, 12:23:24 PM by pomprocker »

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
Re: $50 robot programing
« Reply #6 on: August 06, 2008, 12:26:32 PM »
thanks!!  (finally)
young people can build robots to!!!

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
Re: $50 robot programing
« Reply #7 on: August 06, 2008, 12:36:46 PM »
do you need to type:

{
robot_go_straight(and what do I put in between these ? );
}

or just

robot_go_straight();
young people can build robots to!!!

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: $50 robot programing
« Reply #8 on: August 06, 2008, 12:45:28 PM »
nothing, its a void function, just empty parenthesis

Offline ert481Topic starter

  • Jr. Member
  • **
  • Posts: 32
  • Helpful? 0
  • yo young?
Re: $50 robot programing
« Reply #9 on: August 06, 2008, 12:53:48 PM »
i got the hole thing figured out. :P
young people can build robots to!!!