I am in need of help with a presumably (and hopefully) very easy program. I am part of a FTC robotics team and am having trouble with an autonomous program. I wish to write a program that has the robot drive forward turn 90 degrees, drive forward, turn once again then continue forward and stop. However I also wish to have it searching for the IR blaster thing. Once it registers 5, it needs to pause the simple drive program and run another task, once that task is completed, it needs to resume the first task and continue driving. I know this seems complicated but anyone who knows he FTC block party competition will under stand what is happening.

That sounds great, here's one of the programs we've been working with, although they're all pretty much the same, aside from experimentation with using the IR signal power outputs (5 zones) from the HiTechnic seeker as opposed to the directional outputs (9 zones) that we're using in this program.

We were also wondering about being able to pause a task (that would be driving forward) and running another task within the program that triggers when certain conditions are met (i.e. the seeker value = 5), then resuming the original task afterwards. We're using NXT bricks, I don't know whether or not that makes a difference.

Fri Jan 31, 2014 10:45 am

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: RobotC and IR seeker help

Task is not necessary. You just need to arrange the code such that it can monitor the right thing at the right time. First, write down the high level pseudo-code step by step on how the robot should behave.0. Walk forward to seek the IR beacon.1. Stop and dump the block.2. Walk forward for 10 seconds to get out of the way.3. Done, stop everything.

Rearranging your code and adding a state machine would yield the following:

For step 1 (dumping the block), we could break it down to more steps and using timer T1 instead of using wait1Msec(). Generally, we don't use any loops nor any wait1Msec statements in the state machine so the state machine can monitor multiple sensors/events if necessary. I will leave that for you as an exercise.

Thanks, This seems to work better than what we had; however, I still have no idea how to make then all stop in the same position before the task completes. Here's what we have now and it only works because it very slowly pushes against the wall.

All I could think of using is a proximity sensor but it seems unnecessary. Is there a timer option that kills the task at a particular point every time.

Thanks

Thu Feb 06, 2014 4:06 pm

BurningLights

Professor

Joined: Sat Aug 31, 2013 9:15 amPosts: 256

Re: RobotC and IR seeker help

If I'm understanding you correctly, the problem you are having is that your robot will keep executing code when you want it to be done. Is that correct? To stop your program from executing the last step over and over again, you can put step++ at the end of it. Although, I'm still not sure why your motors would still be moving. It's your drive wheels that keep going, correct?

What I'm trying to say is, after the IR sensor senses the beacon, it stops driving and runs the second set. The issue is there are four possible locations in a line for the basket (as you probably know), we need the robot to stop in the same place no matter where the beacon is located. The part of the code is in case 2. We need this to be different depending on where the beacon is located. I hope this makes sense.

Instead of using time, you need to read the encoders to determine how far you have walked so far and how far you need to go further to clear the pendulum. If you don't have encoders on your wheels, then it is a little tougher. One way to do it is to use time to determine how long you have been walking to the IR beacon so you know how much longer you need to walk to clear the pendulum. But note that timed drive is very inaccurate and not very repeatable.

Thu Feb 06, 2014 8:41 pm

kcasi231

Rookie

Joined: Tue Jan 28, 2014 11:06 pmPosts: 8

Re: RobotC and IR seeker help

Hi, thank you all a lot, our IR is now working almost entirely (just a few last tweaks are needed). We do, however, have one more minor problem. It doesn't actually affect functionality (usually) and probably belongs in a different forums, but maybe someone on this one has seen something like it before. When running a round with the Samantha Field Control System (Samo FCS), after the teleop period has concluded, our FCS always stops responding for about 20 seconds, then gives the message "Unrecoverable error attempting to open Matchlog.csv" within the program. After clicking the only option, "Okay," the FCS disconnects our robot, but we're able to reconnect and run another round easily. This is simply an annoyance, and if nobody has encountered something like this before, it doesn't really matter enough to deserve significant effort, but any help would be appreciated. We tried contacting the developer of the software, and they didn't get back to us. Thanks!

Who is online

Users browsing this forum: No registered users and 2 guests

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