|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
autonomous sensor programming ?
We're trying to use three sensors to track the white line in the autonomous mode. We're using 1 joystick drive. Our left sensor is on rc_sw1, pin 1, our middle sensor is pm rc_sw2, pin 2, and the right one is on rc_sw3, pin 15. I have tried lots of different things, but since I don't really understand what I'm doing I haven't accomplished anything remotely useful, and I have managed to completely confuse myself. If anyone has any suggestions as to how to get these sensors to recognize the tape and turn and basically just WORK, I would be thrilled.
|
|
#2
|
|||||
|
|||||
|
What you should do in instances like this is write psuedo-code in english. You should try this:
If the middle sensor is on, then I want to go straight. If only the left sensor is on, then I want to turn left. If only the right sensor is on, then I want to turn right. If no sensors are on, then spin in a circle. Now, go on to write your code: If (rc_sw2) then gostraight If (rc_sw1)&(rc_sw3 = 0) then turnleft If (rc_sw3)&(rc_sw1 = 0) then turnright goto turnleft gostraight: p1_x = 127 p1_y = 200 'random forward speed, should be tested on bot goto restofcode turnleft: p1_x = 84 p1_y = 127 goto restofcode turnright: p1_x = 200 p1_y = 127 restofcode: ... ... ... serout ... |
![]() |
| 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 |
| Electrical componenets for autonomous navigation | maclaren | Electrical | 10 | 18-12-2003 02:28 |
| crazy idea for autonomous | Mike Ciance | Programming | 16 | 24-04-2003 21:50 |
| 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 |