Go to Post Every mentor we lose is potentially dozens of students lost... - Andrew Schreiber [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

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #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()
{


}
}
  #2   Spotlight this post!  
Unread 19-02-2014, 11:23
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Victors won't work together.

Are all three of the power LEDs lit on the Digital Sidecar? If you unplug the 37-pin ribbon cable, do the LEDs remain on?

Odd speed controller behavior like this is often caused by the Digital Sidecar not being powered properly. Its power input must be connected to battery voltage through the Power Distribution Board, protected by a 20 Amp snap-action circuit breaker.
  #3   Spotlight this post!  
Unread 19-02-2014, 22:02
Monochron's Avatar
Monochron Monochron is online now
Engineering Mentor
AKA: Brian O'Sullivan
FRC #4561 (TerrorBytes)
Team Role: Engineer
 
Join Date: Feb 2007
Rookie Year: 2002
Location: Research Triangle Park, NC
Posts: 899
Monochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond reputeMonochron has a reputation beyond repute
Re: Victors won't work together.

I could be way off on this as I wasn't involved in coding this year, but currently our code will only send one button press at a time. Could yours be doing something similar? For instance, can you power two different spikes at the same time? Or a victor and a spike at the same time?

Like I said, sadly I don't know the details of what caused that behavior for us, but your situation sounds similar.
Closed Thread


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