SENSOR | MATHS 4 ROBOTICS

How can simulate sensor input to change the behavior of our robot ? [br]Use the position of the ground sensors and check if it falls within the boundaries of a rectangular area. For this we define two boolean values [math](out_0, out_1)[/math]to see if the sensor position [math](C_0, C_1)[/math] is inside the rectangle defined by the points [math](F_0, F_1)[/math][br][br][math]out_0=(x(C_0) < x(F_0)) ∨ (x(C_0) > x(F_1)) ∨ (y(C_0) < y(F_0)) ∨ (y(C_0) > y(F_1))[/math][br][math]out_1=(x(C_1) < x(F_0)) ∨ (x(C_1) > x(F_1)) ∨ (y(C_1) < y(F_0)) ∨ (y(C_1) > y(F_1))[/math][br][br]We use this information inside the animation script of the slider time [b]t[/b] to determine if the robot needs to turn.[br][br]A=A+v*v_f*dt[br]If[out_0, SetValue[θ, θ-dθ],If[out_1, SetValue[θ, θ+dθ]]][br][br]To give a visual feedback when the sensor is outside the rectangle, we momentarily increase the size from 3 to 15. [br]SetPointSize[C_0, If[out_0, 15, 3]][br]SetPointSize[C_1, If[out_1, 15, 3]]

Information: SENSOR | MATHS 4 ROBOTICS