Needing Some Help

Discussion specific to projects ideas and support.
Post Reply
kirksdad
Posts: 3
Joined: 26 Jan 2011, 16:10

Needing Some Help

Post by kirksdad »

I am not sure if this is the place to discuss this, but I am having a problem with figuring out a program with the following task. It is an event called Speed Limit and I am at a loss, I wish I had more insight to the programming, but am trying my best in a middle school class to get as much accomplished as possible. We didn't even try this last year because we had absolutely no idea how it ran and to listen to the event coordinator there was only one out of about 60 schools that were even able to accomplish it. All I would like is some ideas on how it might work, not a program.
This event requires that the robots race-while obeying a speed limit. There will be lines on the race track. Students will be given the target speed limit at the start of the competition in terms of # of lines / # of seconds (the maximum speed the robots will be required to achieve will be less than 0.2 m/s). Students will NOT be allowed to measure the length of the track or the distance between lines! Their robots must try to match the target speed limit, which could be 1 bar / 1 sec for example. The bars may not be equally spaced for the duration of the entire track (see figure below). The robots must also not drift off the track in the lateral direction (the track will be ~3 m long and ~0.75 m wide). The robot which traverses the track in the time closest to the time corresponding to the target speed limit and line pattern will win. The track will look like the following

_______
_______
_______

_______

_______

_______

_______
_______
_______

The idea is to get it to move smoothly between lines only taking 1 second between and showing that the robot adjusts for different distance to that second. I am an old man working with 13 year old's in a rural school, I am just wondering if anyone has an idea?
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Needing Some Help

Post by hassenplug »

We should highlight this as an example of "how to ask for help." Well done. :)

The more I think about it, the more I think this is a cool challenge.

I'll ignore, for a second, the stipulation that the robot not drive off the track. Assuming the track is straight, they simply want to make a robot that is not able to turn.

Now, for the speed. It's pretty straight-forward. The time between lines, controls the motor speed (power). greater time = more speed. The NXT has timers to calculate the time, and the speed should be directly proportional to the output of the timer.

The big trick is to realize that any ratio they give you can be converted to seconds between bars, or seconds per 1 bar. ie: 3 bars/sec = .33 sec/bar. That means the current motor speed is based ONLY on the time between the last two bars, and the speed between those bars.

Another option which may be even easier would be to use the encoders to calculate the distance between bars, and again base the speed on that value. This may take some trial-and-error to find out the right values to convert from sec/bar.

note: make sure the robot does NOT count a single line, more than once. This would be something to think about, if it doesn't work as expected. Keep in mind, at different speeds, the time to totally pass a line will change.

Also, if they want to make the software very cool, it should NOT require them to connect to a PC, to enter the bar/sec value.

If this doesn't give you enough info (trying not to totally lay out the answers), feel free to come back and ask for more info.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
kirksdad
Posts: 3
Joined: 26 Jan 2011, 16:10

Re: Needing Some Help

Post by kirksdad »

When they give you the task, I am not sure if they give you the distance between the lines, or if you are able to calculate them the day you do the task. That is the thing I am confused with. I am thinking they will be doing the same thing as last year since there was no success with the task. It seems they want the robot to adjust without knowing what is the distance between the lines, does that sound reasonable? I am guessing that you would have to loop the light sensor to a timer that is going to be able to adjust between lines. This is were I go a little bonkers in trying to figure out how to wire it up. Although I have tried to use the sensor to line follow smoothly, the math expected of 13 year old's is a little crazy, although I try. I really appreciate your help it gives me a lot to think about and try. This is just one that I feel I just need some guidance on, not just giving me the program because it does us little good to just copy a program without doing it, never learning to keep trying even though we fail at times, but being able to try things and ask questions.
nxtreme
Posts: 246
Joined: 29 Sep 2010, 03:53
Location: 192.168.1.2

Re: Needing Some Help

Post by nxtreme »

To keep your robot going straight you could one (or all three*) of these ideas. My first idea is to use a compass. HiTechnic makes a compass that would work. However, this does have added cost and fine tuning problems. My second idea is to use two light sensors, one on either side of the front of the robot. When you reach a line and the robot isn't going completely straight, one of the light sensors would detect the line first. The time between both sensors detecting a line could be used to decide how sharp to turn to get going straight. With some trial and error testing you could make it work fairly reliably. Or, third option is just to have the wheels of the robot locked up so that it would go in a straight line no matter what. I hope this helps!

*-EDIT- After actually putting a little brain power into it, I discovered that option three wouldn't work together with option one and two :oops:.
One King to rule them all, One King to find them,
One King to bring them all and in the darkness bind them
On Earth where Shadows lie.
kirksdad
Posts: 3
Joined: 26 Jan 2011, 16:10

Re: Needing Some Help

Post by kirksdad »

Thanks, we use the tribot and I am thinking there isn't going to be much to worry about when it comes to keeping the machine straight, the problem comes with having to figure out the wiring for keeping the time between lines in order. I figure if you loop it with the light sensor, timer and motor you should be able to wire it so that it will vary >< when it comes to the robot sensing the distances <>.
tgriffin62
Posts: 6
Joined: 05 Dec 2010, 01:12

Re: Needing Some Help

Post by tgriffin62 »

This seems like a very interesting but fairly difficult challenge. If I understand your description correctly, you don't know how many lines there are, or the spacing, and the spacing is not consistent. Given these conditions, I think you have to work out an algorithm that will get you close to the correct timing by using a little guess work.

If you want the robot to move smoothly (not pausing to let some time pass) you can start off at an average speed. Use a timer so you know how much time has passed and then as you pass a line you can adjust the speed so that you approach the correct average time per line, assuming that the distance to the next line is the average distance between the lines you've seen so far. This could work well if there are enough lines and they are at least somewhat evenly spaced. If the lines are very uneven then it might not work so well.

If you allow the robot to pause you can take a slightly different approach. Start off a little fast and then when you get to the line pause so that the timing is correct for that line. As you encounter lines you can either pause to make the timing work out if you get there early, or move quicker to the next line. As the program runs you can keep track of the average distance between the lines and use that as a guess for how long is should take to get to the next line. One important point is that it is the last line that is the big problem. As long as you get to the second to last line early you can pause to take up the extra time. But since you don't know which line is the last one you just have to keep refining your guess as the program runs.

I sure there are other approaches that could do well, and which works best will depend on the exactly layout of the lines. Good luck and let us know how you do.

Terry Griffin
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Needing Some Help

Post by hassenplug »

kirksdad wrote:When they give you the task, I am not sure if they give you the distance between the lines, or if you are able to calculate them the day you do the task. That is the thing I am confused with.
No, I'm sure they won't give you this information. But, the robot should easily be able to calculate that. In fact, that should be your first challenge to the kids. Have the robot calculate and display the distance between bars. It's a major step towards solving the challenge.

A) Put three bars, have the robot start before the first bar, and display the distance (in degrees) between the second and third bars.

B) Challenge #2: Display the time of the robot between bars 2 & 3 at different motor powers. (more than one attempt)

C) Now they should be able to calculate the speed, in degrees per second, at different powers. The graph of this should be a pretty straight line (another good assignment) meaning the motor power is directly proportional to the speed, in degrees per second.

D) Here's where it gets tricky. They've been given a target bars/second, and have to adjust the speed based on degrees/bar. The bars should cancel, basically giving them degrees per second, which should match the graph from (C).

I'd suggest you let them play around with A, B, and C, while you contemplate D.

Of course, you still need to be able to validate if their robot is working correctly. I just realized that shouldn't be too hard to estimate, but I'm not sure how accurate the competition will.

Given that the course is 3 meters long (actually, the course length doesn't matter), you should simply be able to count the lines, and figure the average speed, and total time. So, if they say the speed is 1 bar per second, and the course has 6 bars (that's 5 bars after the starting line) the robot should take 5 seconds, after is passes the starting line.

Not sure if all that makes sense, but hopefully, it will give you a couple challenges to help get to the final goal.

Steve
---> Link to lots of MINDSTORMS stuff under my picture --->
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests