How do you do the autonomous programming?

Can someone help me with the autonomous programming? I am a rookie programmer.
:confused:

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 @ [email protected] .

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

  1. Be sure not to mess up any of your other code

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.

*Originally posted by rust710 *
**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. **

If you’re doing 2.5, you can also do it all in one line:


IF auton_mode=1 THEN GOSUB autonomous ELSE GOSUB normal_operation

I just posted a rather lengthy reply to a similar question in this thread that you may want to look at.

–Rob

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.:wink:

For delta_t stuff, check out http://www.chiefdelphi.com/forums/showthread.php?s=&threadid=16994.

As for the rpms, I just sent you some stuff. Let me know whether or not it works.

–Rob

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:

What is the autonomous code, and where do we connect the sensors up at?

Were do the autonomous sensors hook up to the robot.

how do you hook the autonomous mode up to robot.(to work)

All sensors are hooked up through the digital/analog 25 pin ports on the RC.
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.

Now, can anyone help me with programming SPIKEs for the pneumatics?

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.