|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Can someone help me with the autonomous programming? I am a rookie programmer.
![]() |
|
#2
|
||||
|
||||
|
Could you please be more specific. Programing in autonomous mode is exactly the same as programing normally, except you have to tell the robot to move instead of waiting on sensor input for operator.
If you need any more help post a reply here or PM me or email me @ info@lightningrobotics.com . |
|
#3
|
||||
|
||||
|
I'm guessing you want to know how to start. Well, granted, I am a rookie, but I have learned a lot.
1.Make a main subroutine and an autonomous subroutine If auton_mode = 0 then Skip_Autonomous Gosub AUTONOMOUS ' Jumps to subroutine for autonomous movement ' Goto NEXT_SCAN Skip_Autonomous: Gosub Normal_operation ' Jumps to subroutine for normal operation ' NEXT_SCAN: Or something like that in between Serin and Serout 2. Write pseudocode for how you want the robot to behave If sensor1 is lit, turn left If sensor 2 is lit, go straight if sensor 3 is lit, turn right 3. Be sure not to mess up any of your other code |
|
#4
|
||||
|
||||
|
Or the PBasic 2.5 version
If auton_mode = then gosub AUTONOMOUS ' Jumps to subroutine for autonomous movement ' else Gosub Normal_operation ' Jumps to subroutine for normal operation ' endif Basicly the same as 2.0 but looks nicer and is easier to code. |
|
#5
|
||||||
|
||||||
|
Quote:
Code:
IF auton_mode=1 THEN GOSUB autonomous ELSE GOSUB normal_operation --Rob |
|
#6
|
|||
|
|||
|
Thank you for the information on the autonomous mode. Now, can anyone help me out with delta_t? How do I get a reading from it so I can time our robot?
Hey Rob, Have you gotten those rpms yet? As always, no rush. ![]() |
|
#7
|
||||||
|
||||||
|
For delta_t stuff, check out http://www.chiefdelphi.com/forums/sh...threadid=16994.
As for the rpms, I just sent you some stuff. Let me know whether or not it works. --Rob |
|
#8
|
|||
|
|||
|
Example of Autonomous Code
Here is an example of some autonomous code that works. You are welcome to use it as you see fit. Hope this helps.
If comp_mode = 0 then Relay_Control 'Competition Control is disabled Out7 = 0 'Basic Run LED off when Competition Control disabled Goto End_Control Relay_Control: 'Competition Control is enabled relay3_fwd = rc_sw3 'Air compressor on when pressure switch closed - Green relay3_rev = 0 'Disable Relay 3 reverse function relay8_fwd = 1 'Rotating light on when Competition Control not disabled - Green relay8_rev = 0 'Disable Relay 8 reverse function If auton_mode = 0 then Oper_Control 'Game is in Autonomous Robot Control Period Out7 = 1 'Basic Run LED on during Autonomous Robot Control Period 'ADD OTHER AUTONOMOUS CODE HERE Goto End_Control Oper_Control: 'Game is in Operator Control Period Toggle 7 'Basic Run LED flashes during Operator Control Period relay1_fwd = p1_sw_trig 'Left Index - Lower Left Arm - Green relay1_rev = p1_sw_top 'Left Thumb - Raise Left Arm - Red relay2_fwd = p2_sw_trig 'Right Index - Lower Right Arm - Green relay2_rev = p2_sw_top 'Right Thumb - Raise Right Arm - Red End_Control: |
|
#9
|
|||
|
|||
|
What is the autonomous code, and where do we connect the sensors up at?
|
|
#10
|
|||||
|
|||||
|
Quote:
Quote:
I'm assuming that by "hook the autonomous mode up to robot.(to work)" you mean how does one simulate autonomous mode. You should go to this schematic to build a dongle for autonomous mode. |
|
#11
|
|||
|
|||
|
Now, can anyone help me with programming SPIKEs for the pneumatics?
|
|
#12
|
||||
|
||||
|
Programming spikes is extremely simple. First find out what port the spike is on and go to your code.
To make a spike go forward relay1_fwd = 1. To make it go backward relay1_rev = 1 . Always remember to set the opposite direction you are using to zero. If you want to stop the relay all together set both variables to zero. Change the number after relay to the port you are using. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Programming Autonomous mode | Jared Stofflett | Programming | 3 | 11-11-2003 09:32 |
| autonomous mode problem on field | Chris_C | Programming | 17 | 26-03-2003 19:11 |
| Autonomous programming | Dush | Programming | 4 | 20-02-2003 09:54 |
| autonomous sensor programming ? | Laura_d | Programming | 1 | 10-02-2003 17:46 |
| How far is everyone in their autonomous programming | AlphaOmega870 | Programming | 33 | 21-01-2003 21:03 |