3
$\begingroup$

I want to steer a RC car in a straight line.The car has 4 sharp IR sensors on each corner of the car to help it steer the corridor.The corridor is irregular and looks something similar to the picture below.

The car needs to be stay exactly at the middle(shown by lighter line) and take help of the IR sensors to correct its path.

The car has a servo on the front wheel to steer and another that controls the speed.

I tried running it using a algorithm where it summed the values on each side of the car and took the difference.THe difference was then fed to a pid control the output of which went to steer the car.The greater the value from the pid (on either sides), the greater the value of the steering angle till it reaches the middle.

It works for the part where the walls are at similar distance from the center and even then it oscillates a lot around the center and fails miserably around the bumps in the corridor.

I need to make changes to the algorithm and need some help in steering me in the right direction.

The IR sensors are too finicky and is there a way to filter out the noise and make the readings more stable?

Any help regarding the changes that needs to be implemented is much appreciated.

Currently the car only uses 4 IR sensors to guide.I can also use 2 ultrasonic sensors.

enter image description here

$\endgroup$
  • $\begingroup$ It would help to know more about your setup. Does your robot have other sensors? Do you have a map of the environment? Do you have a model of how your control inputs effect the state of your robot? $\endgroup$ – DaemonMaker Oct 24 '13 at 22:59
  • 1
    $\begingroup$ Welcome to Robotics Stevelrwin, that's an interesting question. I don't have enough knowledge of the techniques to answer properly, buy you might want to read up on Kalman Filters. See the Kalman Filter Wikipedia page and question in the kalman-filter, imu and navigation tags. The important thing here is that the walls are parallel to the path you want to take and you should be able to follow them if you disregard the step changes (bumps) and missing data (side passage). $\endgroup$ – Mark Booth Oct 24 '13 at 23:18
  • 3
    $\begingroup$ Based on the image you have, I'm unclear as to how the robot is expected to know the "correct" path (the center line) when it passes the corridor followed immediately by the recessed wall at the bottom of the map. Without a compass, how do you expect to tell the difference between a change in wall depth and a change in orientation? $\endgroup$ – Ian Oct 29 '13 at 0:11
2
+50
$\begingroup$

If you have a map, then you can use a Kalman filter with a motion update based on odometry and a sensor update based on the actual IR sensor readings and the expected sensor readings given your current position and the map. The PID control you implemented will only be able to make the vehicle drive in the actual center of the hallway, which would be a curved path based on the bumps in the hallway.

HOWEVER, the simplest things you should try are as follows: 1) Implement an averaging filter on the IR sensor readings...aka take the average of n IR readings as the input to your control algorithm. This simulates a low pass filter and can eliminate high frequency noise. 2) Implement a threshold filter on the IR sensors...if the readings are greater than some range value, then DON'T use that sensor in your control loop. Combined, an averaging filter and threshold filter should mean that your PID loop is only controlling to the center of the walls that you want. In the image below, the algorithm would only control based off readings from the red walls, ignoring any readings from the black walls. If you don't find any walls within your range threshold (i.e. the hallway is open on both sides, you can try just maintaining your current heading).

enter image description here

$\endgroup$
  • $\begingroup$ Hey Steve, if you're the one that voted up my answer, please select it as the accepted answer. Thanks in advance. $\endgroup$ – Andrew Capodieci Oct 30 '13 at 19:54
1
$\begingroup$

You could have it keep track of the last distance read from the IR sensors and if it changes more than a certain amount (2%? not sure what would work for you) calculate the difference between the measured distance and the expected distance. Save that difference as an offset, which you apply to the reading from that IR sensor until it returns to normal. If the sensor reads 'infinity' you could ignore the actual reading entirely and just give the PID loop the "expected" value. This is entirely untested.

$\endgroup$
0
$\begingroup$

I had problems with servo jitter and power surges when the motors where running which reset the Arduino I was uisng. I sorted the problem by using capacitors on my servo & main power rails. My thinking is that you have the same type of noise affecting the IR sensors. Take a look at these posts on Let's Make Robots which should help you track down the source of the noise.
http://letsmakerobots.com/node/23297
http://letsmakerobots.com/node/5549
http://letsmakerobots.com/node/3880

If you use the ultrasonic sensors there is a good library for the Arduino called NewPing which has good function within as it can be set a maximum distance to scan for. So if you know the width of the corridor you could half it then set a flag when reading within or outside that range

$\endgroup$
0
$\begingroup$

This is a new interpretation of Grey Walter's Tortoise.

http://en.wikipedia.org/wiki/William_Grey_Walter

Try a BEAM robotics approach of a very simple control system that reacts to nearing obstacle by steering the opposite direction. Look at a subsumption / augemented finite state machine (enter link description here) to layer the higher goal of driving onto near term obstacle avoidance.

This is a solved problem. But I caution you to consider bumper switches as well in case the reflectant geometry misses nearby objects to give you another layer of safety.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.