|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#4
|
|||
|
|||
|
For someone who's claiming to not know what they're doing, you're asking all the right questions and definately on the right track. Here's the PBASIC translation of what you're trying to do (although it's the old PBASIC, not this mystery new version that would make life so much easier):
' start with init code and serin statement. this goes in the main loop ' delcare variable; since this isn't tranferred from ' anywhere, you don't need to define a constant motor_fwd var word desired_on_time con 200 ' whatever you want... if motor_fwd > desired_on_time then no_motor PWM1 = 255 PWM2 = 255 ' this may need to be zero if your motors have reversed polarity motor_fwd = motor_fwd + 1 no_motor: ' continue with other code here and serout Ok, enough program. Now for the explanation. You can't have your own loop, because then you wouldn't be sending data out to change the motor outputs. You have to make your code able to be called repeatedly, rather than once. I hope I'm not being too condescending, but this is a good metaphor: imagine you have a function that is called once a frame for every frame in a movie. The function can't just sit there and run, it has to move the actors around on the screen just a little bit and then wait for the next frame. And yes, you definately can simulate this on last year's controller. Last year's hardware doesn't have support for autonomous mode, but you can accomplish the same thing by just ignoring all user input in the program. My team has done experiments on past years' robots to make them perform a variety of motions. A word of warning: when you first begin testing your code, don't set the outputs to maximum... an out of control robot with the pedal to the metal is dangerous This warning courtesy of my formerly-bruised leg.EDIT: Serves me right for taking such a long time to write a reply... there weren't any when I started writing Anyways, nested loops don't matter. The only thing the robot controller ever knows about what goes on inside your program is the input and output. As long as it arrives on schedule, it's happy.Last edited by Ryan Meador : 05-01-2003 at 19:43. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What Should Be Done With Autonomous? | xavior06 | FRC Game Design | 91 | 28-04-2005 19:00 |
| How do you approach your animation? | Koko Ed | 3D Animation and Competition | 7 | 27-01-2003 21:42 |
| Autonomous Period | Andy Grady | General Forum | 73 | 20-01-2003 21:34 |
| EduRobot autonomy | dlavery | Robotics Education and Curriculum | 3 | 02-12-2002 10:08 |
| Proactive approach to scoring dilemmas | reisser | 3D Animation and Competition | 0 | 02-07-2002 21:54 |