Go to Post Clearly and clearly, the go-to place is Chief Delphi. It connects all the dots. - JaneYoung [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 21-02-2016, 10:00
CyberTeam5713 CyberTeam5713 is offline
Registered User
FRC #5713
 
Join Date: Feb 2016
Location: Michigan
Posts: 25
CyberTeam5713 is an unknown quantity at this point
Please Help ME !!!!!!!

We are programming our intake we got the intake to bring the ball in but we cant seem to get it to work to shoot it back out Here is the code.


Teleop Code

public void teleopPeriodic() {
while (isOperatorControl() && isEnabled()) {
Fulldrive.setSafetyEnabled(true);
Fulldrive.arcadeDrive(Drivestick);

if(controlStick.getRawButton(3)) {
IntakeBall.ShootBall(0.5);
}
else if(!controlStick.getRawButton(3)) {
IntakeBall.ShootBall(0.0);
}
if(controlStick.getRawButton(2)) { // Takes Ball
IntakeBall.GrabBall(0.5);
}
else if(!controlStick.getRawButton(2)) {
IntakeBall.GrabBall(0.0);
} Timer.delay(0.01); } }


I made a class for the intake/ shooter


import edu.wpi.first.wpilibj.Talon;

public class IntakeBall {

private Talon leftWheel, rightWheel;

public IntakeBall(Talon leftWheel, Talon rightWheel) {

this.leftWheel = leftWheel;
this.rightWheel = rightWheel;
}



public void GrabBall(double speed) { // Gets Ball in

leftWheel.set(-speed);
rightWheel.set(speed);
}

public void ShootBall(double speed) {
leftWheel.set(speed);
rightWheel.set(speed);
rightWheel.setInverted(true);
} }
Reply With Quote
  #2   Spotlight this post!  
Unread 21-02-2016, 11:22
Ty Tremblay's Avatar
Ty Tremblay Ty Tremblay is offline
Robotics Engineer
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Alton NH
Posts: 814
Ty Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond reputeTy Tremblay has a reputation beyond repute
Re: Please Help ME !!!!!!!

Try changing ShootBall to be the same as GrabBall but with the speed signs flipped so the motors go in opposite directions.
__________________
Reply With Quote
  #3   Spotlight this post!  
Unread 27-02-2016, 17:05
lakecat's Avatar
lakecat lakecat is offline
Cat Expert
AKA: Tristan Thompson
FRC #2635 (Lake Monsters)
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2012
Location: Lake Oswego, OR
Posts: 15
lakecat is an unknown quantity at this point
Re: Please Help ME !!!!!!!

I would avoid setting rightWheel to inverted, it may be the source of some of your errors. In fact, it seems like you don't need grabBall at all, considering it does the same thing as shootBall, except with a different method of getting one wheel to move the opposite direction of the other. It looks like you need to negate your input to shootBall in your first if statement.
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 08:13.

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