Reposted For Public: Intake Motor Problems

OK, today I went and changed something on the intake, and when I go to test it, the intake motors will spin the same direction, then go against each other. What is the problem? Why do the motors spin with each other, then a second later against each other?

Thanks!

Programming

Post your code and the crack team of code residents will tell you whats wrong.

#pragma config(I2C_Usage, I2C1, i2cSensors)
#pragma config(Sensor, in1,    LeftPot,        sensorPotentiometer)
#pragma config(Sensor, in2,    RightPot,       sensorPotentiometer)
#pragma config(Sensor, dgtl1,  LeftButton,     sensorTouch)
#pragma config(Sensor, dgtl2,  RightButton,    sensorTouch)
#pragma config(Sensor, dgtl10, OARight,        sensorTouch)
#pragma config(Sensor, dgtl11, DALeft,         sensorTouch)
#pragma config(Sensor, dgtl12, DARight,        sensorTouch)
#pragma config(Sensor, I2C_1,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_2,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_3,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Sensor, I2C_4,  ,               sensorQuadEncoderOnI2CPort,    , AutoAssign)
#pragma config(Motor,  port1,           RightFront,    tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port2,           RightBack,     tmotorVex393, openLoop, reversed, encoder, encoderPort, I2C_4, 1000)
#pragma config(Motor,  port3,           IntakeLeft,    tmotorVex393, openLoop)
#pragma config(Motor,  port4,           IntakeRight,   tmotorVex393, openLoop)
#pragma config(Motor,  port5,           SWLeft,        tmotorVex393, openLoop, encoder, encoderPort, I2C_3, 1000)
#pragma config(Motor,  port6,           SWRight,       tmotorVex393, openLoop, encoder, encoderPort, I2C_2, 1000)
#pragma config(Motor,  port7,           LiftRight,     tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port8,           LiftLeft,      tmotorVex393, openLoop, reversed)
#pragma config(Motor,  port9,           LeftFront,     tmotorVex393, openLoop)
#pragma config(Motor,  port10,          LeftBack,      tmotorVex393, openLoop, encoder, encoderPort, I2C_1, 1000)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma platform(VEX)

//Competition Control and Duration Settings
#pragma competitionControl(Competition)
#pragma autonomousDuration(15) //Autonomous is 15 seconds long
#pragma userControlDuration(105) //Driver control is 105 (1min 45sec) seconds long


#include "Vex_Competition_Includes.c"   //Main competition background code...do not modify!
//#include "Autonomous_Sack_Attack.c"     //Sack Attack Autonomous Routes

/////////////////////////////////////////////////////////////////////////////////////////
//
//                          Pre-Autonomous Functions
//
// You may want to perform some actions before the competition starts. Do them in the
// following function.
//
/////////////////////////////////////////////////////////////////////////////////////////

void pre_auton()
{
  // Set bStopTasksBetweenModes to false if you want to keep user created tasks running between
  // Autonomous and Tele-Op modes. You will need to manage all user created tasks if set to false.
  bStopTasksBetweenModes = true;

	// All activities that occur before the competition starts
	// Example: clearing encoders, setting servo positions, ...
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 Autonomous Task
//
// This task is used to control your robot during the autonomous phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task autonomous()
{
 //if (SensorBoolean[OARight])
 //   AutonomousRight();
 // else if (SensorBoolean[DOLeft])
 //   DefensiveAutonomousLeft();
 // else if (SensorBoolean[DORight])
 //   DefensiveAutonomousRight();
 // else
 //   AutonomousLeft();


 motor[IntakeLeft] = 127;
	motor[IntakeRight] = 127;
	motor[LiftLeft] = 127;
	motor[LiftRight] = 127;
	wait1Msec(600);
	motor[LiftLeft] = -127;
	motor[LiftRight] = -127;
	wait1Msec(600);
	motor[LiftLeft] = 0;
	motor[LiftRight] = 0;

	motor[LeftBack] = 127;
	motor[LeftFront] = 127;
	motor[RightBack] = 127;
	motor[RightFront] = 127;
	wait1Msec(2000);
	motor[LeftBack] = 0;
	motor[LeftFront] = 0;
	motor[RightBack] = 0;
	motor[RightFront] = 0;

	motor[LeftBack] = -63;
	motor[LeftFront] = -63;
	motor[RightBack] = -63;
	motor[RightFront] = -63;
	wait1Msec(500);
	motor[LeftBack] = 0;
	motor[LeftFront] = 0;
	motor[RightBack] = 0;
	motor[RightFront] = 0;

	motor[LeftBack] = 63;
	motor[LeftFront] = 63;
	wait1Msec(1000);
	motor[LeftBack] = 0;
	motor[LeftFront] = 0;

	motor[SWLeft] = -127;
	motor[SWRight] = -127;
	wait1Msec(300);
	motor[SWLeft] = 0;
	motor[SWRight] = 0;

	motor[LiftLeft] = 127;
	motor[LiftRight] = 127;
	wait1Msec(2500);
	motor[LiftLeft] = 0;
	motor[LiftRight] = 0;

	motor[LeftBack] = 63;
	motor[LeftFront] = 63;
	motor[RightBack] = 63;
	motor[RightFront] = 63;
	wait1Msec(1250);
	motor[LeftBack] = 0;
	motor[LeftFront] = 0;
	motor[RightBack] = 0;
	motor[RightFront] = 0;

	motor[IntakeLeft] = -127;
	motor[IntakeRight] = -127;
	wait1Msec(1750);

	motor[LeftBack] = -63;
	motor[LeftFront] = -63;
	motor[RightBack] = -63;
	motor[RightFront] = -63;
	wait1Msec(2000);
	motor[LeftBack] = 0;
	motor[LeftFront] = 0;
	motor[RightBack] = 0;
	motor[RightFront] = 0;
}

/////////////////////////////////////////////////////////////////////////////////////////
//
//                                 User Control Task
//
// This task is used to control your robot during the user control phase of a VEX Competition.
// You must modify the code to add your own robot specific commands here.
//
/////////////////////////////////////////////////////////////////////////////////////////

task usercontrol()
{
	// User control code here, inside the loop

	while (true)
	{
    motor[LeftFront] = vexRT[Ch3]; //Left joystick drives left side
    motor[LeftBack] = vexRT[Ch3]; //Left joystick drives left side
    motor[RightFront] = vexRT[Ch2]; //Right joystick drives left side
    motor[RightBack] = vexRT[Ch2]; //Right joystick drives left side
    motor[SWLeft] = (vexRT[Btn6U] - vexRT[Btn5U])*127; //Left/Right top/back buttons strafe left/right
    motor[SWRight] = (vexRT[Btn6U] - vexRT[Btn5U])*127; //Left/Right top/back buttons strafe left/right
    motor[LiftLeft] = (vexRT[Btn7UXmtr2] - vexRT[Btn7DXmtr2])*127;
    motor[LiftRight] = (vexRT[Btn7UXmtr2] - vexRT[Btn7DXmtr2])*127;
    motor[IntakeLeft] = (vexRT[Btn8DXmtr2] - vexRT[Btn8UXmtr2])*127;
    motor[IntakeRight] = (vexRT[Btn8DXmtr2] - vexRT[Btn8UXmtr2])*127;
  }
}

The Autonomous is really bad with just time right now. It will be made with Sensors when I know how to program them :smiley:

That’s what I’m using!

Assuming that the two intake motors face each other. One needs to go clockwise, the other counterclockwise.

In the code


#pragma config(Motor,  port2,           RightBack,     tmotorVex393, openLoop, reversed, encoder, encoderPort, I2C_4, 1000)
#pragma config(Motor,  port3,           IntakeLeft,    tmotorVex393, openLoop)
#pragma config(Motor,  port4,           IntakeRight,   tmotorVex393, openLoop)

One of the Intake motors needs to have the reversed flag set. Go back into motor setup and check the reversed box

I took off the axles and the other stuff for the intake and it worked fine. I found out that it was a axle collar w/ a screw catching on the metal causing one side of the intake to keep spinning while the other half wasn’t. Guess it was just my non-looking.

Thanks for your help though!