Go to Post You want to be treated like a professional, so you need to continue to act like one even if the odds are against you. - Eugenia Gabrielov [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #46   Spotlight this post!  
Unread 14-02-2016, 01:31
scca229 scca229 is offline
FTA acquiring knowledge
AKA: Nate
FRC #0060
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2011
Location: South of Phoenix, Arizona
Posts: 215
scca229 has a spectacular aura aboutscca229 has a spectacular aura about
Re: Twitchy Motors

Quote:
Originally Posted by hwu24110 View Post
I've already tried swapping the ports 0, 1, 2, and 3 with 4, 5, 6, and 7.

As this was a test board, I didn't feel like scrounging around the PWM bin for Y cables. If you feel like that is the issue, I might try it out tomorrow.
Forgot that was a test board when I mentioned the Y-cables.

Before swapping out for Y-cables, have you tried removing 3 of the existing ones and seeing if the issue is still occurring? Only have one connected at a time and see if you can narrow down the specific cable/port/controller combination that triggers the condition? The video only shows one side of the drive train twitching so I'm not sure if the other side is doing it as well like ours was.
__________________
Nate
  #47   Spotlight this post!  
Unread 14-02-2016, 01:36
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Twitchy Motors

In addition to what Nate said:

This only occurs when the robot is enabled, correct?

Another thing you could try, although I imagine it will have no effect, is try switching languages to C++ and see if the problem still occurs. Just use the default example code and see if it twitches.
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #48   Spotlight this post!  
Unread 14-02-2016, 12:52
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

Both sides twitch. I removed all but one PWM for each talon and each talon individually twitches.

I set it to autonomous and found it didn't twitch. I set each motor value to 0 and found it still didn't twitch. To make sure I coded it right, I set one side to a value of 1 and it moved constantly at full speed while the other side didn't move at all.

It only twitches when enabled in TeloOp.
  #49   Spotlight this post!  
Unread 14-02-2016, 12:59
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

Huh. Well I switched C++ and slightly modified the code (someone should check if I entered the motor ports correctly) and the motors didn't twitch.

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
{
	RobotDrive myRobot; // robot drive system
	Joystick stick; // only joystick
	SendableChooser *chooser;
	const std::string autoNameDefault = "Default";
	const std::string autoNameCustom = "My Auto";

public:
	Robot() :
			myRobot(4, 5, 6, 7),	// these must be initialized in the same order
			stick(0),		// as they are declared above.
			chooser()
	{
		//Note SmartDashboard is not initialized here, wait until RobotInit to make SmartDashboard calls
		myRobot.SetExpiration(0.1);
	}

	void RobotInit()
	{
		chooser = new SendableChooser();
		chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault);
		chooser->AddObject(autoNameCustom, (void*)&autoNameCustom);
		SmartDashboard::PutData("Auto Modes", chooser);
	}

	/**
	 * This autonomous (along with the chooser code above) shows how to select between different autonomous modes
	 * using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
	 * Dashboard, remove all of the chooser code and uncomment the GetString line to get the auto name from the text box
	 * below the Gyro
	 *
	 * You can add additional auto modes by adding additional comparisons to the if-else structure below with additional strings.
	 * If using the SendableChooser make sure to add them to the chooser code above as well.
	 */
	void Autonomous()
	{
		std::string autoSelected = *((std::string*)chooser->GetSelected());
		//std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault);
		std::cout << "Auto selected: " << autoSelected << std::endl;

		if(autoSelected == autoNameCustom){
			//Custom Auto goes here
			std::cout << "Running custom Autonomous" << std::endl;
			myRobot.SetSafetyEnabled(false);
			myRobot.Drive(-0.5, 1.0); 	// spin at half speed
			Wait(2.0); 				//    for 2 seconds
			myRobot.Drive(0.0, 0.0); 	// stop robot
		} else {
			//Default Auto goes here
			std::cout << "Running default Autonomous" << std::endl;
			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 arcade steering.
	 */
	void OperatorControl()
	{
		myRobot.SetSafetyEnabled(true);
		while (IsOperatorControl() && IsEnabled())
		{
			myRobot.ArcadeDrive(stick); // drive with arcade style (use right stick)
			Wait(0.005);				// wait for a motor update time
		}
	}

	/**
	 * Runs during test mode
	 */
	void Test()
	{
	}
};

START_ROBOT_CLASS(Robot)
  #50   Spotlight this post!  
Unread 14-02-2016, 13:05
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Twitchy Motors

That C++ code is correct, and if it didn't twitch then the problem seems to be with Java.

Do you have the latest updates and everything installed for Java/WPILib?
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #51   Spotlight this post!  
Unread 14-02-2016, 13:13
philso philso is offline
Mentor
FRC #2587
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Houston, Tx
Posts: 938
philso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond repute
Re: Twitchy Motors

Quote:
Originally Posted by hwu24110 View Post
Both sides twitch. I removed all but one PWM for each talon and each talon individually twitches.

I set it to autonomous and found it didn't twitch. I set each motor value to 0 and found it still didn't twitch. To make sure I coded it right, I set one side to a value of 1 and it moved constantly at full speed while the other side didn't move at all.

It only twitches when enabled in TeloOp.
It seems that your hardware is probably Okay. What you have posted above makes me think that it is the VALUES that you are sending to the motor controllers that may be the problem. Can you log the values sent to the motor controller or display them on your driver station?

Do you have any dead-band in your software so that the joysticks must move a significant amount before the system responds? I did not notice any mention of dead-band in this thread yet. In Auto-mode, dead-band is not an issue since the software should be ignoring your joysticks. Perhaps set your dead-band to some large value to see what effect it has.
  #52   Spotlight this post!  
Unread 14-02-2016, 13:35
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

I can't check the firmware version because the web dashboard is showing a white screen. (If I remember correctly, the version number is 3.0.0f0)

My eclipse plugins versions are now updated to 0.1.0.201602112135.

When I image the roborio I use the FRC_roboRIO_2016_v19.zip image.

The JRE is ARMv7 Linux - VFP, SOftFP ABI, Little Endian^2.

Since I updated the eclipse plugins, I now have this message in the driver station:

ERROR 1 PWM 7... Output not updated often enough. java.lang.Thread.run(Thread.java:745)
ERROR 1 PWM 6... Output not updated often enough. java.lang.Thread.run(Thread.java:745)
ERROR 1 PWM 5... Output not updated often enough. java.lang.Thread.run(Thread.java:745)
ERROR 1 PWM 4... Output not updated often enough. java.lang.Thread.run(Thread.java:745)
  #53   Spotlight this post!  
Unread 14-02-2016, 13:49
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

I do not have any dead band. Earlier I tested it by setting the values to 0 and it still twitched, so i don't think it's the controllers.



I unplugged the controller so it wouldn't receive any input.
  #54   Spotlight this post!  
Unread 14-02-2016, 15:07
philso philso is offline
Mentor
FRC #2587
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Houston, Tx
Posts: 938
philso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond reputephilso has a reputation beyond repute
Re: Twitchy Motors

You need some dead-band. It allows your system to ignore the noise that you will invariably have coming out of your joysticks. Do a search on this forum for how to properly implement the dead-band.
  #55   Spotlight this post!  
Unread 14-02-2016, 17:48
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

I've implemented a deadband, but it still twitches.

Code:
	public void operatorControl() {
    	LF.setSafetyEnabled(true);
    	LR.setSafetyEnabled(true);
    	RF.setSafetyEnabled(true);
    	RR.setSafetyEnabled(true);
    	while (isOperatorControl() && isEnabled()) {
        	LF.set(-deadband(stickL.getRawAxis(1)));
        	LR.set(-deadband(stickL.getRawAxis(1)));
        	RF.set(deadband(stickR.getRawAxis(1)));
        	RR.set(deadband(stickR.getRawAxis(1)));
        	C.setClosedLoopControl(true);
        	if(controller.getRawButton(5)){
       		 D.set(DoubleSolenoid.Value.kForward);
        	}
        	else if(controller.getRawButton(6)){
       		 D.set(DoubleSolenoid.Value.kReverse);
        	}
        	Timer.delay(0.005);   	 // wait for a motor update times
    	}
	}

	public double deadband(double JoystickValue) {
   	 double deadbandreturn = 0;
   	 if(Math.abs(JoystickValue)<.2){
   		 return 0;
   	 }
   	 else {
   		 deadbandreturn = JoystickValue;
   	 }
   	 return deadbandreturn;
  #56   Spotlight this post!  
Unread 14-02-2016, 19:15
JamesCH95's Avatar
JamesCH95 JamesCH95 is offline
Hardcore Dork
AKA: JCH
FRC #0095 (The Grasshoppers)
Team Role: Engineer
 
Join Date: Dec 2004
Rookie Year: 2001
Location: Enfield, NH
Posts: 1,848
JamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond reputeJamesCH95 has a reputation beyond repute
Re: Twitchy Motors

Have you tried switching out the joystick or game pad?
__________________
Theory is a nice place, I'd like to go there one day, I hear everything works there.

Maturity is knowing you were an idiot, common sense is trying to not be an idiot, wisdom is knowing that you will still be an idiot.
  #57   Spotlight this post!  
Unread 14-02-2016, 21:42
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

Yes, I've swapped between an xbox controller and two Logitech Extreme 3D Pro joysticks. I don't think it's the controller because I've also tried running it without controllers and it still twitches.
  #58   Spotlight this post!  
Unread 14-02-2016, 21:52
nighterfighter nighterfighter is offline
1771 Alum, 1771 Mentor
AKA: Matt B
FRC #1771 (1771)
Team Role: Mentor
 
Join Date: Sep 2009
Rookie Year: 2007
Location: Suwanee/Kennesaw, GA
Posts: 835
nighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant futurenighterfighter has a brilliant future
Re: Twitchy Motors

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).
__________________
1771- Programmer, Captain, Drive Team (2009-2012)
4509- Mentor (2013-2015)
1771- Mentor (2015)
  #59   Spotlight this post!  
Unread 15-02-2016, 10:40
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

Neither time did it twitch.

I modified the code because you were using myrobot when it didn't exist.

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)

	{

		left1.SetExpiration(0.1);
		left2.SetExpiration(0.1);
		right1.SetExpiration(0.1);
		right2.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()
	{
		left1.SetSafetyEnabled(true);
		left2.SetSafetyEnabled(true);
		right1.SetSafetyEnabled(true);
		right2.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)
  #60   Spotlight this post!  
Unread 15-02-2016, 13:51
hwu24110 hwu24110 is offline
Registered User
FRC #0988
 
Join Date: Feb 2014
Location: Las Vegas
Posts: 44
hwu24110 is an unknown quantity at this point
Re: Twitchy Motors

We found the solution. It was because we were missing motor.setExpiration(0.1)

Code:
    public Robot() {
        stickL = new Joystick(0);
        stickR = new Joystick(1);
        controller = new Joystick(2);
        LF = new Talon(0);
        RF = new Talon(3);
        LR = new Talon(1);
        RR = new Talon(4);
        LF.setExpiration(0.1);
        RF.setExpiration(0.1);
        LR.setExpiration(0.1);
        RR.setExpiration(0.1);
Closed Thread


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 01: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