now latest complete structs are copied into new ones when updating status vector

code_midgen
EmaMaker 2020-02-17 14:34:39 +01:00
parent be2bff433d
commit cee576e9c8
4 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@
//PID Constants //PID Constants
#define KP 1.2 #define KP 1.2
#define KI 0.0 #define KI 0.0
#define KD 0.5 #define KD 0.0
#define UNLOCK_THRESH 800 #define UNLOCK_THRESH 800

View File

@ -18,7 +18,7 @@ void DataSourceBNO055::readSensor(){
imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER); imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
this->value = (int) euler.x(); this->value = (int) euler.x();
lastTime = millis(); lastTime = millis();
CURRENT_INPUT_WRITE.IMUAngle = this->value;
CURRENT_DATA_WRITE.IMUAngle = this->value;
} }
CURRENT_INPUT_WRITE.IMUAngle = this->value;
CURRENT_DATA_WRITE.IMUAngle = this->value;
} }

View File

@ -22,8 +22,6 @@ void loop() {
goalie->play(role==1); goalie->play(role==1);
keeper->play(role==0); keeper->play(role==0);
Serial.println(CURRENT_DATA_READ.IMUAngle);
// Last thing to do: movement and update status vector // Last thing to do: movement and update status vector
drive->drivePrepared(); drive->drivePrepared();
updateStatusVector(); updateStatusVector();

View File

@ -12,4 +12,6 @@ void initStatusVector(){
void updateStatusVector(){ void updateStatusVector(){
currentSVIndex = (currentSVIndex+1) % dim; currentSVIndex = (currentSVIndex+1) % dim;
CURRENT_DATA_WRITE = CURRENT_DATA_READ;
CURRENT_INPUT_WRITE = CURRENT_INPUT_READ;
} }