In your Java code, you are addressing each Talon individually, and it is causing the motors to Twitch.
In the C++ code, the motors are NOT twitching, when you are calling the ArcadeDrive method.
Try addressing each talon in C++ and see if it twitches.
Try this code and see if it twitches:
Code:
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot 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.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
class Robot: public SampleRobot
{
Joystick stick; // left joystick
Joystick stick2; //right joystick
Talon left1;
Talon left2;
Talon right1;
Talon right2;
public:
Robot() :
stick(0),
stick2(1),
left1(4),
left2(5),
right1(6),
right2(7)
{
myRobot.SetExpiration(0.1);
}
void RobotInit()
{
}
void Autonomous()
{
left1.Set(0.0);
left2.Set(0.0);
right1.Set(0.0);
right2.Set(0.0);
}
void OperatorControl()
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl() && IsEnabled())
{
left1.Set(stick.GetY());
left2.Set(stick2.GetY());
right1.Set(-stick2.GetY());
right2.Set(-stick2.GetY());
Wait(0.005);
}
}
void Test()
{
}
};
START_ROBOT_CLASS(Robot)
Test it in Autonomous mode (where it sets values of 0.0), TeleOp mode (where it reads the Y axis of each joystick) and Test mode (where it does nothing).