Go to Post As much as you may want the ChiefDelphi community to see your argument, we may not want to see yours. - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 17-02-2014, 14:14
davidfoong123 davidfoong123 is offline
Registered User
FRC #5180
 
Join Date: Feb 2014
Location: Blythewood
Posts: 1
davidfoong123 is an unknown quantity at this point
Exclamation Victors won't work together.

Hi, our team is having a problem getting Victors to work together. We have 3 victors that are supposed to control different things, but will not run if another victor is enabled in the code. For example, if we have our tension control enabled in the code, it will work. If we un-comment our other routines, maybe something like the catapult launch, catapult launch won't work, but tension control will. If we disable tension control, catapult launch will work. Each victor has worked by itself, but no two victors will run at the same time. The exception to this is that the four victors controlling the motors for driving are always working. Have any ideas?

Here's our code. Some of it is commented out, because we were testing different things.
Quote:
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/

package edu.wpi.first.wpilibj.templates;


import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Joystick;

/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends IterativeRobot {
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
Victor rightall = new Victor(1);
Victor leftall = new Victor(2);
Joystick joy1 = new Joystick(1);
Joystick joy2 = new Joystick(2);
double rightdrive;
double leftdrive;
Victor stickMotor = new Victor(3);
Victor tensionControl = new Victor(4);
Victor catapult = new Victor(5);
public void robotInit()
{
rightdrive = 0;
leftdrive = 0;
}
//This function is called periodically during autonomous
public void autonomousPeriodic()
{
GoForwards();
}

// This function is called periodically during operator control
public void teleopPeriodic()
{
Drive();
// SlotThree();
// SlotThreeNegative();
SlotFour();
// SlotFourNegative();
SlotFive();
// SlotFiveNegative();
}
public void GoForwards()
{
rightall.set(0.2);
leftall.set(-0.2);
}
public void Drive()
{

rightdrive = joy1.getY();
leftdrive = joy2.getY();
rightall.set(rightdrive/2);
leftall.set(-leftdrive/2);

}
public void SlotThree()
{
double stickSpeed = 1.0;
if (joy1.getRawButton(6) == true)
stickMotor.set(stickSpeed);
else
stickMotor.set(0);
}
public void SlotThreeNegative()
{
double stickSpeed = 1.0;
if (joy1.getRawButton(9) == true)
stickMotor.set(-stickSpeed);
else
stickMotor.set(0);
}
public void SlotFour()
{
double stickspeed1 = 1.0;
if (joy1.getRawButton(7) == true)
//tensionControl.set(stickspeed1);
tensionControl.set(1.0);
else
tensionControl.set(0);
}
public void SlotFourNegative()
{
double stickspeed1 = 1.0;
if (joy1.getRawButton(10) == true)
tensionControl.set(-stickspeed1);
else
tensionControl.set(0);
}
public void SlotFive()
{

if (joy1.getRawButton(8) == true)
catapult.set(-1.0);
else
catapult.set(0);

}
public void SlotFiveNegative()
{
if (joy1.getRawButton(11) == true)
catapult.set(1.0);
else
catapult.set(0);
}

/* public void SlotFour()
{
double stickspeed1 = 1.0;
if (joy1.getRawButton(7) == true)
//tensionControl.set(stickspeed1);
tensionControl.set(1.0);
else
if (joy1.getRawButton(8) == true)
catapult.set(stickspeed1);
else
{
tensionControl.set(0);
catapult.set(0);
}
if (joy1.getRawButton(7) == false && joy1.getRawButton(7) == false)
{
tensionControl.set(0);
catapult.set(0);
}
}
*/

/**
* This function is called periodically during test mode
*/
public void testPeriodic()
{


}
}
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 14:52.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi