Go to Post Solutions are more likely to be implemented if you provide the solution along with the concern! - Jessica Boucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-01-2013, 13:11
y-aji y-aji is offline
Registered User
FRC #3734
 
Join Date: Dec 2011
Location: Lake Forest
Posts: 38
y-aji is an unknown quantity at this point
4 CIMs causing robot lockup

Good morning everyone,

We are now utilizing 4 CIMs instead of 2. The code works happily when configured for 2 motors, but when you configure it for 4, turning left (and only turning left) causes it to spin at full speed for about 1/4 of a second, then die. Very strange.

We have checked for wiring issues and CIM issues. We have tried leaving the code the same and unplugging 2 of the CIMs, then the other 2 to try to identify if it is hardware and the problem persisted whenever CIMs were separated.

We have tried unplugging the 4 CIMs from 1,2,3, and 4 and plugging them into 5,6,7 and 8 with the same results. Again, putting the code back to just 1 and 3 and it works just fine. We have also replaced all 4 CIMs and swapped out the 4 jaguars.

I'm down to wondering if it's the new cRIO we received this year. But that seems odd as it is fully functional outside this one turn. That or maybe the way your declare the CIMs has changed slightly. Any thoughts?

Oh! we have also tried 2 separate laptops, one running the 2012 software and one running the 2013.

Thanks!

The following is our code:

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.                                                               */
/*----------------------------------------------------------------------------*/

/* 
 * Ground Zero Template
 * This Template is to be utilized to troubleshoot the robot. Please make no
 * changes to this code. It's to be copied and branched off of for new projects
 * and is for reference only.
 * Are you trying to install netbeans? For the love of God, read:
 * http://first.wpi.edu/Images/CMS/First/Getting_Started_with_Java_for_FRC.pdf
 * 
 * TLDR:
 **Install NetBeans with Sun JDK and update completely
 **NetBeans->Tools->Plugin->Settings->Add:
 ***http://first.wpi.edu/FRC/java/netbeans/update/updates.xml
 **NetBeans->Tools->Plugin->Available->Check all that say FRC
 **Check for updates
 **NetBeans->Tools->Options->Misc->FRC->Team# 3734
*/

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.Relay.Value;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Timer;

/**
 * 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 AwesomOSimple extends SimpleRobot {
    
    // Attach digital sidecar to 4 Jaguar PWMs. Inputs expect (left,right) 
    // and have further ability to put in for 4 motor drive, listed as
    // (left,right,left 2, right 2). Further Jaguars can be added with the
    // jaguar declaration, but by default we are not using the jaguar
    // package.
    RobotDrive drive = new RobotDrive(1,3,2,4);
    
    // XBox Controller is treated exactly the same as a regular joystick with
    // 7 axes (only 6 available)
    /************************************************************************
     * XBox Controller Mappings
     * 
     * 1: A
     * 2: B
     * 3: X
     * 4: Y
     * 5: Left Bumper
     * 6: Right Bumper
     * 7: Back
     * 8: Start
     * 9: Left Joystick
     * 10: Right Joystick
     * 
     * Axis Mappings getRawAxis(1-6)
     * (all output is between -1 and 1)
     * 1: Left Stick X Axis     (Left:Negative ; Right: Positive)
     * 2: Left Stick Y Axis     (Up: Negative ; Down: Positive)
     * 3: Triggers: Left        (Positive ; Right: Negative)
     * 4: Right Stick X Axis    (Left: Negative ; Right: Positive)
     * 5: Right Stick Y Axis    (Up: Negative ; Down: Positive)
     * 6: Directional Pad       (Not recommended, buggy)
     ***********************************************************************/
    Joystick xboxControl = new Joystick(1);
    
    // Relays have to be announced prior to initialization and then must be
    // attached to a sidecar pin from within robotInit()
    Relay firingMechanism;
    int drivingStyleModifier = 0;
    
    /**
     * This method is called once each time AwesomO is enabled for both 
     * autonomous and tele-operated modes.
     */
    public void robotInit() {
        // Attach our predefined relay to a point on our digital sidecar
        firingMechanism = new Relay(1);
    }
    
    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        /*getWatchdog().setEnabled(true);
        getWatchdog().setExpiration(0.5);
        drive.drive(1,0);
        Timer.delay(2);
        drive.drive(0,0);*/
        // Let's get a sonar sensor as well as a directional sensor on this 
        // bad boy and get the robot patrolling the halls. So unnerving!
        for (int i = 0; i < 4; i++) {
            drive.drive(0.5, 0.0); // drive 50% fwd 0% turn
            Timer.delay(2.0); // wait 2 seconds
            drive.drive(0.0, 0.75); // drive 0% fwd 0% turn
        }
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while (true && isOperatorControl() && isEnabled()) // loop until change
        {
            //tank drive OR arcade drive available
            if (drivingStyleModifier == 1) {
                drive.arcadeDrive(xboxControl.getY(), xboxControl.getX());
            }
            else {
                drive.tankDrive(xboxControl.getY(), xboxControl.getRawAxis(5)); // drive w/ joysticks
            }
            
            if(xboxControl.getRawButton(1)){
                firingMechanism.set(Value.kForward);
            }
            
            // Firing mechanism example
            else if(xboxControl.getRawButton(2)){
                firingMechanism.set(Value.kReverse);
            }
            else {
                firingMechanism.set(Value.kOff);
            }
            
            // Toggle Y button activity
            if(xboxControl.getRawButton(4) && drivingStyleModifier == 0) {
                drivingStyleModifier = 1;
            }
            else if (xboxControl.getRawButton(4) && drivingStyleModifier != 0) {
                drivingStyleModifier = 0;
            }
            
            Timer.delay(0.005);
        }
    }
}
Reply With Quote
  #2   Spotlight this post!  
Unread 22-01-2013, 13:19
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: 4 CIMs causing robot lockup


Try carefully working your way down these two checklists:

http://www.chiefdelphi.com/forums/sh...39&postcount=5

http://www.chiefdelphi.com/forums/sh...19&postcount=4


Reply With Quote
  #3   Spotlight this post!  
Unread 22-01-2013, 13:56
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: 4 CIMs causing robot lockup

When you say you unplugged the CIM, did you unplug the CIM from the motor controller, or unplug the motor controllers PWM cable?

I don't see anything obviously wrong with your drive code, so I agree with Ether that it is likely an electrical issue.

One potential (but unrelated problem) with your code is your drivingStyleModifier toggle. Unless your driver can press the button and release it in less then 0.005 seconds, the driving style modifier will continually toggle. You'll want to remember the previous state of the button, and only toggle if the current state is true and the previous state was false.

Another potential (but unrelated problem) is your firing mechanism. If both buttons one and two are pressed, the relay will be set to forward and then very quickly be set to reverse. This isn't good for the hardware. You should use a if, else if, else structure to make sure that only one value is set for each iteration.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-01-2013, 14:12
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,798
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: 4 CIMs causing robot lockup

Have you checked that each motor is running the same direction? What you describe sounds like the motors are fighting each other causing the current to skyrocket.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
Reply With Quote
  #5   Spotlight this post!  
Unread 22-01-2013, 14:20
y-aji y-aji is offline
Registered User
FRC #3734
 
Join Date: Dec 2011
Location: Lake Forest
Posts: 38
y-aji is an unknown quantity at this point
Re: 4 CIMs causing robot lockup

Wow. Super embarrassing. I'm amazed it functioned at all. The digital sidecar was not powered at all. Totally not plugged in aside from the serial communications cable. I'll send a followup once I confirm that fixes it tonight.

Thank you!
Reply With Quote
  #6   Spotlight this post!  
Unread 22-01-2013, 14:22
y-aji y-aji is offline
Registered User
FRC #3734
 
Join Date: Dec 2011
Location: Lake Forest
Posts: 38
y-aji is an unknown quantity at this point
Re: 4 CIMs causing robot lockup

Oh, and thank you. I'll update the code to reflect those suggestions as I had noticed that it didn't switch driving modes when Y was hit and I can definitely identify the damage that could come from alternating current forward and backward rapidly in the device. Thank you guys!
Reply With Quote
  #7   Spotlight this post!  
Unread 22-01-2013, 22:25
y-aji y-aji is offline
Registered User
FRC #3734
 
Join Date: Dec 2011
Location: Lake Forest
Posts: 38
y-aji is an unknown quantity at this point
Re: 4 CIMs causing robot lockup

Yup, that's all that was wrong. Thank you guys!
Reply With Quote
  #8   Spotlight this post!  
Unread 23-01-2013, 06:59
protoserge's Avatar
protoserge protoserge is offline
CAD, machining, circuits, fun!
AKA: Some call me... Tim?
FRC #0365 (MOE) & former 836 Mentor)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Wilmington, DE
Posts: 754
protoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond repute
Re: 4 CIMs causing robot lockup

Quote:
Originally Posted by Al Skierkiewicz View Post
Have you checked that each motor is running the same direction? What you describe sounds like the motors are fighting each other causing the current to skyrocket.
FYI to someone who may find this... We had a new CIM that was not assembled correctly and spun backward. Make sure the scribe marks on the black case of the CIM line up with the marks on the silver ends.
Reply With Quote
  #9   Spotlight this post!  
Unread 23-01-2013, 07:27
Unsung FIRST Hero
Al Skierkiewicz Al Skierkiewicz is offline
Broadcast Eng/Chief Robot Inspector
AKA: Big Al WFFA 2005
FRC #0111 (WildStang)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Wheeling, IL
Posts: 10,798
Al Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond reputeAl Skierkiewicz has a reputation beyond repute
Re: 4 CIMs causing robot lockup

Quote:
Originally Posted by stinglikeabee View Post
FYI to someone who may find this... We had a new CIM that was not assembled correctly and spun backward. Make sure the scribe marks on the black case of the CIM line up with the marks on the silver ends.
????? The marks are there so that in assembly, the holes for the screws can be found.
__________________
Good Luck All. Learn something new, everyday!
Al
WB9UVJ
www.wildstang.org
________________________
Storming the Tower since 1996.
Reply With Quote
  #10   Spotlight this post!  
Unread 23-01-2013, 09:07
protoserge's Avatar
protoserge protoserge is offline
CAD, machining, circuits, fun!
AKA: Some call me... Tim?
FRC #0365 (MOE) & former 836 Mentor)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Wilmington, DE
Posts: 754
protoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond reputeprotoserge has a reputation beyond repute
Re: 4 CIMs causing robot lockup

To clarify my previous statement: the field magnets were reversed when the motor was assembled. Dissassembly and reversing the field magnets during reassembly fixed the rotation issue.
Reply With Quote
Reply


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 12:47.

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