Go to Post but eventually it seems that we realize that there's an I in FIRST, and the I stands for Inspiration, not for "me" - MrForbes [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 25-10-2014, 21:15
Team2634's Avatar
Team2634 Team2634 is offline
Robotics Member
AKA: Martin Garcia
FRC #2634 (Gryphons)
Team Role: Electrical
 
Join Date: Oct 2014
Rookie Year: 2010
Location: Canada
Posts: 1
Team2634 is an unknown quantity at this point
Can you please check our code? - FRC Java

I am the new programming lead in my team and well i did not learn much last year about programming so I kinda expected this to happen. When I put this code into the robot only BRDrive motor moves and very slowly. This happens when i turn on autonomous or telop. That motor is the only one on and i do not even touch any of the controls even in telop. I have no idea why this is happening. If you do not think that it is the programming please tell me hat you think it could be whether it be electrically or something when inputing the code into the robot or whatever.
Code:

import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.Jaguar;
import edu.wpi.first.wpilibj.Victor;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;

/**
* 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 RobotTemplate extends SimpleRobot {

public Joystick joyStick = new Joystick(1);
public RobotDrive tankDrive = new RobotDrive(1,2,3,4);
public Jaguar FLDrive = new Jaguar(1);
public Jaguar FRDrive = new Jaguar(2);
public Jaguar BLDrive = new Jaguar(3);
public Victor BRDrive = new Victor(4);
public Victor PickerFront = new Victor(5);
public Victor PickerRear = new Victor(6);
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
PickerFront.set(1.0);
PickerRear.set(1.0);
FLDrive.set(1.0);
FRDrive.set(1.0);
BLDrive.set(1.0);
BRDrive.set(1.0);
}

/**
* This function is called once each time the robot enters operator control.
*/
public void checkUserInputs() {

tankDrive.tankDrive((-joyStick.getY()), (-joyStick.getRawAxis(5)));

if (joyStick.getRawButton(1) == true) {
PickerFront.set(1.0);
} else if (joyStick.getRawButton(4) == true) {
PickerFront.set(-1.0);
} else if (joyStick.getRawButton(1) == true & joyStick.getRawButton(4) == true) {
PickerFront.set(0.0);
} else {
PickerFront.set(0.0);
}


if (joyStick.getRawButton(3) == true) {
PickerRear.set(1.0);
} else if (joyStick.getRawButton(2) == true) {
PickerRear.set(-1.0);
} else if (joyStick.getRawButton(3) == true & joyStick.getRawButton(2) == true) {
PickerRear.set(0.0);
} else {
PickerRear.set(0.0);
}

}

/**
* This function is called once each time the robot enters test mode.
*/
}

Last edited by Team2634 : 25-10-2014 at 22:56.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-10-2014, 21:39
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,085
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Can you please check our code? - FRC Java

  1. RobotDrive creates SpeedController objects when passed just numbers. Create the Jaguars before creating the RobotDrive object and pass it the Jaguars.
  2. autonomous() and checkUserInputs() need loops; they're only called once by the VM
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #3   Spotlight this post!  
Unread 25-10-2014, 21:51
Caleb Sykes's Avatar
Caleb Sykes Caleb Sykes is offline
Registered User
FRC #4536 (MinuteBots)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2009
Location: St. Paul, Minnesota
Posts: 1,062
Caleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond reputeCaleb Sykes has a reputation beyond repute
Re: Can you please check our code? - FRC Java

First off, when you post code here, please upload a file or use the code tags (the pound sign in the text editor). That would make your code much easier to read for us.

Quote:
When I put this code into the robot only BRFront motor moves and very slowly. This happens when i turn on autonomous or telop. That motor is the only one on and i do not even touch any of the controls even in telop. I have no idea why this is happening. If you do not think that it is the programming please tell me hat you think it could be whether it be electrically or something when inputing the code into the robot or whatever.
Are you referring to "BRDrive"? I don't see a "BRFront" in this code anywhere.

A common cause of small motor variations like this is that your speed controllers are not correctly zeroed. This document explains the calibration procedure for Victors, which I assume that you are using here. I would recommend recalibrating this controller to see if that corrects the slow spinning.


In your code, you define all of your drive speed controllers individually, as well as a RobotDrive object. I'm not sure if this specifically is causing you any issues, but it is redundant and bad programming practice to allow outputs to be controlled from two sources.
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:41.

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