Go to Post Bomb squad, that grabber was the coolest way to grab a tetrahedral object in the history of grabbing tetrahedral objects. - IronVulture [more]
Home
Go Back   Chief Delphi > Technical > Programming
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
  #1   Spotlight this post!  
Unread 13-01-2016, 20:41
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
JAVA RobotDrive Motors Signal Out of Sync

During programming of our test stand in JAVA, we found that regardless of control channel for the move speed value, the motors start rotating at different points. This will cause a robot to turn at low speeds with no turning inputs.

This issue was confirmed with multiple channel changes of the motors, and the problem switching motors if the channel for motor signal is switched.

Is there an inherent problem in the RobotDrive or other library files that may be causing this problem?

We are using the arcadeDrive function to feed outputs to the robot.

Regardless of the changes made to the control scheme the problem persists. Resolution of this issue appears to require a PID controller to ensure constant direction without turning input. While this would be one way to solve a built in turn, this should not be required to make an aligned robot move straight forward.

Anyone with information on this issue would be much appreciated.
  #2   Spotlight this post!  
Unread 13-01-2016, 20:55
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: JAVA RobotDrive Motors Signal Out of Sync

Post your code?
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #3   Spotlight this post!  
Unread 13-01-2016, 21:57
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

Here is the current code we are using, for a controller we are using the Logitech X30 flight stick.
Code:

package org.usfirst.frc.team5837.robot;

import edu.wpi.first.wpilibj.CameraServer;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Victor;


public class Robot extends IterativeRobot {
	Victor R_Motor = new Victor(1);
	Victor L_Motor = new Victor(0);
	RobotDrive chassis = new RobotDrive(R_Motor ,L_Motor);
	
	Joystick drive = new Joystick(0);
	
	int autoLoopCounter;
	
	double yAxis = drive.getY();
	double xAxis = drive.getX();
	double slider = drive.getRawAxis(3);
	
	double yMath;
	double xMath;
	double sliderMath;
	
    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
    	CameraServer server = CameraServer.getInstance();
    	server.setQuality(50);
    	server.startAutomaticCapture("cam0");	
		
    }
	
	/**
     * This function is called once each time the robot enters Disabled mode.
     * You can use it to reset any subsystem information you want to clear when
	 * the robot is disabled.
     */
    public void disabledInit(){

    }
	
	public void disabledPeriodic() {
		
	}

	
    public void autonomousInit() {
    	autoLoopCounter = 0;
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {
    	
    	
    }

    public void teleopInit() {
    	
    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
    
    	xAxis = drive.getX();
    	yAxis = drive.getY();
    	slider = drive.getRawAxis(3);
    	
    	sliderMath = Math.abs((slider-1)/2);
    	
    	if (Math.abs(xAxis) < 0.25) {
    		xMath = 0;
    	}
    	else {
    		xMath = Math.signum(xAxis)*(Math.abs(xAxis) - .25)*1.333*sliderMath;
    	}
    	
    	if (Math.abs(yAxis) < 0.25){
    		yMath = 0;
    	}
    	else {
    		yMath = Math.signum(yAxis)*(Math.abs(yAxis) - .25)*1.333*sliderMath;
    	}
    	if (drive.getRawButton(2)){
       chassis.arcadeDrive(yMath, xMath);
    	}
       
    }
    
    
    public void testPeriodic() {
    }
}
  #4   Spotlight this post!  
Unread 13-01-2016, 22:00
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: JAVA RobotDrive Motors Signal Out of Sync

You can calibrate your speed controllers to fix this. If you look online, you can find a manual for your speed controller that should explain how.
  #5   Spotlight this post!  
Unread 13-01-2016, 22:07
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

But when I go into reverse the motor that starts first switches to the other motor; it isn't motor specific or even controller specific. More so which virtual motor it correlates to. Would calibrating the motors still fix this?
  #6   Spotlight this post!  
Unread 13-01-2016, 22:10
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: JAVA RobotDrive Motors Signal Out of Sync

Quote:
Originally Posted by FRCteam5837 View Post
But when I go into reverse the motor that starts first switches to the other motor; it isn't motor specific or even controller specific. More so which virtual motor it correlates to. Would calibrating the motors still fix this?
That makes sense if the controllers aren't calibrated.

The PWM controllers have a small deadband where they will give no power. If one controller considers the zero point to be slightly ahead of where it should be, it will be late to start when going forward and early to start when going backward.
  #7   Spotlight this post!  
Unread 13-01-2016, 22:14
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

Even if when I change motor controllers, meaning the on that previously started before and the one that started later are switched, the problem still happens with the same virtual motor.
  #8   Spotlight this post!  
Unread 13-01-2016, 22:27
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 602
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: JAVA RobotDrive Motors Signal Out of Sync

Try calibrating the joystick?
  #9   Spotlight this post!  
Unread 13-01-2016, 22:30
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

We have used the slider Axis on the front bottom in order to have no side to side input and the problem still occurred. Also we have a dead zone and using the control panel to have it as centered as possible it still happened. I'm wondering if the error is inside the RobotDrive function provided by FIRST that one motor doesn't start as soon. Thank you for helping, all ideas help; We will definitely calibrate them first thing tomorrow as well.
  #10   Spotlight this post!  
Unread 14-01-2016, 00:02
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: JAVA RobotDrive Motors Signal Out of Sync

Sounds like something is lagging. I would try disabling the camera stuff.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #11   Spotlight this post!  
Unread 14-01-2016, 00:54
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: JAVA RobotDrive Motors Signal Out of Sync

What type of speed controller are you using?
  #12   Spotlight this post!  
Unread 14-01-2016, 07:59
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

Victor SP controllers, and the camera isn't currently being used but I'll definitely comment it out for now.
  #13   Spotlight this post!  
Unread 14-01-2016, 10:33
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: JAVA RobotDrive Motors Signal Out of Sync

Quote:
Originally Posted by FRCteam5837 View Post
Victor SP controllers, and the camera isn't currently being used but I'll definitely comment it out for now.
Well, there's your problem. You created Victor objects, not VictorSP objects. Try changing them to VictorSP.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
  #14   Spotlight this post!  
Unread 14-01-2016, 11:44
FRCteam5837 FRCteam5837 is offline
Registered User
FRC #5837
 
Join Date: Jan 2016
Location: Waterloo
Posts: 9
FRCteam5837 is an unknown quantity at this point
Re: JAVA RobotDrive Motors Signal Out of Sync

I'll change that, would that cause the motors to be set different values?
  #15   Spotlight this post!  
Unread 14-01-2016, 12:07
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,102
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: JAVA RobotDrive Motors Signal Out of Sync

Yes, the PWM timing is different.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
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 03:13.

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