paper: Killer Bees OCCRA/VEX 2011 Code

Thread created automatically to discuss a document in CD-Media.

Killer Bees OCCRA/VEX 2011 Code
by: apalrd

Complete code from the OCCRA and OCCRA VEX robots from the 2011 season, post-championship. Developed for the Vex Cortex control system and compiled in easyC V4.

Complete code from the OCCRA and OCCRA VEX robots from the 2011 season, post-championship. Developed for the Vex Cortex control system and compiled in easyC V4.

C_Code - Code from the OCCRA “Bigbot”. Designed for two drivers, this code incorporates:
-6wd Skid Steer in “Halo Drive” arcade mix using “Cheesy Drive” algorithm with automated quick turn input. The code for the cheesy drive algorithm itself is in cheesydrive.c (it’s the Cheesy Poofs algorithm from their 2010 code release, ported to embedded C for Vex)

-Single-joint arm with analog position sensor. Due to the nature of the driving motor (Dewalt with anti-backdrive pins), we fought with the anti-backdrive pins enough to just give up on automated position control and use manual control, but the automation code is still there. See arm.c, arm.h, and armconst.h for the implementation.

-Dual-roller collector with state-machine control. See roller.c, roller.h, and rollerconst.h for the implementation

-Rotary joint hood, driven by a Spike. Implements state-based control and relay-output to a Spike via two digital output pins.

Due to the modular nature of the code I wrote for the bigbot, I used most of it copypasta in the vex robot.
C_Code_Vex - Code from the OCCRA “Vex” robot, also for the Vex Cortex control system. This robot utilizes a single driver to:
-5-wheel Slide Drive driven using what our Vex driver calls a “Doom Drive” (“It’s like Halo but better”). It’s essentially the same Halo drive as above, with the X axis of the throttle stick driving the slide wheel (so, the left stick is translation and the right stick X is rotation). This proved to be very intuitive to our driver, who plays lots of video games.

-Single-joint arm. I used the same exact code as above, and changed the port mapping, setpoints/state enum, and gains. None of the actual state-machine or proportional code was changed.

-Dual-roller collector - Once again, the same code as above was re-worded to fit this robot’s IO configuration, but otherwise worked fine as-is.

-Autonomous Navigation - This robot was limited to 2 encoders and no gyros by the OCCRA Vex rules, so it does not have closed-loop heading control as I originally planned to implement. Thus, its autonomous navigation is limited and it often twists during runs. It has various functions in autonomous_routines.c to handle forward OR slide driving (I don’t mix the two due to the twist above), handling the mechanical unfolding process, and such, and uses all of the write_state functions to directly command the mechanisms. It was able to fairly consistently knock the ball off the wall using the ultraonic rangefinder, which was a great achievement for an OCCRA Vex team.

Arm_Code.zip - Standalone arm code, pulled out as example code. I removed all of the GD output code (which was commented out anyway), and simplified some of the comments to use as an example to new programmers.

I had some issues which I think could be related to easyC. In the future, I am looking at robotC, but the code is modular enough where it should port easily, and only the sensor IO commands really change. In newer versions of this code (Which are running VRC33A/B/C vex robots), I am using a file to define macros to handle the IO, so the port to robotC is even easier.

C_Code_Nov21.zip (148 KB)
C_Code_Vex_Nov21.zip (144 KB)
Arm_Code.zip (2.97 KB)