Author Topic: Can someone help me?  (Read 2871 times)

0 Members and 1 Guest are viewing this topic.

Offline CUrules12Topic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Can someone help me?
« on: November 27, 2010, 09:29:23 AM »
I need a simple program for the Atmega8 where the robot will go 5 feet and turn left, and do this multiple times.  Basically to go in a square that is 25 square foot.  The distance and square footage can be changed.  I just need to know if someone has one available or if someone could help  me out and quickly write it.  I have no experience in programming, and I have been trying to learn, but I still just do not know how to write this type of program.  Anyone help me out?

Offline VegaObscura

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Can someone help me?
« Reply #1 on: November 27, 2010, 04:43:10 PM »
Do you mean you want a program for the $50 bot?  I happen to have done exactly this.  The only issue I had was getting the turns to a perfect 90 degrees.

Step 1:
I wrote a file called interface.h that has functions to make a left turn, make a right turn, go forwards, or go backwards.  All you have to do is download interface.h (attached to this post), and put it in your sbs_source_photovore_v1 folder that you downloaded when you were making your bot.

Step 2:
Open your sbs_source_photovore_v1 folder and find Photovore_v1.c and open it.  Make sure you open photovore_v1.c, and not photovore_v1.aws or photovore_v1.aps.

Step 3:
Near the top of that file, replace the line:
#include "SoR_Utils.h"

with:
#include "interface.h"

Step 4:
Scroll down until you find a line that says:
/*********ADD YOUR CODE BELOW THIS LINE **********/

And delete everything below that up until the line:
/*********ADD YOUR CODE ABOVE THIS LINE **********/

Step 5:
Between those two lines, add this:

init(); //Initialize everything

while(1) //The infinite loop
{
  straight(154);  //Go straight 154 centimeters
  left(); // Turn left
}


Now, depending on how your robot body was designed, that should go about 5 feet and make almost left turns.  To make it more accurate, open interface.h and adjust "pointspercm" and "pointsper90deg".  If the robot is going too far when going straight, make "pointspercm" a lower value.  If its not going far enough, make it a higher value.  If the robot is overturning, make "piontsper90deg" a lower value.  If its under turning, make it a lower value.


Let me know how all that works for you.  If you need any more help just let me know.
« Last Edit: November 27, 2010, 04:53:13 PM by VegaObscura »

Offline CUrules12Topic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: Can someone help me?
« Reply #2 on: November 30, 2010, 04:27:39 PM »
i cannot get the program to write to my robot..i get "write failed"

Offline CUrules12Topic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: Can someone help me?
« Reply #3 on: November 30, 2010, 04:41:28 PM »
ok...i have the program written now...but my robot is not turning..it is going in a straight line...does it have something to do with the potentiometers on my servos? (i went ahead and bought continuous rotation ones)

Offline VegaObscura

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Can someone help me?
« Reply #4 on: November 30, 2010, 05:04:01 PM »
If you bought them as continuous rotation, then the problem shouldn't be anything to do with the potentiometers.

Make sure these two lines are exactly perfect:

  straight(154);  //Go straight 154 centimeters
  left(); // Turn left

If that still doesn't work, upload your Photovore_V1.c file for me to take a look at.  I'm about to go out for 2 or 3 hours, but I'll be back and will help you then.  Make sure you don't sign off and I'll do my best to get it working for you.

Offline CUrules12Topic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: Can someone help me?
« Reply #5 on: November 30, 2010, 08:28:30 PM »
I got it fixed..turns out that when the potentiometers where in the full forward point..the program would not overwrite the instructions from the potentiometer..i rotated both of them in a little and it works

Offline VegaObscura

  • Robot Overlord
  • ****
  • Posts: 153
  • Helpful? 6
Re: Can someone help me?
« Reply #6 on: November 30, 2010, 08:42:52 PM »
Glad to hear you got it working.  Good luck on your presentation tomorrow.

Also, are you sure you're talking about the potentiometers?  If you bought the servos already modified, there is no reason why you should ever even have to see the potentiometers.  These are inside the servos, and the only way to get to them is to take the servos apart.  What they do is provide feedback to let the motor controller inside the servo know when the servo horn has reached the desired the desired angle.  When a servo gets modified, the potentiometer head gets cut off so it doesn't move and always tells the servo "were not there yet" and therefore it turns forever.  I think you might actually be talking about the servo horns - the part of the servos that rotates and the wheels are attached to.  The servos probably came with several of these in a small plastic bag.  They are usually red or white.

If you really are talking about the potentiometers, and you bought servos already modified for continous rotation but the potentiometers weren't centered, then you didn't actually get fully modified servos.  If your potentiometers are able to move freely with your hands, then there is clearly a problem.  If your servos are still acting iffy, you might want to follow the "modifying servos" tutorial on this site just to make sure that they are modified properly.  Perfectly centering the potentiometers, cutting off the heads, and gluing them in place is actually very important if you don't want your robot to stop working or spaz out in the middle of operation because the pots got turned.
« Last Edit: November 30, 2010, 09:22:16 PM by VegaObscura »

 

SMF spam blocked by CleanTalk