|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#14
|
|||
|
|||
|
Re: Despite what IFI says, you can configure autonomous from OI...
Quote:
We handled our relays slightly differently. Since there are several different ways of controlling solenoids using a relay (2 singles on 1 relay -- M+ to GND and M- to GND, 1 single on 1 relay -- M- to M+, 1 double on 1 relay M+ to GND and M- to GND) we made a function to hide the implementation. Our relays are #defined as just numbers (1-9), we have #defines for each function, and we have a SetRelay function which handles all the setting of relays. For example: #define BALL_GRABBER 1 #define BALL_GRABBER_OPEN RELAY_REV #define BALL_GRABBER_CLOSED RELAY_FWD SetRelay(BALL_GRABBER, BALL_GRABBER_OPEN); (Or a little more accurately) ballGrabberState = BALL_GRABBER_OPEN; SetRelay(BALL_GRABBER, ballGrabberState); In this example ball grabber is a double solenoid on 1 relay. If we wanted to change it to a single solenoid all we have to do is change the #defines for the 2 ball states to RELAY_OFF and RELAY_FWD / RELAY_REV. If we wanted to move it to relay 2 all we have to do is change the BALL_GRABBER #define. That way not only does the code document the electronics, it is also easy to update should the electronics change in some major way. By the way Alex, I'm pretty sure we left all the original ifi aliases intact, even for the OI. The autoProg bits are just #defined on top of the other alises. |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A better autonomous method.. | randomperson | Programming | 4 | 24-02-2004 18:02 |
| IFI Loader Problems | BrendaB | Programming | 3 | 24-01-2004 22:45 |
| variable? | manodrum | Programming | 11 | 01-04-2003 17:20 |
| autonomous mode problem on field | Chris_C | Programming | 17 | 26-03-2003 19:11 |
| Autonomous Kill Switch | UCGL_Guy | Programming | 8 | 15-01-2003 17:39 |