Shop OBEX P1 Docs P2 Docs Learn Events
Smoother Turning with high speed servos. — Parallax Forums

Smoother Turning with high speed servos.

pwiecekpwiecek Posts: 21
edited 2018-02-27 05:51 in Robotics
I am working on a line following project for a robotics class. We're using an Activitybot (not 360) with NO speed sensors on the wheels. We are using only 2 line sensors.

[img][/img]40510594181_7639df6c0e_b.jpg

When the bot detects the line, reverses one wheel to turn, then goes straight again. I am thinking that the robot would complete the track faster if one wheel was slowed rather than reversed. I have added the following "constant" to the setup block

39615696145_8c8561c825.jpg

And changed the functions to:

40510768711_71c093bf8f_b.jpg

If the Delta = 2 X speed, the program is functionally the same as the previous code. My thought is that a lower delta would cause a more gentle turn back to the track, but its not working. If delta is near to 2 X speed it works exactly the same. If I set the delta to a significantly lower value it does not follow the line at all.

In short, is there a way to make the activity bot make a smooth turn rather than stopping and pivoting? Would this result in a hightr speed through the turns

Comments

  • Writing this down has caused me to think this through, is it possible that this is what is happening?

    When one sensor detects the line, the bot starts a shallow turn that does not return to the line fast enough. Both sensors then lose the line and the bot takes off in a straight line.

    If this is true, is that why the Parallax implementation uses 4 sensors?

    If so, is a delta closer to but still less than 2 X speed likely to make the circuit of the track any faster?
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2018-02-27 06:25
    With just two sensors you'll need to find the sweet spot for the amount of delta you wish you apply in order to bring about a course correction. Your success will depend on how tight the curves are. With only shallow curves it's not too hard to get it tuned.

    I've not used the Activity Bot for line following, but I've done a number of them over the years, and I've found reversing the motor to be pretty drastic unless you have a larger array, and it's the outside sensors that are picking up the line. I've done it with eight sensors (Pololu makes an 8-sensor strip), where in software the sensors are weighted from the center. The higher the weighting, the more differential is applied to the wheels.

    For just two sensors, try half speed to veer off, or at worse, turn the motor completely off, but do so only very briefly (e.g. 5-10 milliseconds).

    Also, consider coding a loose circle when neither sensor picks up the line. That way your robot can attempt, however feebly, to reacquire the line.

    -- Gordon
  • Thanks for the help.
    Also, consider coding a loose circle when neither sensor picks up the line. That way your robot can attempt, however feebly, to reacquire the line.

    -- Gordon

    Unfortunately, the midterm is a race and just sticking with the existing code will be faster than reacquiring.
  • ercoerco Posts: 20,250
    +1 to all that Master of Robotics Gordon said. 2-sensor bots can be tweaked to go faster by careful attention to hardware (sensor size/location and view of the line) and software. When in doubt, add a little extra voltage or bigger wheels for higher speed, but you'll have to adjust your software. BTW, sensor location means both how far apart they are, and also how far ahead of the drive wheels. Farther from drive wheels=more stability but limits your turn radius. These $4 line followers just use hardware comparators but even they had room for improvement.



    This bot used a single 555 timer to vary the duty cycle to each motor. Very smooth, but huge turning radius.


  • pwiecek wrote: »
    Unfortunately, the midterm is a race and just sticking with the existing code will be faster than reacquiring.

    Hmm. On most of these when the robot can't find the line again (from about where you left off) you're disqualified anyway. Going straight is like giving up. Or maybe in the rules of this race losing the line is a disqualifier no matter what, so you might as well drive off the course.

    You might also consider adding some state memory to your algorithm. You can keep a repeating cycle of the last couple of steerings. If the robot suddenly loses the track altogether, you have a reasonable chance of undoing the overcorrection. You just need to record that you last veered right or left, and then apply the opposite correction in the hopes of getting the line again.

Sign In or Register to comment.