0

Trying to create an algorithm / code in order to get my robot to follow a track which it currently can do, using a color sensor and following the inside edge. So I'm wondering how to transition to the track with broken parts: the track has gaps with a max. length of 20 cm and only on straight parts. I also have a distance sensor available. What would be the recommended ideas?

1

As you already have a working program for the continuous line, you just need to add provisions for the cases when

(the robot is moving on a straight part) AND (the color sensor finds a gap in the track)

Depending on your existing solution you might need to code dedicated methods to identify the two sub-cases and then call them repeatedly to see if the robot is

  • on the track,
  • off the track or
  • in a gap but on the track.

The above mentioned provision could include just "hold the current direction and continue forwards" or something more elaborate. It could include measuring the distance traveled and seeing if the gap is indeed shorter than 20 cm (and trying to find the line again if a longer gap was found), or introducing a slight fanning motion to help find the end of the gap, or maybe something completely different.

If you post more about your existing solution, we could give you more specific ideas.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.