Log in

View Full Version : Competition Sequence for PBasic


ttedrow
21-01-2003, 14:32
I talked with Innovation first on 1/21/02. Here is my understanding of the sequence that the PBasic program can see during each phase of competition.



STANDBY PERIOD: (power on RC and OI)
comp_mode = High
auton_mode = Low
Robot Controller Analog Outputs = 127
Robot Controller Digital Outputs = 0
Operator Interface Analog Inputs = 127
Operator Interface Digital Inputs = 0

AUTONOMOUS PERIOD:
comp_mode = High
auton_mode = High
Robot Controller Analog Outputs = Program Control
Robot Controller Digital Outputs = Program Control
Operator Interface Analog Inputs = 127
Operator Interface Digital Inputs = 0

OPERATOR PERIOD:
comp_mode = High
auton_mode = Low
Robot Controller Analog Outputs = Program Control
Robot Controller Digital Outputs = Program Control
Operator Interface Analog Inputs = Operator Control
Operator Interface Digital Inputs = Operator Control

I hope this will help

Tim Tedrow:)

Joe Ross
21-01-2003, 14:42
shouldn't comp_mode change?

Is that a typo, or does that bit really stay high all the time?

ttedrow
21-01-2003, 15:53
No, comp_mode does not change. I thought the same thing but Innovation first said no.

Mike Soukup
22-01-2003, 16:46
Originally posted by ttedrow
No, comp_mode does not change. I thought the same thing but Innovation first said no.
IF the comp_mode bit does not change, how can FIRST keep our bots disabled before the match starts? What is the difference between "standby period" and "operator period" with respect to control signals? How can comp_mode = high and auton_mode = low produce two different behaviors for the inputs & outputs?

In previous years during the standby period, the RC would execute its code without knowing that its outputs were being set to 127 & 0 by the output processor (unless of course you looked at the comp_mode bit). All the inputs were passed from the OI & RC to your program. There has been no official word from FIRST or IFI that anything will be different this year.

Nate Smith
22-01-2003, 17:37
I agree that something doesn't sound right about this...can someone verify with a 2003 control system and a disable/auton dongle? Not being on a team this year, I have no way of doing this myself...

ttedrow
22-01-2003, 21:49
According to Innovation First, the comp_mode bit is only an indication that the OI is plugged into competition system. They also told me that there is no bit available to PBasic that indicates the start and end of the match. Maybe next year if requested.

I have verified this with the new dongle.

Tim Tedrow

Specialagentjim
22-01-2003, 21:55
So...basically robots will be on during standby period for operator interface... Judges will just have to police teams to not touch their controller...?

Travis Hoffman
22-01-2003, 23:38
Here's a line of code that has been in Xtremachen's control program for as long as I've been a programmer on the team:

rotatinglight = 1 - comp_mode

Our light has always worked properly - it's been on when the robot was enabled and off when it was disabled. This is the case during matches and also when using the homemade Competition Port dongle. For us, comp_mode has always been equal to ZERO when the robot has been enabled.

http://www.innovationfirst.com/FIRSTRobotics/pdfs/Competition_Port_Pinout_Guide.PDF

Here's why I think comp_mode = 0 during a match. I might be completely wrong - it wouldn't be the first time.

According to the official Competition Port pinout, you must connect Ground Pin 8 to Disable Pin 6 in order to DISABLE the robot. This is the same thing you do to turn a digital input on - completing the circuit between ground and the input pin yields a logical 1 inside the program. If the Competition Port inputs follow the same pattern, then the comp_mode input turns ON when you close the circuit (robot disabled) and OFF when you open the circuit (robot enabled). If this is all true, then comp_mode = 0 during a match.

Greg Ross
23-01-2003, 01:44
I think I remember confirming that comp_mode is 0 when the robot is enabled. I don't remember whether I confirmed that it changes when the robot is disabled though.:o

BTW, the fact that your light turns off when the robot is disabled doesn't mean comp_mode changes. All it means is that the master microprocessor in the RC knows when it's supposed to disable the robot, and it does.

In any case, it would be nice if IFI would correct the comments in the default code regarding comp_mode.

Travis Hoffman
23-01-2003, 08:14
Originally posted by gwross
BTW, the fact that your light turns off when the robot is disabled doesn't mean comp_mode changes. All it means is that the master microprocessor in the RC knows when it's supposed to disable the robot, and it does.


My point wasn't that comp_mode changes, it was that comp_mode was equal to ZERO during a match - it had to be; otherwise, our rotating light wouldn't be on. I am guessing, however, is that comp_mode acts like a digital input variable in the sense that it is 1 when the disable switch is closed and 0 when it is open. That would have to be verified (ultimately, by IFI, I hope).

Matt Leese
23-01-2003, 08:23
As of last year, the comp_mode bit was zero while disabled and one when enabled. I know this because we used it last year to autodrop our goal grabbers at the start of the match. That means that it's worked in the past. Now, that's not to say that InnovationFIRST hasn't changed something. However, the documentation in the default program seems to indicate that the comp_mode bit still keeps it's old behavior.

Matt

Ryan Meador
23-01-2003, 08:46
Check this out.

From the Default Program:
' Bit 7 of the PB_mode byte (aliased as comp_mode below) indicates the status
' of the Competition Control, either Enabled or Disabled. This indicates the
' starting and stopping of rounds at the competitions.
' Comp_mode is indicated by a solid "Disabled" LED on the Operator Interface.
' Comp_mode = 1 for Enabled, 0 for Disabled.

From the Programming Reference Guide:
Bit 7 of the PB_mode byte (aliased as comp_mode below) indicates the status of the Competition
Control, either Enabled or Disabled. This indicates the starting and stopping of rounds at the
competitions. Comp_mode is indicated by a solid "Disabled" LED on the Operator Interface.
Comp_mode = 1 for Enabled, 0 for Disabled.

Now, to the best of my knowledge, IFI created the programming guide for this year's controller. So one would think that it's correct. It also is exactly the same as the comments in the code, and if you look at how it claims the LEDs will behave, they do exactly that. All that remains to be tested is whether or not the bit actually changes... I suspect it does.

I have a vague memory of another bit that was aliased as disabled_mode or something similar from years ago. Maybe it was just our programming coach changing the name. Now that I'm the programming coach, everything has new names ;) None of this PWM1 garbage... it's LeftFrontDrive.

ttedrow
23-01-2003, 08:49
Ok Ok Ok!!! I had the comp_bit inverted. But the fact is the comp_mode bit does not change during the competition.

STANDBY PERIOD: (power on RC and OI)
comp_mode = Low
auton_mode = Low
Robot Controller Analog Outputs = 127
Robot Controller Digital Outputs = 0
Operator Interface Analog Inputs = 127
Operator Interface Digital Inputs = 0

AUTONOMOUS PERIOD:
comp_mode = Low
auton_mode = High
Robot Controller Analog Outputs = Program Control
Robot Controller Digital Outputs = Program Control
Operator Interface Analog Inputs = 127
Operator Interface Digital Inputs = 0

OPERATOR PERIOD:
comp_mode = Low
auton_mode = Low
Robot Controller Analog Outputs = Program Control
Robot Controller Digital Outputs = Program Control
Operator Interface Analog Inputs = Operator Control
Operator Interface Digital Inputs = Operator Control

Sorry for the confusion

BTW

rotatinglight = 1 - comp_mode
AND
rotatinglight = 1

do the same thing.

Tim Tedrow