much of it had to be unziptied for the lift post to be moved, but even then, we probably could do a better wiring job.
As you can see the bottom bar is offset (moved forward) to allow it to go all the way to vertical. This will result in more height for the same amount of weight in c channel. Side note: you do not have to offset this far. Just using the opposite sides of a regular c channel will suffice. Also, it is rarely a good idea to use 5 wides
In addition to the bot, our coding team has been working hard on the program. Any thoughts?
#pragma config(Sensor, in1, drivegyro, sensorGyro)
#pragma config(Sensor, in2, liftpotential, sensorPotentiometer)
#pragma config(Sensor, in3, chainpotential, sensorPotentiometer)
#pragma config(Sensor, dgtl1, mgoal, sensorTouch)
#pragma config(Sensor, dgtl6, b10000, sensorLEDtoVCC)
#pragma config(Sensor, dgtl8, b00001, sensorLEDtoVCC)
#pragma config(Sensor, dgtl9, b00010, sensorLEDtoVCC)
#pragma config(Sensor, dgtl10, b00100, sensorLEDtoVCC)
#pragma config(Sensor, dgtl11, b01000, sensorLEDtoVCC)
#pragma config(Sensor, dgtl12, jumper, sensorDigitalIn)
#pragma config(Motor, port1, mgl, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor, port2, lefty, tmotorVex393HighSpeed_MC29, openLoop)
#pragma config(Motor, port3, righty, tmotorVex393HighSpeed_MC29, openLoop, reversed)
#pragma config(Motor, port4, bottomleft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, bottomright, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, topleft, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port7, topright, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port8, cbl, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port9, vacuum, tmotorVex393_MC29, openLoop, reversed)
#pragma config(Motor, port10, mgr, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#pragma platform(VEX2)
#pragma competitionControl(Competition)
#include "Vex_Competition_Includes.c"
int numbacones=0;
int autontoggle=1;
int drivertoggle=1;
/*
=====================================================================================================================================
*/
void pre_auton()
{
bStopTasksBetweenModes = true;
SensorValue[drivegyro] = 0;
}
/*
=================================================================================================================================
*/
void setLEDs (int number) //This void sets the light-emitting-diode display on the cortex to represent the number of cones on stacked on the robot.
{
SensorValue[b00001] = number & 1;
SensorValue[b00010] = (number >> 1) & 1;
SensorValue[b00100] = (number >> 2) & 1;
SensorValue[b01000] = (number >> 3) & 1;
SensorValue[b10000] = (number >> 4) & 1;
}
void count(int time) //This void plays the sound file that coincides with the number of cones on the goal
{
if(numbacones > 0)
{
string soundfile;
sprintf(soundfile, "%d%s", numbacones, ".wav");
playSoundFile(soundfile);
wait1Msec(time);
}
}
task chainbarauton() //Task referenced in "task autonomous" that mainly focuses on the chainbar
{
motor[cbl]=-127;
wait1Msec(2200);
motor[cbl]=127;
wait1Msec(1300);
while(true)
{
motor[cbl]=20;
}
}
/*
==============================================================================================================================
*/
task autonomous()
{
if(SensorValue[jumper]==1) //If the jumper pin in port 12 is removed, it will stack a cone on the stationary goal
{
motor[topright]=127;
motor[topleft]=127;
motor[bottomright]=127;
motor[bottomleft]=127;
motor[lefty]=90;
motor[righty]=90;
startTask(chainbarauton);
wait1Msec(250);
motor[righty]=0;
motor[lefty]=0;
wait1Msec(350);
motor[bottomleft]=0;
motor[bottomright]=0;
motor[topright]=0;
motor[topleft]=0;
wait1Msec(1000);
motor[topright]=127;
motor[topleft]=127;
motor[bottomright]=127;
motor[bottomleft]=127;
motor[righty]=0;
motor[lefty]=0;
motor[vacuum]=-127;
wait1Msec(600);
motor[bottomleft]=0;
motor[bottomright]=0;
motor[topright]=0;
motor[topleft]=0;
motor[vacuum]=0;
motor[lefty]=127;
motor[righty]=-127;
wait1Msec(500);
motor[righty]=127;
motor[lefty]=127;
wait1Msec(7000);
motor[righty]=0;
motor[lefty]=0;
}
else //if the jumper pin remains in, it will suicide auton for 5 sec
{
motor[lefty]=100;
motor[righty]=100;
wait1Msec(5000);
motor[lefty]=0;
motor[righty]=0;
}
}
/*
==================================================================================================================================================================================================================
*/
task counter() //constantly contributes to the variable representing the number of cones in the stack
{
while(true)
{
if(motor[vacuum]==-100)
{
numbacones++;
count(2000);
}
else if(vexRT[Btn8RXmtr2]==1)
{
numbacones++;
count(1000);
}
else if(vexRT[Btn8DXmtr2]==1)
{
numbacones--;
count(1000);
}
else if(vexRT[Btn7DXmtr2]==1)
{
numbacones=0;
}
setLEDs(numbacones);
}
}
task partnerjoy() //allows partner joystick to toggle the drive speed for more accurate positioning
{
while(true)
{
if(vexRT[Ch2Xmtr2]>=100 && vexRT[Ch3Xmtr2]>=100)
{
drivertoggle=1;
}
else if(vexRT[Ch1Xmtr2]>=100 && vexRT[Ch4Xmtr2]>=100)
{
drivertoggle=2;
}
else if(vexRT[Ch2Xmtr2]<=-100 && vexRT[Ch3Xmtr2]<=-100)
{
drivertoggle=0;
}
}
}
task driver() //Allows lead driver to drive (tank style) at full or half speed.
{
while(true)
{
if(drivertoggle==1)
{
motor[lefty]=vexRT[Ch3];
motor[righty]=vexRT[Ch2];
}
else if(drivertoggle==2)//this unique feature switches to arcade drive
{
motor[lefty]=(vexRT[Ch2]+vexRT[Ch1])/2;
motor[righty]=(vexRT[Ch2]-vexRT[Ch1])/2;
}
else
{
motor[lefty]=0.5*vexRT[Ch3];
motor[righty]=0.5*vexRT[Ch2];
}
}
}
task fourbar() //runs the main lift
{
while(true)
{
if(autontoggle==1)
{
if(vexRT[Btn5U]==1)
{
motor[topleft]=127;
motor[bottomleft]=127;
motor[topright]=127;
motor[bottomright]=127;
}
else if(vexRT[Btn5D]==1)
{
motor[topleft]=-127;
motor[bottomleft]=-127;
motor[topright]=-127;
motor[bottomright]=-127;
}
else //If neither button is pressed, initiate auto-lock
{
motor[topleft]=20;
motor[bottomleft]=20;
motor[topright]=20;
motor[bottomright]=20;
}
}
}
}
task vacuumtask() //runs the rotary intake
{
while(true)
{
if(autontoggle==1)
{
if(vexRT[Btn6DXmtr2]==1 || vexRT[Btn8L]==1)
{
motor[vacuum]=100;
}
else if(vexRT[Btn6DXmtr2]==1 || vexRT[Btn8D]==1)
{
motor[vacuum]=-100;
}
else
{
motor[vacuum]=0;
}
}
}
}
task chain() //runs chainbar (or later to be called "extention arm")
{
while(true)
{
if(autontoggle==1)
{
if(vexRT[Btn6U]==1)
{
motor[cbl]=127;
}
else if(vexRT[Btn6D]==1)
{
motor[cbl]=-127;
}
else
{
motor[cbl]=10;
}
}
}
}
task goal() //Runs mobile goal intake
{
while(true)
{
if(vexRT[Btn7R]==1 || vexRT[Btn5UXmtr2]==1)
{
motor[mgl]=100;
motor[mgr]=100;
}
else if(vexRT[Btn7D]==1 || vexRT[Btn5DXmtr2]==1)
{
motor[mgl]=-100;
motor[mgr]=-100;
}
else
{
motor[mgl]=0;
motor[mgr]=0;
}
}
}
/*
============================================================================================================================
*/
task usercontrol() //starts each task necessary to drive
{
startTask(counter);
startTask(driver);
startTask(fourbar);
startTask(vacuumtask);
startTask(chain);
startTask(goal);
startTask(partnerjoy);
}
/*
=====================================================================================================================================
*/
Are your LEDs displaying the cone height in binary? I thought that was my own original idea!
Yeah. I told Ryan not to waste his time because I can’t read binary fast enough for it to be useful in match, but he did it anyways.
How is the sound file that plays the # of cones working out? Are you able to hear it in mid-match since competitions are usually noisy?
If you turn up those speakers, they get pretty loud.
OK we don’t have one, do you think it’s worth the cost? Do you think it actually is useful in a match? @MasterCole
Not all that useful, but definitely pretty cool.
No. they are useless. Unless you are Jared from our X team who uses it to play super annoying music only he can stand.
OK thanks for the feedback, I won’t spend money on one then.
@briancole No. they are useless. Unless you are Jared from our X team who uses it to play super annoying music only he can stand.
He plays “in the hall of the mountain king” in tones and wait commands and none of us can stand it.
It was cool the first 10 times. not the 200th.
Star wars theme on the other hand i could stand that.
Once we get out bot functional, we’re thinking about doing an awesome reveal video. Any opinions?
Use the vex speaker for the reveal’s background music
and the old vex camera to film it
Don’t do that! Vex robots look horrible in anything less thank 4K video.
I wrote the script for our potential reveal a week or so ago. It’s basically going to be a gigantic Star Wars parody, theme music and all.
Cool, is the robot going to represent R2-D2 or BB-8 or something? Make your robot represent IG-88, that’d be cool