[modules] fix poly osam

variable initialzation only in own block
This commit is contained in:
Felix Ruess
2014-12-14 22:42:57 +01:00
parent 2a0bcc6b66
commit c1d583d409
@@ -392,9 +392,16 @@ bool_t nav_survey_poly_osam_run(void)
TranslateAndRotateFromWorld(&C, SurveyTheta, 0, 0); TranslateAndRotateFromWorld(&C, SurveyTheta, 0, 0);
TranslateAndRotateFromWorld(&C, 0, SmallestCorner.x, SmallestCorner.y); TranslateAndRotateFromWorld(&C, 0, SmallestCorner.x, SmallestCorner.y);
//calc distance from line start and plane position (use only X position because y can be far due to wind or other factor) {
float dist = FromP.x - C.x; //calc distance from line start and plane position (use only X position because y can be far due to wind or other factor)
float dist = FromP.x - C.x;
// verify if plane are less than 10 meter from line start
if ((dc_autoshoot == DC_AUTOSHOOT_STOP) && (fabs(dist) < 10))
{
LINE_START_FUNCTION;
}
}
//Rotate and Translate Line points into real world //Rotate and Translate Line points into real world
RotateAndTranslateToWorld(&ToP, 0, SmallestCorner.x, SmallestCorner.y); RotateAndTranslateToWorld(&ToP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&ToP, SurveyTheta, 0, 0); RotateAndTranslateToWorld(&ToP, SurveyTheta, 0, 0);
@@ -402,12 +409,6 @@ bool_t nav_survey_poly_osam_run(void)
RotateAndTranslateToWorld(&FromP, 0, SmallestCorner.x, SmallestCorner.y); RotateAndTranslateToWorld(&FromP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&FromP, SurveyTheta, 0, 0); RotateAndTranslateToWorld(&FromP, SurveyTheta, 0, 0);
// verify if plane are less than 10 meter from line start
if ((dc_autoshoot == DC_AUTOSHOOT_STOP) && (fabs(dist) < 10))
{
LINE_START_FUNCTION;
}
//follow the line //follow the line
nav_route_xy(FromP.x,FromP.y,ToP.x,ToP.y); nav_route_xy(FromP.x,FromP.y,ToP.x,ToP.y);
if(nav_approaching_xy(ToP.x,ToP.y,FromP.x,FromP.y, 0)) if(nav_approaching_xy(ToP.x,ToP.y,FromP.x,FromP.y, 0))