Is there a way to code the bot so when it hits the wall, it doesnt stop trying to finish the code? I’m asking more for my robotics kids on this one, they are using a drive command to hit the wall, but they are playing around with the exact numbers, but its a give or take.
Is there a way to put like a variable in the numbers so it knows it hit the wall? Without putting a bump switch on it? We’ve tried bump switches before and its always been an issue trying to stay within size.
When you are close to the wall, just tell each of the drive motor to spin forward for a certain amount of time (usually less than a second).
You are gonna need some kind of way for the robot to know if it is hitting the wall or is not moving. With odometry, this is easy to implement. Just get the current location, and if the robot’s current location is the same after a period of time, stop the motors. You could use a distance sensor, but I have no experience with that sensor.
Depending on what code platform you are using you could probably check if the motor velocity is 0 or close to 0.
EcstaticPilotRegular12mDepending on what code platform you are using you could probably check if the motor velocity is 0 or close to 0.
We’re using VSCode with Python, and we have a function for driving, should we make a different function to include a if else statement for the motors velocity?