Hello we have a working mecanum code but we need to add dead band for a little better control. can any one help?
Code:
#include "WPILib.h"
// Team 1721 mecanum code 2013 By: Zakary Tobine at 2/11/13 10:33am
// Needs to add 2 relays; one for motor for shooter; one for frishbee pusher
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
public:
RobotDemo(void):
myRobot(1, 2, 3, 4), // these must be initialized in the same order
stick(1) // as they are declared above.
{
stick.SetAxisChannel(Joystick::kTwistAxis, 3);// Add the 3rd axis
myRobot.SetExpiration(0.1);// The time the motors stop moving after a value is sent
}
void Autonomous(void)
{
// Commented out till a later date
//myRobot.SetSafetyEnabled(false);
//myRobot.Drive(-0.5, 0.0); // drive forwards half speed
//Wait(2.0); // for 2 seconds
//myRobot.Drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with one joystick mecanum.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.MecanumDrive_Cartesian(stick.GetX(), stick.GetY(), stick.GetTwist());// Mecanum drive single joystick drive
Wait(0.005); // wait for a motor update time
}
}
/**
* Runs during test mode
*/
void Test() {
}
};
START_ROBOT_CLASS(RobotDemo);