Quote:
Originally Posted by Hjelstrom
We're using a rotary switch which is just like 4 dip switches. Using 4 bits you get a number from 0-15. We normally call this in "Disabled()". In 'practice' mode it works, we can run different auto sequences at will but we always switch the robot to 'Disabled', then line it up, then 'Enable' again.
Here is the code to read the switch. I do see a logic/comment flaw in that if the inputs were really all zero, then the seq number would be 15 not zero. So maybe in auto the inputs are all pulled high? I recall in previous years, if you ran code like this during auto, you'd always get zero back as the desired sequence.
int seq = 0;
bool Dec1 = !ds->GetDigitalIn(1);
bool Dec2 = !ds->GetDigitalIn(3);
bool Dec4 = !ds->GetDigitalIn(5);
bool Dec8 = !ds->GetDigitalIn(7);
|
You are inverting all the switches when you get them (bool Dec1 =
!ds->GetDigitalIn(1)

so it makes sense that the the seq goes to 15 in auto. So in auto all the GetDigitalIn() calls return false then they are inverted to true and stored in Dec1-8. I am not sure exactly how your rotary is wired that you needed to invert the inputs (I imagine it is grounding one input at a time). In the past (we dont use the Cypress this year) we have used a rotary switch and soldered resistors between adjacent positions to make a variable voltage divider then read it in as an analog value check to see if it is in different ranges.
Wrapping an IsDisabled() around this function as suggested before would work (stop AutoSeq being set to 15). You can also check that (seq != 15) before setting AutoSeq.
Also a CD posting tip for the future: there are code tag that you can wrap around posted code to preserve the indentation and make it easier to read. You just need to press the # icon on top of the post box to put code tags in your post. Code tags also work well for tab spaced tables (like one you might copy from Excel)
Quote:
Originally Posted by Hjelstrom
With a little experimentation, I think we could have sorted out what was going on yesterday but the auto is working so well we decided not to touch anything! :-)
|
Auto going well, that is an understatement. Great job on that consistent 2 uber tube auto! Are you checking the lines at times for alignment? It is truly unique set up for 2 tube with you starting at the Y and going across the other robot to get the tube at the other line.
I watched the impressive LV archive you guys set up. Congrats on your first 2 regional win season!