Go to Post ...last year's watchdog had a litter of watchpuppies. - EricVanWyk [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Spotlight this post!  
Unread 04-12-2015, 20:46
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,574
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Spike Code Problems

Quote:
Originally Posted by simon1636 View Post
So I updated my code, but nothing seems to be happening! Here's the updated version:

Code:
.
.
.
    public void operatorControl() {

        while (isOperatorControl() && isEnabled()) {

            myDrive.mecanumDrive_Cartesian(moveStick.getY(), rotateStick.getX(), moveStick.getX(), 0);

            if (rotateStick.getTrigger(GenericHID.Hand.kLeft) && isEnabled()) {
                relay.set(Relay.Value.kOff);
                relay.setDirection(Relay.Direction.kForward);
            }

        }

        //mecanumDrive_Polar(moveStick.getY(), moveStick.getX(), rotateStick.getX());
        Timer.delay(0.1);
    }

}
.
.
.
I see two issues:
First, you called relay.set(Relay.Value.kOff); This essentially disables the relay; it won't let either the forward or re reverse direction be enabled. The relay.set is usually called in the initialize method, unless the way in which it operates changes for different parts of the program.

Second, you don't have any way to turn the relay off. The if statement that wraps the relay.setDirection() should have an else case that does this.

Further, this if statement probably doesn't need the isEnabled() as part of the condition, as it was checked just a few microseconds earlier at the top of the while loop.

Edit: One more thing - didn't you mean to include the delay within the loop?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 04-12-2015 at 21:33.
Reply With Quote
 


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 09:16.

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