Answers.Body: <p>As you already have a working program for the continuous line, you just need to add provisions for the cases when</p>
  
  <pre><code>(the robot is moving on a straight part) AND (the color sensor finds a gap in the track)
  </code></pre>
  
  <p>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</p>
  
  <ul>
  <li>on the track, </li>
  <li>off the track or </li>
  <li>in a gap but on the track.</li>
  </ul>
  
  <p>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.</p>
  
  <p>If you post more about your existing solution, we could give you more specific ideas.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-04T08:11:14.813Z
Answers.LastActivityDate: 2019-03-04T08:11:14.813Z
Answers.UserDisplayName: zovits
Body: <p>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?</p>
  
Tags: <ev3><robotc>
Title: LEGO Mindstorm EV3 Line-With-Gaps Follower? [Robotc]
UserDisplayName: SSSS
ThreadText: # LEGO Mindstorm EV3 Line-With-Gaps Follower? [Robotc]
  
  (Asked by: username_0 on 2019-03-01)
  
  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?
  
  **Tags:** ev3, robotc
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-03-04. Score: 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.
  
  
  ---
  
  