I am making robotics vehicle which can avoid obstacles by using 2 ultrasonic sensors. I am now having trouble with x,y coordinates of robot. The task is to move robot from start point to set distination and avoid obstacles between these two points. I am using arduino mega , 2 HR-sc04 , stepper motors with encoder .
thanks ...
I finally understand the method . Can you also please give me some refrence about how to write it on arduino programming ??? something like how to set starting point as (0,0) and track the path of robot as its move and generate a graph . Do I need any other sensor for that ?? Thanks you ..
It would be pretty hard to be able to do that, but basically you will need an interupt attached to the ultrasonics so that when it gets within range, it triggers your avoidance script. Then you will need an accelerometer/gyroscope, where you can do some math to figure out the distance traveled in either x and or y, relating acceleration rate over period of time. Plus the gyroscope can tell your robot which way it is pointing. And the gyroscope/accelerometer can also tell you if your robot is tipped upside down. So basically the resultant math from the accelerometer gives you distance, that distance can be used to calculate how far you are in the xy coordinate Grid If you give it it's starting position.
jremington:
Do you have wheel encoders on your robot?
If not, an overhead video camera connected to a PC is the only option likely to work for you.
It has wheel encoders . btw I have another issue .. when i check the rpm of motors i got around 20 rpm for each motor .. if one wheel will rotate CW and others in CCW direction the robot will turn left or right .. I want to know that is it possible to calculate the angle that robot turn by using those values .
If you are just spinning the two wheels in opposite direction while maintaining the robot's center unchanged, the angle is much easier to calculate. Every encoder pulse you detect is matched to the angle of turning. If you have X encoder pulses per rotation, then each pulse indicates 360/X degrees of turning.
liudr:
If you are just spinning the two wheels in opposite direction while maintaining the robot's center unchanged, the angle is much easier to calculate. Every encoder pulse you detect is matched to the angle of turning. If you have X encoder pulses per rotation, then each pulse indicates 360/X degrees of turning.
jremington:
Of course it is possible. See this tutorial.