Hi everyone! Our team is building a scissor lift and we’re having several errors. When we have our scissor lift code in a separate file on its own, we don’t have any errors and our scissor lift runs smoothly, but once we place our scissor lift code with the rest of our competition code, the scissor starts chattering on the way up and down. We know it’s not a motor problem because we’ve already tested them separately. Any advice on how to fix this problem would be appreciated.
Scissor Code alone:
#pragma config(Motor, port2, TopLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, TopRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, BottomLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, BottomRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, Middle1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, Middle2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, ScissorLiftRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, ScissorLiftLeft, tmotorVex393_MC29, openLoop)
#pragma platform(VEX)
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include "Vex_Competition_Includes.c"
void pre_auton()
{
bStopTasksBetweenModes = true;
}
task usercontrol()
{
// User control code here, inside the loop
while (true)
{
motor [ScissorLiftRight]=vexRT[Ch5];
motor [ScissorLiftLeft]=vexRT[Ch6];
if(vexRT[Btn7R])
{
motor[ScissorLiftLeft] = 127;
motor[ScissorLiftRight] = 127;
}
else{
motor[ScissorLiftLeft] = 0;
motor[ScissorLiftRight] = 0;
if(vexRT[Btn7L])
{
motor[ScissorLiftLeft] = -127;
motor[ScissorLiftRight] = -127;
}
else{
motor[ScissorLiftLeft] = 0;
motor[ScissorLiftRight] = 0;
}
UserControlCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
}
}
Competition Code all together:
#pragma config(Motor, port1, , tmotorVex393_HBridge, openLoop)
#pragma config(Motor, port2, TopLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port3, TopRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port4, BottomLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port5, BottomRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, Middle1, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, Middle2, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port8, ScissorLiftRight, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port9, ScissorLiftLeft, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, , tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard!!*//
#pragma platform(VEX)
#pragma competitionControl(Competition)
#pragma autonomousDuration(20)
#pragma userControlDuration(120)
#include "Vex_Competition_Includes.c" //Main competition background code...do not modify!
void pre_auton()
{
bStopTasksBetweenModes = true;
}
task autonomous()
{
// .....................................................................................
// Insert user code here.
// .....................................................................................
AutonomousCodePlaceholderForTesting(); // Remove this function call once you have "real" code.
}
task usercontrol()
{
while (true)
{
motor [TopLeft]=vexRT[Ch3];
motor [TopRight]=vexRT[Ch2];
motor [BottomLeft]=vexRT[Ch3];
motor [BottomRight]=vexRT[Ch2];
motor [Middle1]=vexRT[Ch1];
motor [Middle2]=vexRT[Ch1];
motor [ScissorLiftRight]=vexRT[Ch5];
motor [ScissorLiftLeft]=vexRT[Ch6];
if(vexRT[Btn8U] ==1)
{
startMotor(Middle1, 127);
startMotor(Middle2, 127);
}
else
{
stopMotor(Middle1);
stopMotor(Middle2);
}
if(vexRT[Btn8R])
{
motor[ScissorLiftLeft] = 127;
motor[ScissorLiftRight] = 127;
}
else{
motor[ScissorLiftLeft] = 0;
motor[ScissorLiftRight] = 0;
if(vexRT[Btn8L])
{
motor[ScissorLiftLeft] = -127;
motor[ScissorLiftRight] = -127;
}
else{
motor[ScissorLiftLeft] = 0;
motor[ScissorLiftRight] = 0;
}
}
}
}
Pictures of our robot have been attached.