No announcement yet.

EV3 c++ detect gap in line following

  • Filter
  • Time
  • Show
Clear All
new posts

  • EV3 c++ detect gap in line following

    Hi everybody,

    I'm new in teaching robotics to students and we are going to join a robo league in Austria.
    We already programmed a robot with one light sensor - he is following the line.

    The problem now is, that we are just allowed to use one light sensor and we need an idea how to detect a gap in the line and how to go over it.

    The gap is about 5cm long. We already tried a lot, but it's still not working very well.
    Thanks a lot!

  • #2
    I want to make sure I am understanding the question here. First of all, this has nothing to do with FIRST Lego League (FLL). This forum is set up for FLL support, but we sometimes answer questions not related to FLL.

    If I understand you correctly, you have a line that you are trying to follow. There, is a 5cm gap in the line where you need to be able to tell the robot to continue going in the same direction and continue following the line once it restarts, correct? You mentioned c++ in the subject, but I don't think you are asking a specific c++ question. I think you are just looking for algorithm ideas for ways to approach this problem, correct?

    Is the gap in a straight part of the line, or is the gap in a curve? Any chance you can post a picture of the line?

    If my understanding is correct, 5cm would definitely be a challenge. You would really have to hope that the robot was very straight on the line before the gap and not actively compensating/correcting, thus putting the robot at an angle to the line rather than straight. And how would you tell the robot that this is a gap and not just the robot getting off the line? That's a tricky one. Is there a way to tell the robot it is approaching the gap? Could you keep track of revolutions and once you start getting close, you put the robot in "gap mode", thus telling to robot to temporarily ignore line errors and instead assume that you have reached the gap? Is there anything else near the gap that could be used to tell the robot it is approaching the gap? Ultrasonic sensor maybe?

    Good luck!
    Norfolk, Virginia, USA
    2014 World Class Learning (coach)
    2015 Trash Trek (coach, judge)
    2016 Animal Allies (coach, judge)
    2017 Hydrodynamics (coach, judge)
    2018 Into Orbit (coach, head judge)


    • #3
      Originally posted by li_sa View Post
      The gap is about 5cm long. We already tried a lot, but it's still not working very well.
      Thanks a lot!
      "tried a lot" is not very descriptive. I've worked with teams that testing one idea over an over is "tried a lot", or teams that think tiny variations on the same idea are different ideas. What have you tried?

      When the robot is tracking the line and encounters the gap, what does it do? Does it always do the same thing? Does it only do this thing when it runs into a gap?

      If the robot is consistent or the gaps are consistently placed, the problem is pretty easy to solve. As Skip mentions, if the gaps are always in the same place, you can stop tracking or limit the steering when you are in a gap area. If the lines are mostly straight you could limit how quickly the robot can turn so it cannot turn off the line during the short gap. If the robot always does the same thing when it encounters a gap, you can write some code to identify "gap behavior" and correct. For example, when tracking the line the robot probably makes little adjustments that alternate between left and right. When the robot encounters a gap it probably makes a big correction to the left or right. You could use the gyro sensor and look for a rapid change in angle, or you could count how many turns the robot does in the same direction and use that to identify that you found a gap.

      There are lots of ways this problem can be solved.