[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,21 +392,22 @@ 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) //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; float dist = FromP.x - C.x;
//Rotate and Translate Line points into real world
RotateAndTranslateToWorld(&ToP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&ToP, SurveyTheta, 0, 0);
RotateAndTranslateToWorld(&FromP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&FromP, SurveyTheta, 0, 0);
// verify if plane are less than 10 meter from line start // verify if plane are less than 10 meter from line start
if ((dc_autoshoot == DC_AUTOSHOOT_STOP) && (fabs(dist) < 10)) if ((dc_autoshoot == DC_AUTOSHOOT_STOP) && (fabs(dist) < 10))
{ {
LINE_START_FUNCTION; LINE_START_FUNCTION;
} }
}
//Rotate and Translate Line points into real world
RotateAndTranslateToWorld(&ToP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&ToP, SurveyTheta, 0, 0);
RotateAndTranslateToWorld(&FromP, 0, SmallestCorner.x, SmallestCorner.y);
RotateAndTranslateToWorld(&FromP, SurveyTheta, 0, 0);
//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);