![]() |
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....:confused:
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); |
| All times are GMT -5. The time now is 13:36. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi