View unanswered posts | View active topics It is currently Thu Sep 20, 2018 6:26 am






Reply to topic  [ 9 posts ] 
How to remember/memorize a path? 
Author Message
Rookie

Joined: Fri Oct 28, 2011 11:50 am
Posts: 32
Post How to remember/memorize a path?
Hi,

I have managed to create a line follower using Mindstorms NXT 2.0 with 4 light sensors. I am interested to enhance it to remember/memorize the path it has previously travelled and subsequently repeat the path in a faster and smoother way.

However, I am at a loss on how to tackle the problem?
- how to keep track of the path?
- how to faithfully repeat the path?
- how to repeat the path in a faster and smoother way?
- how to do it with the limited memory of NXT?

Anyone with past experience can share any pointers? Thanks in advance.

Regards.


Tue Nov 01, 2011 10:29 pm
Profile
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post Re: How to remember/memorize a path?
Doing this really depends on the sensors you have available to you, but I'm going to try to answer your questions:

- Keeping track of a path can be done in many ways. You could use a compass sensor and record the heading every so many milliseconds, storing it in some variable. You'd also need to store the speed to get that to work. Another option would be to record the motor encoder in an array maybe like 10 times per second - this might be best because the encoders are built into the lego motors. One problem is that the NXT wheels are quite slippery which might throw your measurements off, especially if you're going fast).
- For the first option, it'd be quite tricky, and since I'm not sure if you have a compass sensor I'm not going to go into that too much (plus I'm kinda tired). the second option would work if you made the robot use the time frame (1/10 of a second, or however fast you make your sample rate) to get from its current encoder position to the encoder position specified in the variable. You'd need to calculate what speed it would need to travel at, too.
- You could have the "old" path weigh in with the new path, but that also really depends on how you're controlling the line following.
- To deal with the memory issue just make the robot forget whatever it doesn't need (again, this REALLY depends on how you're doing the line following, what sensors you have and what the path the robot follows looks like)

Ok hope that helped :)

If you're just looking for a way to get your robot to follow the line faster, I'd advice using a PID controller (if you already are, just fine tuning it will do the trick).

Here's some links that might also help:
A PID-controlled line follower I made (with code): http://dimastero.wordpress.com/pid-linefollower/
A great tutorial on PID line following: http://www.inpharmix.com/jps/PID_Contro ... obots.html

_________________
leonoverweel.com


Tue Nov 01, 2011 11:15 pm
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: How to remember/memorize a path?
I don't understand why you need to "record" the path and "play it back"? If the goal is to smooth out the wiggling, then like DiMastero said, you are better off using PID control because if you are recording accurately, you are recording all the wiggling too, so the play back will be not be any smoother unless you apply some sort of low-pass filter to your recorded data. Also, like DiMastero said, no matter what sensor you use, you will have cumulative errors that eventually will throw you off track. It's better to use the light sensors to make sure you are still on the line. But then, why not just follow the line again?


Wed Nov 02, 2011 1:04 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: How to remember/memorize a path?
Oops, somehow accidentally hit Submit before I finished.

I don't understand why you need to "record" the path and "play it back"? If the goal is to smooth out the wiggling, then like DiMastero said, you are better off using PID control because if you are recording accurately, you are recording all the wiggling too, so the play back will be not be any smoother unless you apply some sort of low-pass filter to your recorded data. Also, like DiMastero said, no matter what sensor you use, you will have cumulative errors that eventually will throw you off track. It's better to use the light sensors to make sure you are still on the line. But then, why not just follow the line again? If the goal is to follow the line at a faster speed, a well-tuned PID (Kp, Ki and Kd) control algorithm will give you that. For example, my line following algorithm can specify the maximum speed going forward. If the line is straight, it will go faster. If it needs to turn, it will go slower. The harder the turn, the slower the speed. Also, if your light sensor is farther ahead of the wheels, it also gives it time to slow down before the turn. In fact, since you have 4 light sensors, it will be perfect for PID because 4 light sensors will tell you how far off the line you are and that gives you the "error" in PID control.


Wed Nov 02, 2011 1:13 am
Profile
Rookie

Joined: Fri Oct 28, 2011 11:50 am
Posts: 32
Post Re: How to remember/memorize a path?
Thanks all for the replies.

No serious intention but just want to do it for fun and better understand the capability of NXT.


Sun Nov 06, 2011 12:36 am
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: How to remember/memorize a path?
I don't understand why everyone is saying that there is not much use in recording the path, as you can just use a PID loop. I think that there is some merit to this idea. If you slowly traverse around the line the first time, and record it in memory, you should be able to go around much faster and smoother the second time. If you take the shape of the line, and apply a smoothing algorithm to take care of the jerkiness of the robot, the robot will know what is coming up next, and adjust itself better to it. Sort of like a learning algorithm.

_________________
sudo rm -rf /


Sun Nov 06, 2011 9:59 am
Profile
Expert

Joined: Wed Jun 30, 2010 7:15 am
Posts: 181
Post Re: How to remember/memorize a path?
I agree that the idea is good, but the problem with it is that you'd need a lot of sensors to get a decent result. And because of sensor drift, slippery wheels, accumulative errors, etc, you'll probably never get the path exactly right. All of the data would take up a lot of space too.

So I guess it could work, but I just don't think it's worth spending so much money on if you can just use the light/ color sensor you already have and get the same (or better) results using PID.

_________________
leonoverweel.com


Sun Nov 06, 2011 10:26 am
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Post Re: How to remember/memorize a path?
magicode wrote:
I don't understand why everyone is saying that there is not much use in recording the path, as you can just use a PID loop. I think that there is some merit to this idea.

Don't get me wrong, data recording has a lot of usage scenarios and benefits. Like I said, it depends on the goal. For example, in the scenario where the robot needs to navigate through a maze, data recording allows you to look back your past history and optimize your path through the maze. But this data is not the sensor log, instead it is just recording decisions made. There is also useful scenarios for logging sensor data, usually for debugging and post processing to optimize algorithms. So again, to decide not to use a strategy doesn't mean the strategy is bad in general. It could just mean the strategy is not applicable, beneficial or cost effective to your scenario. It might still be a good idea if you come up with goals that justify the strategy.


Sun Nov 06, 2011 3:08 pm
Profile
Rookie

Joined: Tue Apr 05, 2016 12:44 am
Posts: 2
Post Re: How to remember/memorize a path?
hi buddy if u have found solution of it then pls discuss that idea cause I wanna built one too.
making a autonomous vehicle is always been my dream pls help


Sat Apr 09, 2016 12:29 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.