How do i move a robot to a certain coordinate?

You're mixing up the two. A magnetometer has a fixed orientation - the earth's magnetic field. That's also why you use them.

fawaris:
Regarding the Magnetometer, i also found an accelerometer, and both of them exist on 1 sensor called IMU Sensor. Can I just use the accelerometer alone or do I also need the magnetometer for this job?

With the magnetometer you can work out how you are oriented with respect to the earth's (fixed) magnetic field i.e. you can work out which way you are facing.

Knowing which direction you are facing will help, but you also want to know how far you have travelled in that direction. You can do this using encoders for your motors.

bms001:
With the magnetometer you can work out how you are oriented with respect to the earth's (fixed) magnetic field i.e. you can work out which way you are facing.

Knowing which direction you are facing will help, but you also want to know how far you have travelled in that direction. You can do this using encoders for your motors.

Can I use accelerometer instead of encoders? instead of measuring the speed of my motors, i just measure the distance travelled.

Technically yes, but with any reasonable degree of accuracy no (to my knowledge).

Use encoders.

Encoders will not give you very precise position measurement due to small slippages of the wheels and due to differential movement during a turn. The errors will accumulate and in a relatively short period of time will become some great that the system is useless.

You really need some external reference point that you can use to remove any errors that may build up. One way to do that may be to triangulate on 3 LEDs in the same way that ships can establish their position using lighthouses.

...R

Robin2:
Encoders will not give you very precise position measurement due to small slippages of the wheels and due to differential movement during a turn. The errors will accumulate and in a relatively short period of time will become some great that the system is useless.

Although encoders will not be perfect, I would suggest that encoders (+mag) will give a 'reasonable' estimate. Whether my judgement of 'reasonable' is in line with requirements or not, I have no idea.

It would help to know:
How far the robot has to move each time?
Does it really need to do obstacle detection?
How often will it be re-zeroed?
What surface is it on?
What kind of robot is it? Wheel arrangement etc. (I assume it uses wheels but even this information has not been provided)
How much error is acceptable?

Robin2:
Encoders will not give you very precise position measurement due ... differential movement during a turn...

I'm not sure about this. Or at least, I'd say the error is coming from the integration rather than the turning, which can be reduced by calculating the wheel velocities and distance travelled/angle turned as frequently as possible. But as long as you know the separate wheel velocities you can calculate how much the robot has turned (even if it is trying to go in a straight line).

Of course over time if there is no way to correct drift then the error will keep increasing.

bms001:
Of course over time if there is no way to correct drift then the error will keep increasing.

This is the problem I was referring to. I suspect the time will be significantly shorter than the OP would like.

And I suspect it will be very difficult to get more than a rough estimate of the actual path traveled while turning.

...R

bms001:
Although encoders will not be perfect, I would suggest that encoders (+mag) will give a 'reasonable' estimate. Whether my judgement of 'reasonable' is in line with requirements or not, I have no idea.

It would help to know:
How far the robot has to move each time?
Does it really need to do obstacle detection?
How often will it be re-zeroed?
What surface is it on?
What kind of robot is it? Wheel arrangement etc. (I assume it uses wheels but even this information has not been provided)
How much error is acceptable?
I'm not sure about this. Or at least, I'd say the error is coming from the integration rather than the turning, which can be reduced by calculating the wheel velocities and distance travelled/angle turned as frequently as possible. But as long as you know the separate wheel velocities you can calculate how much the robot has turned (even if it is trying to go in a straight line).

Of course over time if there is no way to correct drift then the error will keep increasing.

Sorry I haven't mentioned these details before.

  1. For now we are considering the maximum area to be 1m x 1m.
  2. Initially there won't be obstacles but later on (few mins later) there will be some obstacles.
  3. The surface is not a problem since we can choose whatever surface we want so the concept of slipping wont be a problem.
  4. The robot is actually using tracks not wheels which will reduce slipping even further.
  5. Regarding error, I'm not sure how much it is but I can say this, not more than 0.5cm. hopefully you can understand this. but regarding accumulative error, the robot will only work for few mins, max 5-7 mins. so i would assume we can neglect the accumulative error for now just to be able to demonstrate it atleast.

Robin2:
This is the problem I was referring to. I suspect the time will be significantly shorter than the OP would like.

And I suspect it will be very difficult to get more than a rough estimate of the actual path traveled while turning.

...R

Ye as i mentioned above, the robot is gonna work for a maximum of 5-7 mins (MAX) for now that is.
I do agree that turning is gonna be the difficult part but I'm hoping i can manage to turn it accurately since I'm using tracks instead of wheels which gives me the advantage of smooth rotation.

Gonna complete the project soon and will post my results as soon as I do. Wish me luck :slight_smile:

Thanks to everyone who tried to help.

fawaris:
4) The robot is actually using tracks not wheels which will reduce slipping even further.

Did you ever closely observe how a tracked vehicle makes a turn?

It's all about slipping. That's how a tracked vehicle makes a turn, and can actually turn on the spot (have one track go forward, the other backward).

  1. Regarding error, I'm not sure how much it is but I can say this, not more than 0.5cm. hopefully you can understand this. but regarding accumulative error, the robot will only work for few mins, max 5-7 mins. so i would assume we can neglect the accumulative error for now just to be able to demonstrate it atleast.

It may work...

  1. go only dead straight, measure distance (encoders on both tracks to make sure you actually go dead straight).
  2. stop to make turns - use a magnetometer to have an idea of where you're heading.
  3. make turns on the spot: turn one track back by as much as you turn the other forward and you should just be turning without leaving the spot.

1) For now we are considering the maximum area to be 1m x 1m.
Good

2) Initially there won't be obstacles but later on (few mins later) there will be some obstacles.
Bad. Maybe very bad because if you touch an obstacle, it will cause the robot to wander even further.

3) The surface is not a problem since we can choose whatever surface we want so the concept of slipping wont be a problem.
No, slipping will be a problem. Wheels require slip. No slip = no traction.

4) The robot is actually using tracks not wheels which will reduce slipping even further.
As wvmarle pointed out, this is much much worse.

5) Regarding error, I'm not sure how much it is but I can say this, not more than 0.5cm. hopefully you can understand this. but regarding accumulative error, the robot will only work for few mins, max 5-7 mins. so i would assume we can neglect the accumulative error for now just to be able to demonstrate it atleast.
No. If you tried to use accelerometers to integrate position like the suggestion in #22 then the errors in this time period are KILOMETERS for consumer-grade equipment. Wheel encoders may get to this level of accuracy with some work.

If it's a 1x1m box then there's lots of things you can do. Paint each wall a different color and use a color sensor to decide what direction you're pointing. Paste a printed barcode on each wall and use an optical sensor to read the coordinates off the wall. Put ultrasonic distance sensors in the corners so the box knows where the robot is.

Come to think of it, a magnetometer on the robot (for orientation) and an ultrasound range finder (for distance to nearest wall) should give a very good indication of where you are in an enclosed box.

Presence of obstacles will throw off this range detection of course, and with all the twists and turns you have to make to get around them you're going to lose location and direction very fast.