lucy-musicalfish / CodingForDucks

ENGR101 Project 3 Team 23
0 stars 0 forks source link

Speed issue when turning #15

Open Liam794 opened 4 years ago

Liam794 commented 4 years ago

Tried adding motorL = 50 under the "if(pix > 250){ "here" isWhite = 1; } along with motorR, but unfortunately it didnt work the way intended and cannot turn the rate i need for it to be able to make sharp turns.

I tried to add and take away "vRight/2 " and "vLeft/2" to see if they were causing the issue but no change occurred.

will keep issues updated on progress.

CaptainBrexit commented 4 years ago

One change I tried to stop the robot from zigzagging on straight lines after corners was to make the default speed for motorR = vRight - 10 and motorL = vLeft -10. This made it take corners slower and ended up making the robot follow the lines more accurately. Maybe give it a try

StephenThessman commented 4 years ago

Got a version of the equation working. motorL = vLeft + kp error; motorR = vRight - kp error; This was the semi code Arthur provided in the lecture. I just completely missed it. And I couldn't put it in code the other day either. Sorry team.

Changes therefore are:

  1. A kp variable to Core code.
  2. Made the two equations above the main variable for motorL & motorR (instead of defining them earlier and then overwriting them which it was doing).
  3. Remove the if statement for if error > 0 or error < 0 as when error is 0 now motor speed is just vLeft or vRight. As defined by the above equation.
  4. Robot tested up to a speed of 40 (probably can go higher just need to change the kp too).
  5. Moved the robot detection line to a 10th of the space infront of it. This was what was causing the robot to turn far too early and cut track. Now only the final corner is cut and not by much either.
  6. Some testing has been done. Speed value of 40 and kp of 0.5 work quite well.

I will upload a branch and put an issue with these exact same changes.