# Make robot move to specific location using xy coordinates

For my final project I have to have my robot go from point A to point B, the path it takes it does not matter, but it cannot be predetermined. The robot will have to avoid obstacles.

I have a basic Elegoo smart robot, and I am thinking using XY coordinates would be my best option.

What other materials do I need to make this work. I am guessing I would need some kind of compass or gps so the robot know where it is and where it must be.

If someone can point me in the right direction please, with both the coding and the materials.

Keep in mind I am a beginner! Than You

1. are there fixed bounds where robot can travel in? like a grid, 2x2m maze, etc. or is the robot

2. gps... only gives a rough proximity of where u are on EARTH. so unless your robot is moving like down the street, u cant use gps.
u could use a compass to determine robot's current orientation.

3. ur best bet is IR sensors to accurately detect obstacles. ultrasonic sensors if u just need to know if there is something infront

You've told us virtually nothing about your problem.

Try again.
Imagine we know nothing about your situation.
This shouldn't strain your imagination, because we don't.

Maybe ask the academic staff about remedial courses or modules on framing questions.

(X,Y) coordinates are an excellent choice!

If the robot is at (X1, Y1) and it must go to (X2, Y2), then Bresenham's algorithm will choose the best straight line path.

Your task at this point is to have the robot, i.e. "the materials", determine where it is in (X,Y) space at all times.

Your robot looks cool. Do you have any encoder plates for the wheels to measure the travelled distance?

Since you don't tell much about the task, I guess we are allowed to fill in things. So if you talk about A and B and they can be defined in XY coordinates, I assume we can define A as origin, the robot starts heading in the x axis direction, point B is then defined in XY coordinates. And these coordinates are typed in with some device for your robot to know.

Then you hit start and the robot starts moving. Draw on paper what happens. First a turn so the robot heads to B. Then it starts moving, keeping track of how far it goes. For both turning and moving you need to read the encoders of the wheels. Then when an obstacle comes in the way, you need to draw a path around it. Can you make assumptions of the size and shape of the obstacles? Are they walls?

GPS works if you want it to end up within about 4-5 meters of the predetermined destination, if you have a good GPS and excellent reception you can bring that down to 1-2 meters. Great if you're moving it from one end of the street to the other. Not good enough to drop a parcel on someone's doorstep, not good enough even to navigate a self-driving car along the road.

I got the impression that your robot won't travel along the street, but inside your living room. Or on the classroom floor. My approach would be "dead reckoning", which means you only know your start coordinates and direction and your destination coordinates. And you know how to rotate on spot and how to travel a given distance. The rest is high school trigonometrics.

Place your robot at A (origin) heading along the x axis. Calculate the direction and distance to B. You get an angle from the calculation. Rotate the robot on the spot (the red arc at A). Start travel (red line towards B). Travel until right distance is travelled. Or until you confront an obstacle. Scan the object. Figure out which way around to go. In the example, turn to left. Start moving in an arc around the obstacle until you have B straight ahead. Calculate how much you have to travel and continue. Repeat the obstacle avoiding procedure if needed.

Indoors, without any form of beacon or other known reference, that's indeed the way to go. However the hard part of dead reckoning (when you're basically driving blind) is accuracy: knowing exactly how far you travelled and in which direction. Errors tend to add up over time. Especially knowing your exact direction is hard.

What other materials do I need to make this work. I am guessing I would need some kind of compass or gps so the robot know where it is and where it must be.

I suppose you are given some rules. You wrote that the path can't be predetermined. Can a beacon or a reflector be placed at the target. Sure the target must be marked somehow. Colour, sound? Or as I assumed earlier, as coordinates told to the robot.