|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Robot Nightmare!
I am the head Programmer and Electrician for Team 1369 Minotaur and the robot is becoming a really big agitation to me. Here are some issues that I am having and I hope that you will comment, criticize, advise, etc. on ANY and EVERYthing.
Here are some issues: 1.) Robot Signal Light (RSL) On our robot, our Digital SideCar (DSC) has properly functioned including the little green "blinky light." When I connect the RSL to the DSC via the connector, it does not flash. This is annoying and perplexing for such a plug-n-play device. So my electricians and I have tested the points of metal exposure with a voltmeter all the way to the very insides of the RSL as as well as test the new and old lights, which the old light worked back in December 2011, and they both gave the same voltage reading, it was weird to read but it was oscillating. We even tried using other wires and other means of connections (bootleg placement of holding the wires there with three people to help = gave voltage, no lights). Some say that the cRio layout could correspond to this so here is our layout (to the best of my memory): Slot 1: empty Slot 2: 9403 Slot 3: 9201 Slot 4: empty Slot 5: 9472 Slot 6: empty Slot 7: empty Slot 8: empty I am almost 200% sure that there is error and that it can be corrected. Please do whatever it takes to correct me. 2.) PWMs, Relays, and I/Os -PWMs I have 4 Jaguars for the PWM slots. The first 2 are tank Drive motors which have had no problem except for the occasional error in programming. They are all set-up accordingly to -+S on the DSC and the Jaguars. The other two Jaguars (shooter and conveyor) are non-responsive. These are button launchers (shown in code later below) that are remaining in the blinking yellow state. This is confusing, especially when the error is due to not updated enough error .-Relays We are using relays for the window motors we have on a collector and a lever arm. The relays are hooked up in Relay slot one and two. At one point, I got a simple code to run on it to toggle on and off. Now they remain unresponsive. The light is RED and the fuse is intact. There is 12V going into it and no output voltage. I unplugged the wires to the motor from the spike and manually hooked it up to the battery. This proved the motor and subsystem work, but there is no output. The PWMs going into it ae my main issue. I could not remember which way it hooks up, the DSC was not a helpful diagram, so I hooked them in every way on the DSC and the Spike and still no response. This was very perplexing so any diagram, pic or layout would be much appreciated. -I/Os I am new to sensors, but I have done some research on them. The ones that I am focusing on are only the encoders (2) and the microswitches (2). First, I would like to see a DETAILED wire diagram and/or pictures of your wiring so that I understand what to do. Also with the DSC with slot a,b,+5,GND and the cRio (I can't think of the slot number or how to fully connect them.) With encoders, how do you mount them to CIM motors and window motors properly and how do you power encoders and microswitches. 3.) The program I have tried code from Iterative (A COMPLETE PAIN TO RUN SIMPLEST THING) to SimpleRobot (Something that works decently). Here are some of my codes (that I was very proud of): NOTE: Some areas were commented out only for the sake of getting to the problem. They used to be active in the program! Plus I wrote these within three ours at different times with Iterative first. IterativeRobot (PLEASE DO NOT STEAL!) Code:
/**
* Team 1369 Minotaur: FRC 2012 Code
*
* Middleton Magnet High School
* Tampa, FL
*
* Programmers: Marco Schoener
* Marvin
* Richawn
*/
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.DigitalInput;
import edu.wpi.first.wpilibj.Jaguar;
/**
* 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 MinotaurRobot extends IterativeRobot
{
/*/--------------------DECLARED GLOBAL VARIABLES--------------------/*/
//Motor Controls
Relay zipTieMotor; // Zip-tie wheel spike motor controller
Relay flagArmMotor; // Flag arm motor control
RobotDrive driveTrain; // 2 motor drive train
Jaguar conveyor; // Conveyor motor set-up
Jaguar launcher; // Launcher motor set-up
//Sensors
Encoder encode_1; // Encoder for Conveyor Belt System
Encoder encode_2; // Encoder for Flag Arm System
DigitalInput addSwitch; // Add the number of balls entering conveyor
DigitalInput minusSwitch; // Subtracts the number of balls in the conveyor
//Joysticks
Joystick controller1; // Used for driving and flag arms
Joystick controller2; // 2nd controller: used for launcher, conveyor
/*/-***Joystick Commands***-/*/
//Controller 1
public static final int CONT_1_LEFT_Y_AXIS = 2; // Controller 1: Left motor control (Tank Drive)
public static final int CONT_1_RIGHT_Y_AXIS = 4; // Controller 1: Right motor control (Tank Drive)
//Controller 2
public static final int LAUNCHER_CONTROLLER_FULL = 1; // Controls launcher at full speed
public static final int LAUNCHER_CONTROLLER_HALF = 2; // Controls launcher at alf speed
public static final int LAUNCHER_CONTROLLER_QUTR = 3; // Controls launcher at quarter speed
public static final int CONVEYOR_CONTROLLER = 4; // Controls conveyor belt movements
public static final int ZIP_TIE_WHEEL_BUTTON = 5; // Left Sholder: Value to activate zip-tie wheel
public static final int FLAG_ARM_CONTROLLER = 6; // Right Shoulder: Controls flag arm
public static final int CONT_2_LEFT_Y_AXIS = 2; // Controller 2:
public static final int CONT_2_RIGHT_Y_AXIS = 4; // Controller 2:
//Variables
boolean spikeOn_1; // Create a toggle variable for the zip-tie wheel spike relay
boolean spikeOn_2; // Create a toggle variable for the flag arm spike relay
public static final int CRIO_SLOT = 4; // Tells the slot for sensors to go on cRIO
public static final int PRELOADED_BALLS = 2; // Set the number for pre-loaded balls
//boolean zipTieWheel = false; // Allows the zip-tie wheel to move
//int totalBalls = 0; // Initial number of balls in conveyor
//public static final int plusBall = 1; // Sets up the ball count for adding in coveyor
//public static final int minusBall = 1; // Sets up the ball count for subtracting in coveyor
/*/--------------------CONSTRUCTOR CLASS----------------------------/*/
public MinotaurRobot()
{
getWatchdog().setEnabled(false); // The program overlord is set to sleep mode
driveTrain = new RobotDrive(1,2); // Drivetrain Motor PWM slots: 1 for left motor; 2 for right motor
conveyor = new Jaguar(3); // Conveyor Jaguar on PWM slot 3
launcher = new Jaguar(4); // Launcher Jaguar on PWM slot 4
zipTieMotor = new Relay(1); // Zip-Tie Spike in Relay slot 1
flagArmMotor = new Relay(2); // Flag Arm Spike in Relay slot 2
driveTrain.setSafetyEnabled(false);
//encode_1 = new Encoder(1, 2, false, Encoder.EncodingType.k4X); // Conveyor Belt: Sets encoder to Digital port 1 and 2, sets forward direction boolean, and detects encoder type
//encode_2 = new Encoder(3, 4, false, Encoder.EncodingType.k4X); // Flag Arm: Sets encoder to Digital port 3 and 4, sets forward direction boolean, and detects encoder type
//addSwitch = new DigitalInput(CRIO_SLOT, 5); // Attach the microswitch to the cRIO in slot 4 and on the sidecar in digital I/O slot 5
//minusSwitch = new DigitalInput(CRIO_SLOT, 6); // Attach the microswitch to the cRIO in slot 4 and on the sidecar in digital I/O slot 6
controller1 = new Joystick(1); // Controller 1
controller2 = new Joystick(2); // Controller 2
}
/*/--------------------ROBOT INITILIZATION--------------------------/*/
public void robotInit()
{
driveTrain.drive(0,0); // Motors are set of 0
driveTrain.stopMotor(); // Motors are off (Safety is HERE!)
zipTieMotor.setDirection(Relay.Direction.kForward); // Spike motor direction is forward
zipTieMotor.set(Relay.Value.kOff); // Spike is set to off
flagArmMotor.setDirection(Relay.Direction.kBoth); // Spike motor direction is forward and backward
flagArmMotor.set(Relay.Value.kOff); // Spike is set to off
spikeOn_1 = false; // Spike Relay for Zip-tie Motor toggle is set to off
spikeOn_2 = false; // Spike Relay for Flag Arm Motor toggle is set to off
encode_1.reset(); // Reset the conveyor belt encoder
encode_2.reset(); // Reset the flag arm encoder
}
/*/--------------------DISABLED ROBOT-------------------------------/*/
public void disabledPeriodic()
{
driveTrain.drive(0,0); // Motors are set of 0
driveTrain.stopMotor(); // Motors are off
zipTieMotor.set(Relay.Value.kOff); // Zip Tie Spike is set to off
flagArmMotor.set(Relay.Value.kOff); // Flag Arm Spike is set to off
}
/*/--------------------AUTONOMOUS PERIOD----------------------------/*/
public void autonomousPeriodic()
{
zipTieMotor.set(Relay.Value.kOff);
while(true)
{
zipTieMotor.set(Relay.Value.kOn);
Timer.delay(0.005);
}
//encode_1.stop(); // Stop the conveyor belt encoder
//encode_2.stop(); // Stop the flag arm encoder
}
/*/--------------------TELEOP PERIOD--------------------------------/*/
public void teleopPeriodic()
{
// Initial Variables: This is to be sure that it is active
spikeOn_1 = false;
spikeOn_2 = false;
zipTieMotor.set(Relay.Value.kOff);
flagArmMotor.set(Relay.Value.kOff);
// Subsystem Control
while(true)
{
// Tank Drive
driveTrain.tankDrive(controller1.getRawAxis(CONT_1_LEFT_Y_AXIS), controller1.getRawAxis(CONT_1_RIGHT_Y_AXIS));
Timer.delay(0.005);
// Fly-Wheel
if(controller2.getRawButton(ZIP_TIE_WHEEL_BUTTON))
{
if(spikeOn_1 == false)
{
spikeOn_1 = true;
zipTieMotor.set(Relay.Value.kOn);
}
Timer.delay(0.5);
if(spikeOn_1 == true)
{
spikeOn_1 = false;
zipTieMotor.set(Relay.Value.kOff);
}
Timer.delay(0.5);
}
// Conveyor
// Launcher
// Flag Arm Control
if(controller2.getRawButton(FLAG_ARM_CONTROLLER)) // Move the flag arm by button command
{
if(spikeOn_2 == false)
{
spikeOn_2 = true;
flagArmMotor.setDirection(Relay.Direction.kForward);
flagArmMotor.set(Relay.Value.kOn);
}
Timer.delay(0.5);
if(spikeOn_2 == true)
{
spikeOn_2 = false;
flagArmMotor.setDirection(Relay.Direction.kReverse);
flagArmMotor.set(Relay.Value.kOn);
}
Timer.delay(0.5);
}
//encode_1.stop(); // Stop the conveyor belt encoder
//encode_2.stop(); // Stop the flag arm encoder
zipTieMotor.set(Relay.Value.kOff); // Turn of Zip-Tie Spike
flagArmMotor.set(Relay.Value.kOff); // Turn off Flag Arm Spike
}
}
}
Code:
/*----------------------------------------------------------------------------*/
/* 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.SimpleRobot;
import edu.wpi.first.wpilibj.DriverStationLCD;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Encoder;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* 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 MinotaurCode extends SimpleRobot
{
private DriverStationLCD dsLCD;
private RobotDrive driveTrain;
private Jaguar conveyor;
private Jaguar launcher;
private Relay zipTieWheel;
private Relay flagArmWheel;
private Joystick controller1;
private Joystick controller2;
private Timer time;
private Encoder conveyorControl;
private Encoder flagArmControl;
public static final int FLAG_ARM_AXIS = 6;
public static final int LEFT_Y_AXIS = 2;
public static final int RIGHT_Y_AXIS = 4;
public static final int ZIP_TIE_CONTROLLER = 1;
public static final int FLAG_ARM_CONTROLLER = 2;
public static final int PRELOADED_BALLS = 2;
public static final double LAUNCH_SPEED_DEFAULT = 0.5;
public static final double LAUNCH_SPEED_FULL = 1.0;
public static final double LAUNCH_SPEED_HALF = 0.5;
public static final double LAUNCH_SPEED_QUTR = 0.25;
public static final int LAUNCH_SPEED_FULL_BUTTON = 1;
public static final int LAUNCH_SPEED_HALF_BUTTON = 4;
public static final int LAUNCH_SPEED_QUTR_BUTTON = 3;
public static final int LAUNCH_BUTTON = 2;
public static final int CONVEYOR_BUTTON = 5;
boolean zipTieOn;
public MinotaurCode()
{
getWatchdog().setEnabled(false);
driveTrain = new RobotDrive(1, 2);
conveyor = new Jaguar(3);
launcher = new Jaguar(4);
zipTieWheel = new Relay(1, Relay.Direction.kForward);
flagArmWheel = new Relay(2, Relay.Direction.kBoth);
controller1 = new Joystick(1);
controller2 = new Joystick(2);
time = new Timer();
driveTrain.setSafetyEnabled(false);
conveyorControl = new Encoder(1, 2, false, Encoder.EncodingType.k4X);
flagArmControl = new Encoder(3, 4, false, Encoder.EncodingType.k4X);
}
public void robotInit()
{
// dsLCD.getInstance();
driveTrain.drive(0.0, 0.0);
driveTrain.stopMotor();
conveyor.stopMotor();
launcher.stopMotor();
zipTieWheel.set(Relay.Value.kOff);
flagArmWheel.set(Relay.Value.kOff);
conveyorControl.reset();
conveyorControl.stop();
flagArmControl.reset();
flagArmControl.stop();
zipTieOn = false;
}
public void disabled()
{
driveTrain.drive(0.0, 0.0);
driveTrain.stopMotor();
conveyor.stopMotor();
launcher.stopMotor();
zipTieWheel.set(Relay.Value.kOff);
flagArmWheel.set(Relay.Value.kOff);
conveyorControl.reset();
conveyorControl.stop();
flagArmControl.reset();
flagArmControl.stop();
}
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous()
{
time.start();
while(isAutonomous() && isDisabled())
{
flagArmWheel.setDirection(Relay.Direction.kForward);
zipTieWheel.set(Relay.Value.kOn);
Timer.delay(0.005);
//flagArmWheel.set(Relay.Value.kOn);
if(time.get() < 4)
{
//driveTrain.drive(0.5, 0.0);
//Timer.delay(0.005);
}
/*while(time.get() > 0 && time.get() < 20)
{
conveyor.set(LAUNCH_SPEED_HALF);
Timer.delay(0.005);
launcher.set(LAUNCH_SPEED_FULL);
Timer.delay(0.005);
}*/
}
time.stop();
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl()
{
while(isOperatorControl() && isEnabled())
{
// Drive Train
driveTrain.tankDrive(controller1.getRawAxis(LEFT_Y_AXIS), controller1.getRawAxis(RIGHT_Y_AXIS));
Timer.delay(0.005);
// Zip Tie Wheel
if(controller1.getRawButton(ZIP_TIE_CONTROLLER))
{
//zipTieOn = true;
zipTieWheel.set(Relay.Value.kOn);
}
// Flag Arm
/*while(controller2.getRawAxis(FLAG_ARM_AXIS) != 0)
{
if(controller2.getRawAxis(FLAG_ARM_AXIS) > 0)
{
flagArmWheel.setDirection(Relay.Direction.kForward);
flagArmWheel.set(Relay.Value.kOn);
}
else if(controller2.getRawAxis(FLAG_ARM_AXIS) < 0)
{
flagArmWheel.setDirection(Relay.Direction.kReverse);
flagArmWheel.set(Relay.Value.kOn);
}
Timer.delay(0.005);
}*/
// Conveyor
while(controller2.getRawButton(CONVEYOR_BUTTON))
{
conveyor.set(LAUNCH_SPEED_HALF);
Timer.delay(0.005);
}
// Launcher
//launcher.set(1.0);
Timer.delay(0.005);
while(controller2.getRawButton(LAUNCH_BUTTON))
{
if(controller2.getRawButton(LAUNCH_SPEED_FULL_BUTTON))
{
launcher.set(LAUNCH_SPEED_FULL);
Timer.delay(0.005);
}
else if(controller2.getRawButton(LAUNCH_SPEED_HALF_BUTTON))
{
launcher.set(LAUNCH_SPEED_HALF);
Timer.delay(0.005);
}
else if(controller2.getRawButton(LAUNCH_SPEED_QUTR_BUTTON))
{
launcher.set(LAUNCH_SPEED_QUTR);
Timer.delay(0.005);
}
else
{
launcher.set(LAUNCH_SPEED_DEFAULT);
Timer.delay(0.005);
}
}
}
}
}
4.) Watchdog I have to disable it at school to run the robot, but when competition comes, does it always stay on? (I know it stays on but why is there a difference where it is active?) 5.) Is DriverStationLCD required and if so, what does it do and how. I hear it is for user messages, but I haven't gotten that far yet. Thank you in advanced for you useful information in any way shape or form no matter how cruel. It's crucnch time and we are all going to make it. Happy Competitions and be Professional Gracefully, like a robot! P.S. I will be posting this in the Java section of Programming thread under same name. LINK: http://www.chiefdelphi.com/forums/sh...d.php?t=102952 Last edited by NS_Radication : 16-02-2012 at 05:25. Reason: Link added! |
|
#2
|
||||
|
||||
|
Re: Robot Nightmare!
I may have an answer to number 1 for you.
Do you have the wiring right? This screwed me up for awhile. "N" should be negative, while "La" and "Lb" should be positive, and be connected by a wire. |
|
#3
|
||||
|
||||
|
Re: Robot Nightmare!
Quote:
Code:
1. 9201 (Analog Breakout) 2. 9403 (Digital Sidecar) 3. 9472 (Solenoid Breakout) 4. Empty 5. Empty 6. 9403 (Digital module) 7. Empty 8. Empty Quote:
Quote:
The E4P encoders have 4 wires: an orange, blue, yellow, and brown. These 4 wires will splice into two digital I/O connections. The orange connects to a +5V; the brown to a ground, and the yellow and blue to two signal pins (these are channels A and B of the encoder output; I can't remember which is which). It doesn't matter whether the power pin you use is next to the yellow or the blue, and it doesn't matter for the ground pin, as long as they're from the digital I/O. Neither encoders nor microswitches need separate power supplies to function. Your engineers should be the ones asking how to mount the encoders, but the answer is anywhere around a 1/4" output shaft. The E4Ps are designed to read the rotation of a 1/4" shaft, and as such, should be appropriately mounted such that they are doing so. Most Andymark provided gearboxes include methods to mount encoders. For applications like window motors, you can include idler shafts that are spun by the driveshaft for the encoder to read, or turn the end of the driveshaft down so the encoder can be mounted there. |
|
#4
|
||||
|
||||
|
Re: Robot Nightmare!
One problem we were running into for our PWMs was that the cables were plugged in wrong, or they were broken. Hope this helps
|
|
#5
|
||||
|
||||
|
Re: Robot Nightmare!
my team had a similar problem with the light and we also found we where having problems with some of the pwms so we tried our spare digital sidecar and it still wouldn't work so we did some other diagnostics and figured out that the ribbon cable given to us in the kop was bad so i suggest trying another ribbon cable
|
|
#6
|
|||||
|
|||||
|
Re: Robot Nightmare!
Marco,
If the green LED next to the RSL connector on the Digital Side Car is flashing then the RSL should also flash the same. The LED is in parallel with the connector. Although rare, it is possible you have two dead RSLs. It happens. You did not specify that your DSC is connected to the PD so I am going to mention that is also a common problem. There must be three LEDs on the DSC that must be illuminated and bright. It is possible for the DSC to receive some power through the 37 pin connector but not enough to drive everything including PWM, relays and the RSL. Now I am going to remind everyone who is reading here that some ribbon cable shipped in the KOP was improperly terminated and can produce some of the results you are reporting. Did you make the repairs as suggested on the FIRST website? You now have the correct layout for modules in the Crio. This will help with many of your issues as well. |
|
#7
|
||||
|
||||
|
Re: Robot Nightmare!
Check all pwm cables for continuity, tug test them, and once you confirm that they work as required, hot glue them in place!
|
|
#8
|
||||
|
||||
|
Re: Robot Nightmare!
Quote:
|
|
#9
|
|||||
|
|||||
|
Re: Robot Nightmare!
Marco,
You must connect a power cable from a PD breaker output to the input of the DSC. The lights you are seeing are an indication that you are getting some leakage through the 37 pin cable but not enough to turn on the circuitry on the DSC. The power for the RSL comes from the +12 volt input to the DSC. Without it the RSL will never come on. |
|
#10
|
||||
|
||||
|
Re: Robot Nightmare!
Thank you, the light works because it was in a 5V plugin and is now in a 12V 20amp lugin. Can anyone supply simple spike relay code because the one I got to work no longer works and tell me how the PWMs go in. The diagram earlier was not helpful. Does the PWM GND go towards the inside of the spike. And does the PWM of the relay go towards the blue lock on the DSC?
|
|
#11
|
||||
|
||||
|
Re: Robot Nightmare!
UPDATE: we have a moving drivetrain, working RSL (now that it's on, it is annoying, lol), working Jaguar and spikes, simple robot based Java program, not using encoders.
NEED TO DO: I understand what the symbols on micro switches do, but how do I plug it in? Where oncRIO and DSC? What wire do I use? Please be more specific. We are getting the Axis 106 camera and trying to get that to work as well as the Kinect. Any advice or tutorial would be appreciated and I know it is late to be working on this part this late in build season .Can anyone tell me why IterativeRobot does not like my input, even when based off sample programs or other team's previous years' programs (for testing ONLY)? Thank you again in advanced and for all your help! Happy Competition and good luck! |
|
#12
|
||||
|
||||
|
Re: Robot Nightmare!
if you are using microswitches to limit motion, you can plug them directly into the jag. On the right side, there are two jumpers. If you take a jumper out an replace it with a limit switch, it will prevent movement in one direction only. When the two pins of the switch are electrically conducting to each other, movement is allowed. when they are disconnected, movement is prevented in that direction.
On Spikes, the three wire cable port has a B label for the Black wire. Is your RSL on solid when enabled, or does it blink off very quickly every so often? |
|
#13
|
||||
|
||||
|
Re: Robot Nightmare!
The micro switches are for adding and subtracting balls, so how can I hook them up as digital inputs for the cRio and the DSC. it is simplistic yet I do not know where to start.
Thank you in advanced! Happy Competition! |
|
#14
|
|||||
|
|||||
|
Re: Robot Nightmare!
The switch should be wired to a DIO on the Digital Sidecar. C (Common) on the switch goes to (-). Either NO (Normally Open) or NC (Normally Closed) goes to SIG. The center +V pin of the DIO is not connected.
If you choose the NC pin, an activated switch reads as true and a non-activated switch reads as false. Swap that for NO. |
|
#15
|
||||
|
||||
|
Re: Robot Nightmare!
What type of wire should I use because it seems that I have to cut off a male end of a PWM and attach it somehow. So is that how to wire it, if so, how do I isolate the poles? Electrical tape for protecting and holding wires that may be looped thru the switch area?
Thank you in advanced, this is getting clearer but not there yet. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|