|
Page 1 of 1
|
[ 8 posts ] |
|
Obstacle Course issues, please help.
Author |
Message |
jbeagan
Rookie
Joined: Fri Oct 26, 2012 2:01 pm Posts: 6
|
 Obstacle Course issues, please help.
Good afternoon. First time using RobotC and I have some grade 8 students that are doing the Obstacle Course challenge. They have successfully written the code to make the robot move to the first "wall", use the touch senor to back up, turn and begin to use the light sensor to complet the line following behavior. They used "time" as a variable to program the robot to stop at the end of the line but it does not seem to work at all.
Does anyone know of a way, or the code, to simultaneously run a time component during line following.
Thank you very much.
I appreciate it
Josh
|
Fri Oct 26, 2012 2:06 pm |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: Obstacle Course issues, please help.
Can you explain a little bit more about what you mean by "simultaneously run a time component during line following"? Perhapse you're thinking of timers: http://www.robotc.net/wiki/NXT_Functions_Timing
_________________ sudo rm -rf /
|
Fri Oct 26, 2012 2:17 pm |
|
 |
jbeagan
Rookie
Joined: Fri Oct 26, 2012 2:01 pm Posts: 6
|
 Re: Obstacle Course issues, please help.
Thank you for replying. So the students are making the robot follow the line and they naturally want it to stop at the end of the line so they can continue the program. When it does not stop it ends up doing a 180 and then gets back on the line and follows it to the start. So they decided to time it and came up with 95000Msec (1min 30 sec) and then use the timer program. They are having issues with the timer program.
Thanks again.
|
Fri Oct 26, 2012 3:04 pm |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: Obstacle Course issues, please help.
Is this what you are looking for? The problem I see with this is that timing is not precise. So you could stop prematurely or could have reached the end of the line then turn around starting to head to start before time runs out.
|
Fri Oct 26, 2012 3:20 pm |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: Obstacle Course issues, please help.
EDIT: The documentation says (well it says contradictory things really, but I'm going with what makes more sense) that the timer values are longs not ints, so the 95,000 milliseconds shouldn't be a problem.
_________________ sudo rm -rf /
|
Fri Oct 26, 2012 3:24 pm |
|
 |
MHTS
Guru
Joined: Sun Nov 15, 2009 5:46 am Posts: 1523
|
 Re: Obstacle Course issues, please help.
According to the documentation ( http://www.robotc.net/wiki/NXT_Functions_Timing), time1 is returning long, so it is a lot more than 32K.
|
Fri Oct 26, 2012 3:26 pm |
|
 |
magicode
Moderator
Joined: Tue Sep 14, 2010 9:19 pm Posts: 496
|
 Re: Obstacle Course issues, please help.anyhting
Well, I was looking at that as well, since it seemed wrong to me, but the text said signed int. It's probably a long as that's what the function prototype says. so I'll edit my post above to reflect that.
_________________ sudo rm -rf /
|
Fri Oct 26, 2012 4:16 pm |
|
 |
jbeagan
Rookie
Joined: Fri Oct 26, 2012 2:01 pm Posts: 6
|
 Re: Obstacle Course issues, please help.
I will try both this weekend and have the kids try it on Monday. I will get back to you early next week.
Again, thank you for your input and responses. I really appreciate it.
Josh
|
Sat Oct 27, 2012 1:01 pm |
|
|
|
Page 1 of 1
|
[ 8 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
|
|