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 = ...; }
Maybe it could be a great idea to add comented/disabled code for some of the most popular sensors in the official Bittle code so its usage would be standarized and common for most users (because I had to choose how to represent the measured data in Serial communication, if someone wants to use it, he/she will have to adapt his/her Bittle code to my solution; a common code for us would simpilfy this, making third parties features easier to use and implement). Also, you know better than anyone how to optimize this kind of measurement and outputting through serial communication.