implemented lining mode
This commit is contained in:
parent
eab58ccacf
commit
e38cb63c7f
2 changed files with 5 additions and 2 deletions
|
@ -102,8 +102,9 @@ void Robot::LineFollowingUpdate(void)
|
|||
if(robotState == ROBOT_LINING)
|
||||
{
|
||||
// TODO: calculate the error in CalcError(), calc the effort, and update the motion
|
||||
int16_t lineError = lineSensor.CalcError();
|
||||
float turnEffort = 0;
|
||||
float lineError = 3.5 - lineSensor.CalcError();
|
||||
Serial.println(lineError);
|
||||
float turnEffort = lineError * lining_kP;
|
||||
|
||||
chassis.SetTwist(baseSpeed, turnEffort);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <LineSensor.h>
|
||||
#include <LSM6.h>
|
||||
|
||||
static float lining_kP = 1.0;
|
||||
|
||||
class Robot
|
||||
{
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue