Hi, I'm trying to develop an obstacle avoidance feature for the XboxController program I made. The first step is adding the distance measurement function in the code (I'm using Grove ultrasonic sensor); I placed it within the loop function, after GYRO calculations:
But it makes Bittle unable to walk (it moves its limbs just a little bit and very slowly) so I think thats not the best place to place the code; where should I put the sensors output to avoid influencing Bittle behaviour and movement?
Got any tips for using sensors? such as how much delay to use, how to send through serial properly...
Hi, the movement becomes laggy because the measurement of echo takes time between each joint's movement. You can add a condition when entering the measurement in the loop. You also need to remove the delay. Actually, by removing the delay, it should be much better.
if(timer == 0){ rangeInCentimeter = ...; }