Skip to content
This repository has been archived by the owner on Jul 31, 2022. It is now read-only.

Commit

Permalink
Not tested to work just yet
Browse files Browse the repository at this point in the history
I changed the tune value in drivetrain
and i added a simple if statement in the PID loop to alert us if we're on the line or not, so later we can add a seek and rediscover
  • Loading branch information
KenwoodFox committed Oct 30, 2018
1 parent 567d8a9 commit a12eaf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Joe/Tumbler Bot/TumbleBot Line Follower Basic/drivetrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

void starboardDriveTrain(float speed) //function to drive each of the starboard wheels using value speed,
{
float tune = 1.4000; //tune adjust for the variablity of the wheels
float tune = 1.4300; //tune adjust for the variablity of the wheels

motor[starboardFore] = (speed * tune); //Set both motors to the speed given and multiply them by thr tune value
motor[starboardAft] = (speed * tune);
Expand Down
6 changes: 6 additions & 0 deletions Joe/Tumbler Bot/TumbleBot Line Follower Basic/lineFollowing.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void linePID(int speed, char statusLight) //serious maths
float Kp = 0.012; //proportional
//float Ki = 0.05; //integral
//float Kd = 0.05; //derivative
int threshold = 400; //The value at witch we can differ a black line from a white table, we could make this a self calibrating value!!

float error = SensorValue[starboardReflector] - SensorValue[portReflector]; //rescan the error

Expand All @@ -40,5 +41,10 @@ void linePID(int speed, char statusLight) //serious maths
/* we've multiplied the weight(kp) by error, but the error number is negative in the starboard side so that we can stray backwards
* and away from the line when we impact it on the corrosponding side
*/

if(SensorValue[masterReflector] >= threshold) //Just a test, if the value of master reflector is greater than the threshold
{
SensorValue[LED] = true; //LED on
}
}
}
2 changes: 0 additions & 2 deletions Joe/Tumbler Bot/TumbleBot Line Follower Basic/source.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@

task main()
{
int threshold = 800; //The value at witch we can differ a black line from a white table, we could make this a self calibrating value!!

while(true)
{
startup(bumpSwitch, LED);
Expand Down

0 comments on commit a12eaf5

Please sign in to comment.