Hi guys!
So, I decided to try using the TBH velocity control to control the flywheel. I researched a little about it and decided it was the best option for our flywheel.
I’m using jpearman’s simplified version of the code that he posted a while ago. However, I’m having trouble stopping the flywheel. We are using buttons 8u, 8d, 8l and 8r to have different speeds, and when I was not using the TBH algorithm, it looked a little bit like this:
if (vexRT[Btn8D] == 1)
{
motor[port1] = -127;
motor[port3] = 85;
motor[port5] = 85;
motor[port6] = 85;
motor[port8] = 85;
}
else if (vexRT[Btn8L] == 1)
{
motor[port1] = -127;
motor[port3] = 68;
motor[port5] = 68;
motor[port6] = 68;
motor[port8] = 68;
}
else if (vexRT[Btn8U] == 1)
{
motor[port1] = -127;
motor[port3] = 53;
motor[port5] = 53;
motor[port6] = 53;
motor[port8] = 53;
}
else if (vexRT[Btn8R] == 1)
{
motor[port1] = -127;
motor[port3] = 70;
motor[port5] = 70;
motor[port6] = 70;
motor[port8] = 70;
}
else // If buttons in 8 are NOT pressed: stop everything
{
motor[port1] = 0;
motor[port3] = 0;
motor[port5] = 0;
motor[port6] = 0;
motor[port8] = 0;
}
I tried doing the same thing with TBH, but once I press the button, it doesn’t stop and it starts stopping and continuing and it looks really weird. I don’t know what to do! This is what that looks like.
if( vexRT Btn8L ] == 1 )
{
FwVelocitySet( 144, 0.55 );
}
else if( vexRT Btn8U ] == 1 )
{
FwVelocitySet( 100, 0.38 );
}
else if( vexRT Btn8R ] == 1 )
{
FwVelocitySet( 50, 0.2 );
}
else if( vexRT Btn8D ] == 1 )
{
FwVelocitySet( 20,0.1);
}
else
{
FwVelocitySet(0,0);
}
If any of you have any idea of what’s happening, please help me out! Our tournament is in a few weeks and I’m honestly freaking out. THANKS!!