Author Topic: How to measure and control an Avoidance car's turn angle?  (Read 1021 times)

0 Members and 1 Guest are viewing this topic.

Offline laoadamTopic starter

  • Newbie
  • Posts: 3
  • Country: ca
How to measure and control an Avoidance car's turn angle?
« on: February 18, 2022, 10:25:29 pm »
Hi,
I am doing a Arduino Robot car ref. to:

https://youtu.be/4CFO0MiSlM8

my question is how to measure and control the Avoidance car's turn angle when the Ultrasonic sensor detected an Obstacle?
I don't think the HMC5883L kind of compass or even GPS module can work if in-room.
Thanks
Adam
 

Online Marco

  • Super Contributor
  • ***
  • Posts: 6966
  • Country: nl
Re: How to measure and control an Avoidance car's turn angle?
« Reply #1 on: February 20, 2022, 03:43:12 pm »
You assume the rolling surface is consistent and just send a pre-programmed amount of power to the wheel motors.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3881
  • Country: de
Re: How to measure and control an Avoidance car's turn angle?
« Reply #2 on: February 20, 2022, 04:37:55 pm »
Hi,
I am doing a Arduino Robot car ref. to:

https://youtu.be/4CFO0MiSlM8

my question is how to measure and control the Avoidance car's turn angle when the Ultrasonic sensor detected an Obstacle?
I don't think the HMC5883L kind of compass or even GPS module can work if in-room.
Thanks
Adam

Why do you think a compass (that uses magnetic field of the Earth) wouldn't work indoors? Of course it would.

However, getting a magnetometer calibrated and compensating for all kinds of errors that could occur (e.g. from pieces of metal nearby) is a highly non-trivial task.  Moreover, magnetometer alone is not suitable for measuring the orientation/turning rate of a vehicle. For that you need a gyroscope or, ideally, a full IMU system including a gyro that actually does the measurement your control system uses, magnetometer for compensating the gyro's drift in the yaw axis and an accelerometer for compensating drift in roll/pitch axes. Magnetometer and accelerometers are rarely used for this kind of job directly because they are noisy sensors, prone to picking up a lot of error caused e.g. by movement of the vehicle (accelerometer) or surrounding environment (magnetometer).

Now whether or not you need such closed loop control where you actually measure the turning rate like this instead of just going with the assumption Marco mentioned depends on your needs. For your toy robot a full IMU would be a massive overkill because you don't really care about the exact amount the robot has turned (but it likely would be a very good learning experience).

Concerning a GPS module - that wouldn't work indoors, indeed. However, even if it did (or you used it outdoors), GPS is not suitable for tracking small and rapid position changes. Even the best GPS modules have accuracy in meters (+-3m being typical)  and slow update rate (1Hz being typical). That's OK for navigating a car or flying a drone into the general vicinity of some waypoint but not for what you want to do.
« Last Edit: February 20, 2022, 04:44:55 pm by janoc »
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 6756
  • Country: ro
Re: How to measure and control an Avoidance car's turn angle?
« Reply #3 on: February 20, 2022, 04:54:58 pm »
Nice robot!   :-+

Another way to measure how much the robot turned on a slippery floor would be to put a mouse sensor underneath.  Old PS/2 mice are very easy to read with a microcontroller.  If a PS/2 mouse is hard to source, another way could be to use a cheap USB mouse, but with a known optical sensor (by known I mean a sensor with available datasheet and online docs about how to read it), and to read only the sensor data.

A mouse sensor is nothing but a low resolution video camera (something like 16x16, 64x64 or so video pixels), so if the robot has a camera, you may try to use the pixels from the incoming video instead of attaching an optical mouse to the robot.  The algorithm used by an optical mouse is sometimes called "optical flow" detection, if you want to search more about it.
« Last Edit: February 20, 2022, 04:59:07 pm by RoGeorge »
 

Online Someone

  • Super Contributor
  • ***
  • Posts: 4981
  • Country: au
    • send complaints here
Re: How to measure and control an Avoidance car's turn angle?
« Reply #4 on: February 20, 2022, 08:34:37 pm »
Concerning a GPS module - that wouldn't work indoors, indeed. However, even if it did (or you used it outdoors), GPS is not suitable for tracking small and rapid position changes. Even the best GPS modules have accuracy in meters (+-3m being typical)  and slow update rate (1Hz being typical). That's OK for navigating a car or flying a drone into the general vicinity of some waypoint but not for what you want to do.
DGPS + RTK ends up with 10Hz (or faster) cm accuracy, good enough to drive vehicles/robots around with. The GPS heading is a derivative and rather noisy, but with appropriate filtering that matches the dynamics of the platform it all works out ok.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3881
  • Country: de
Re: How to measure and control an Avoidance car's turn angle?
« Reply #5 on: February 21, 2022, 09:00:36 pm »
Concerning a GPS module - that wouldn't work indoors, indeed. However, even if it did (or you used it outdoors), GPS is not suitable for tracking small and rapid position changes. Even the best GPS modules have accuracy in meters (+-3m being typical)  and slow update rate (1Hz being typical). That's OK for navigating a car or flying a drone into the general vicinity of some waypoint but not for what you want to do.
DGPS + RTK ends up with 10Hz (or faster) cm accuracy, good enough to drive vehicles/robots around with. The GPS heading is a derivative and rather noisy, but with appropriate filtering that matches the dynamics of the platform it all works out ok.

And you think someone is going to set up a DGPS base station and get a DGPS-capable module for an Arduino toy robot, right?  :palm: That thing would cost more than the entire robot - and then some.

Also, centimeter resolution is not really enough if you want to measure rotation change/rate on a small robot like this. That would be extremely inaccurate, even if you feed it into some sort of filter.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3327
  • Country: gb
Re: How to measure and control an Avoidance car's turn angle?
« Reply #6 on: February 21, 2022, 09:48:06 pm »
How about a gyro?
 

Online Someone

  • Super Contributor
  • ***
  • Posts: 4981
  • Country: au
    • send complaints here
Re: How to measure and control an Avoidance car's turn angle?
« Reply #7 on: February 21, 2022, 11:06:28 pm »
Concerning a GPS module - that wouldn't work indoors, indeed. However, even if it did (or you used it outdoors), GPS is not suitable for tracking small and rapid position changes. Even the best GPS modules have accuracy in meters (+-3m being typical)  and slow update rate (1Hz being typical). That's OK for navigating a car or flying a drone into the general vicinity of some waypoint but not for what you want to do.
DGPS + RTK ends up with 10Hz (or faster) cm accuracy, good enough to drive vehicles/robots around with. The GPS heading is a derivative and rather noisy, but with appropriate filtering that matches the dynamics of the platform it all works out ok.

And you think someone is going to set up a DGPS base station and get a DGPS-capable module for an Arduino toy robot, right?  :palm: That thing would cost more than the entire robot - and then some.

Also, centimeter resolution is not really enough if you want to measure rotation change/rate on a small robot like this. That would be extremely inaccurate, even if you feed it into some sort of filter.
Works fine on small platforms like that, since the OP is asking about short term positioning and not long term accuracy/drift they don't need to have valid corrections from a stationary receiver. As I said:
The GPS heading is a derivative and rather noisy, but with appropriate filtering that matches the dynamics of the platform it all works out ok.
Sensor fusion is a wonderful thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf