Go to Post oh, the prom! I thought you were missing a PROM (Programable Read Only Memory) ...you had me worried for a minute, I dont know if IFI has any spare PROMs. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 02-19-2011, 02:05 PM
Cody Trey's Avatar
Cody Trey Cody Trey is offline
Programing = hard + fun
FRC #2582 (Panther Bots)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2009
Location: US
Posts: 31
Cody Trey is an unknown quantity at this point
Send a message via Yahoo to Cody Trey
Question spike code acting funny

we have one spike on our robot this year to control a claw, but it will only go in reverse, I am stumped as to why it is doing this....

Code:

#include "WPILib.h"

/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*/
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot;
Joystick stick;// robot drive system
Joystick stick2;
Joystick stick3;
Victor joint1;
Victor joint2;
Victor joint3;
Relay Claw;

public:
RobotDemo(void):
myRobot(1, 2, 3, 9),
stick(1),
stick2(2),
stick3(3),
joint1(6),
joint2(7),
joint3(8),
Claw(1)

{
myRobot.SetExpiration(0.1);
}

/**
* Drive left & right motors for 2 seconds then stop
*/
void Autonomous(void)
{
myRobot.SetSafetyEnabled(false);
myRobot.Drive(0.25, 0.0); // drive forwards half speed
Wait(1.0); // for 2 seconds
myRobot.Drive(0.0, 0.0); // stop robot

}

/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.MecanumDrive_Polar(stick.GetMagnitude(), stick.GetDirectionDegrees(), stick.GetZ()); // drive with arcade style (use right stick)
Wait(0.005); // wait for a motor update time
joint1.Set(stick2.GetY());
joint2.Set(stick2.GetX());
joint3.Set(stick3.GetY());
if (stick2.GetTrigger())
Claw.Set(Relay::kForward);
if (stick3.GetTrigger())
Claw.Set(Relay::kReverse);
else
Claw.Set(Relay::kOff);
}
}
};

START_ROBOT_CLASS(RobotDemo);
__________________
Love, Peace, and Robot Grease
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 10:31 AM.

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