Camera angle fix using IMU working once for all
parent
b87488b1c1
commit
73299bc6c4
|
@ -46,9 +46,11 @@ void DataSourceCameraConic :: readSensor(){
|
||||||
yAngle = (yAngle+360)%360;
|
yAngle = (yAngle+360)%360;
|
||||||
bAngle = (bAngle+360)%360;
|
bAngle = (bAngle+360)%360;
|
||||||
|
|
||||||
|
int angleFix = compass->getValue() > 180 ? compass->getValue() - 360 : compass->getValue();
|
||||||
|
|
||||||
//Fixes with IMU
|
//Fixes with IMU
|
||||||
yAngleFix = ((int)(yAngle + compass->getValue()*0.8) + 360) % 360 ;
|
yAngleFix = ((int) ((yAngle + angleFix*0.8)) + 360) % 360 ;
|
||||||
bAngleFix = ((int)(bAngle + compass->getValue()*0.8) + 360) % 360 ;
|
bAngleFix = ((int) ((bAngle + angleFix*0.8)) + 360) % 360;
|
||||||
|
|
||||||
yDist = sqrt( (true_yy-50)*(true_yy-50) + (50-true_xy)*(50-true_xy) );
|
yDist = sqrt( (true_yy-50)*(true_yy-50) + (50-true_xy)*(50-true_xy) );
|
||||||
bDist = sqrt( (true_yb-50)*(true_yb-50) + (50-true_xb)*(50-true_xb) );
|
bDist = sqrt( (true_yb-50)*(true_yb-50) + (50-true_xb)*(50-true_xb) );
|
||||||
|
|
|
@ -16,7 +16,7 @@ void setup() {
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
updateSensors();
|
updateSensors();
|
||||||
// camera->test();
|
camera->test();
|
||||||
// compass->test();
|
// compass->test();
|
||||||
goalie->play(role==1);
|
goalie->play(role==1);
|
||||||
keeper->play(role==0);
|
keeper->play(role==0);
|
||||||
|
|
Loading…
Reference in New Issue