Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Technical Discussion (http://www.chiefdelphi.com/forums/forumdisplay.php?f=22)
-   -   Drive Train Curves Only While Backing Up (http://www.chiefdelphi.com/forums/showthread.php?t=134414)

Ozuru 12-02-2015 11:01

Drive Train Curves Only While Backing Up
 
Hello,

For some reason our drive train is curving to the right only when we backup. When we use the joysticks, it does not curve. When we set the talon manually (Talon.set(-1)), it curves to the right pretty severely.

We're using a 6-wheel drive train (3 on each side) with a mini toughbox. Our motors are 4 KoP CIM motors and we're using 4 talons for our motor controllers. We're splitting the PWM cable so we're only using two PWM cables to access the 4 talons. We're kind of unsure what this could be so I was wondering if anyone had an issue like this before or what your ideas might be as to what's causing it.

Thanks!

notmattlythgoe 12-02-2015 11:03

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442438)
Hello,

For some reason our drive train is curving to the right only when we backup. When we use the joysticks, it does not curve. When we set the talon manually (Talon.set(-1)), it curves to the right pretty severely.

We're using a 6-wheel drive train (3 on each side) with a mini toughbox. Our motors are 4 KoP CIM motors and we're using 4 talons for our motor controllers. We're splitting the PWM cable so we're only using two PWM cables to access the 4 talons. We're kind of unsure what this could be so I was wondering if anyone had an issue like this before or what your ideas might be as to what's causing it.

Thanks!

Are you making sure to set all of the talons manually? What do the diagnostic lights on the talons do when the robot is backing up?

MrForbes 12-02-2015 11:04

Re: Drive Train Curves Only While Backing Up
 
Did you calibrate the speed controllers?

Ozuru 12-02-2015 11:08

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by notmattlythgoe (Post 1442439)
Are you making sure to set all of the talons manually? What do the diagnostic lights on the talons do when the robot is backing up?

I think so -- I'm invoking the RobotDrive.tankDrive(double left, double right) method.

The lights are a solid green when backing up. This is due to the fact that our motors are sort of hooked up backwards -- from the way it was explained to me we would have to swap the negative and the positive wires to fix it in hardware (which is supposedly a big no-no) so I've been compensating for it in programming. Is this what most teams do?

Ozuru 12-02-2015 11:08

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by MrForbes (Post 1442440)
Did you calibrate the speed controllers?

No, we did not -- I didn't know that this is possible. How would I go about doing this?

zachrobo1 12-02-2015 11:18

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442444)
No, we did not -- I didn't know that this is possible. How would I go about doing this?

You are using the KOP Talons, right? This is the manual for them.
http://www.crosstheroadelectronics.c...Manual_1_1.pdf

On page 7 are the calibration instructions.

Ozuru 12-02-2015 11:39

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by zachrobo1 (Post 1442455)
You are using the KOP Talons, right? This is the manual for them.
http://www.crosstheroadelectronics.c...Manual_1_1.pdf

On page 7 are the calibration instructions.

Thank you. I'm going to try that today. Would that be a valid explanation as to why it is curving?

MrForbes 12-02-2015 12:37

Re: Drive Train Curves Only While Backing Up
 
It's the first thing I would do....it doesn't cost anything, but time.

Ozuru 12-02-2015 13:01

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by MrForbes (Post 1442511)
It's the first thing I would do....it doesn't cost anything, but time.

Got it.

We swapped the PWM cables in the RoboRIO (port 0's cables are now in 1 and port 1's cables are now in 0) and now, when reversing, we reverse while curving in the opposite direction. We hooked the output of them up to an oscilloscope and it is showing that one port's PWM is getting more signal than the other although in the code I am giving them the same values. Any ideas?

For example, if I do RobotDrive.tankDrive(-0.5, -0.5) it is producing the PWM similar to RobotDrive.tankDrive(-0.6, -0.5).

GeeTwo 12-02-2015 13:06

Re: Drive Train Curves Only While Backing Up
 
Are you declaring both motor controllers to be of the same class (e.g. not one Talon and one Jaguar)?

See the second paragraph in the white area of:
http://wpilib.screenstepslive.com/s/...ns-and-jaguars

MrForbes 12-02-2015 13:06

Re: Drive Train Curves Only While Backing Up
 
Are you saying that the direction of curving is following the code, not the hardware?

if so, you'll have to get some help from a programmer....and I suggest you post images or listings of your code so they can see what you have done.

GeeTwo 12-02-2015 13:08

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442532)
.. and now, when reversing, we reverse while curving in the opposite direction.

That pretty much rules out any mechanical causes.

TikiTech 12-02-2015 13:10

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442532)
Got it.

We swapped the PWM cables in the RoboRIO (port 0's cables are now in 1 and port 1's cables are now in 0) and now, when reversing, we reverse while curving in the opposite direction. We hooked the output of them up to an oscilloscope and it is showing that one port's PWM is getting more signal than the other although in the code I am giving them the same values. Any ideas?

For example, if I do RobotDrive.tankDrive(-0.5, -0.5) it is producing the PWM similar to RobotDrive.tankDrive(-0.6, -0.5).

Were the motor controllers recalibrated?

Another thing to try is program for ports 1&2 to see if it related to a specific port since the issues are common to port 0

Aloha!

BitTwiddler 12-02-2015 13:43

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442442)
The lights are a solid green when backing up. This is due to the fact that our motors are sort of hooked up backwards -- from the way it was explained to me we would have to swap the negative and the positive wires to fix it in hardware (which is supposedly a big no-no) so I've been compensating for it in programming. Is this what most teams do?

I don't believe there is anything wrong with reversing the motor wiring to compensate for the left/right motor reversal problem. However we wire all of our motors the same way but in LabView we can open the motors with a parameter that tells the RoboRIO to reverse the meaning of the input values to the motors.

I suspect the call to the tank drive method or the open constructor would include similar parameters to invert the motor outputs.

Ozuru 12-02-2015 13:58

Re: Drive Train Curves Only While Backing Up
 
Thanks for all of the replies so far everyone.

I'm not there testing but have someone else testing. I'm going to be recalibrating them (and consequently posting here with my findings) sometime around 3 PM EST today. Maybe I'm interpreting the oscilloscope wrong -- here are the images I received. Linking to rather than embedding the pictures because they're massive.

Oscilloscope Reading #1
Oscilloscope Reading #2

The readings are from the PWM signals with the ports swapped running the very basic code below I wrote to confirm it wasn't a programming issue.

As for my code testing this, I literally just created a new IterativeRobot I just did:

Code:

RobotInit() {
Talon t = new Talon(0);
Talon t2 = new Talon(1);
RobotDrive rDrive = new RobotDrive(t, t2);
}

TeleopPeriodic() {
rDrive.tankDrive(-1, -1);
}

and this causes the curvature we're seeing. I have a more complex method in my actual robot code for CommandBased but, seeing as it curves with that basic code, I concluded that it was probably not my code.

GeeTwo 12-02-2015 14:04

Re: Drive Train Curves Only While Backing Up
 
I concur. What do the outputs of 3, 4, and so forth look like? Whichever one disagrees with the others should be reserved for standalone (one controller) functions, not the drive train.

Ozuru 12-02-2015 14:14

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by GeeTwo (Post 1442599)
I concur. What do the outputs of 3, 4, and so forth look like? Whichever one disagrees with the others should be reserved for standalone (one controller) functions, not the drive train.

I'm not sure I understand what you mean, sorry. Are you referring to the individual motors themselves or do you mean the PWM ports?

Alan Anderson 12-02-2015 14:50

Re: Drive Train Curves Only While Backing Up
 
I've seen strange discrepancies in drive motor response when the motors are cross-wired between a pair of speed controllers. It's probably not what you're seeing, but go ahead and double-check that each motor is properly wired to its single associated Talon.

Also double-check that your Talons are all the same variety. I didn't think the SR and non-SR models had different responses, but I know there are definitely differences between old and new Victors, so it's worth looking at.

Jared Russell 12-02-2015 14:58

Re: Drive Train Curves Only While Backing Up
 
Those measurements are from the PWM port, right?

Can you post the full source code of the IterativeRobot test you just made?

BitTwiddler 12-02-2015 15:01

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442591)
Thanks for all of the replies so far everyone.

I'm not there testing but have someone else testing. I'm going to be recalibrating them (and consequently posting here with my findings) sometime around 3 PM EST today. Maybe I'm interpreting the oscilloscope wrong -- here are the images I received. Linking to rather than embedding the pictures because they're massive.

Oscilloscope Reading #1
Oscilloscope Reading #2

The readings are from the PWM signals with the ports swapped running the very basic code below I wrote to confirm it wasn't a programming issue.

.

I see the difference in pulse widths which would make one side travel faster than the other. I'm betting this would be solved by recalibrating the controllers to the input values.

GeeTwo 12-02-2015 15:07

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442615)
I'm not sure I understand what you mean, sorry. Are you referring to the individual motors themselves or do you mean the PWM ports?

The PWM ports. I was interested in what the variation in pulse width is across the various ports. If you've got variation, each subsystem with multiple controllers should use "matched" ports.

GeeTwo 12-02-2015 15:09

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by BitTwiddler (Post 1442647)
I see the difference in pulse widths which would make one side travel faster than the other. I'm betting this would be solved by recalibrating the controllers to the input values.

These pulse widths are being determined by the 'RIO, not the controllers.

E Dawg 12-02-2015 15:21

Re: Drive Train Curves Only While Backing Up
 
We had exactly the same problem earlier in the season and it turned out to be the joysticks, so make sure it's not those. You can do this by watching the joystick outputs on the Dashboard. If that is the problem, you can easily fix it by putting in a bigger deadband.

Ozuru 12-02-2015 15:34

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Jared Russell (Post 1442646)
Those measurements are from the PWM port, right?

Can you post the full source code of the IterativeRobot test you just made?

Correct -- the measurements are from the PWM port.

Code:


package org.usfirst.frc.team2559.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.Talon;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Robot extends IterativeRobot {
    /**
    * This function is run when the robot is first started up and should be
    * used for any initialization code.
    */
       
        Talon talon0 = new Talon(3);
        Talon talon1 = new Talon(4);
               
    public void robotInit() {
           

    }

    /**
    * This function is called periodically during autonomous
    */
    public void autonomousPeriodic() {
            talon0.set(-0.2);
            talon1.set(0.2);
    }

    public void teleopInit() {
    }
    /**
    * This function is called periodically during operator control
    */
    public void teleopPeriodic() {
           
    }
   
    /**
    * This function is called periodically during test mode
    */
    public void testPeriodic() {
   
    }
   
}

At this point, due to the discrepancies in the PWM readings, I'm medium-high confident that the issue is being caused by the RoboRIO itself and not motor controllers. At the moment I'm testing trying not splitting the PWM cables and declaring each motor individually and just doing RobotDrive.tankDrive().

Are those readings normal? Has anyone ever had this issue of the PWM signals having about a 200ms delay hooked up to an oscilloscope? Is this expected and does calibrating the talons somehow take care of this?

Jared Russell 12-02-2015 15:38

Re: Drive Train Curves Only While Backing Up
 
This is expected behavior. -0.2 is represented by a different PWM pulsewidth than 0.2.

If you set both Talons to 0.2 or -0.2 simultaneously, I'd bet you see nearly identical pulses.

Ozuru 12-02-2015 15:41

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Jared Russell (Post 1442695)
This is expected behavior. -0.2 is represented by a different PWM pulsewidth than 0.2.

If you set both Talons to 0.2 or -0.2 simultaneously, I'd bet you see nearly identical pulses.

I just changed the testing code to this now and the issue persists. Shouldn't this have fixed it?

Code:

package org.usfirst.frc.team2559.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Robot extends IterativeRobot {
    /**
    * This function is run when the robot is first started up and should be
    * used for any initialization code.
    */
       
        Talon talonleft0 = new Talon(3);
        Talon talonleft1 = new Talon(4);
        Talon talonright0 = new Talon(5);
        Talon talonright1 = new Talon(6);
        RobotDrive rDrive;
               
    public void robotInit() {
            rDrive = new RobotDrive(talonleft0, talonleft1, talonright0, talonright1);

    }

    /**
    * This function is called periodically during autonomous
    */
    public void autonomousPeriodic() {
            rDrive.tankDrive(-0.4, -0.4);
    }

    public void teleopInit() {
    }
    /**
    * This function is called periodically during operator control
    */
    public void teleopPeriodic() {
           
    }
   
    /**
    * This function is called periodically during test mode
    */
    public void testPeriodic() {
   
    }
   
}


Jared Russell 12-02-2015 15:49

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442699)
I just changed the testing code to this now and the issue persists. Shouldn't this have fixed it?

Code:

package org.usfirst.frc.team2559.robot;

import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Talon;

/**
 * The VM is configured to automatically run this class, and to call the
 * functions corresponding to each mode, as described in the IterativeRobot
 * documentation. If you change the name of this class or the package after
 * creating this project, you must also update the manifest file in the resource
 * directory.
 */
public class Robot extends IterativeRobot {
    /**
    * This function is run when the robot is first started up and should be
    * used for any initialization code.
    */
       
        Talon talonleft0 = new Talon(3);
        Talon talonleft1 = new Talon(4);
        Talon talonright0 = new Talon(5);
        Talon talonright1 = new Talon(6);
        RobotDrive rDrive;
               
    public void robotInit() {
            rDrive = new RobotDrive(talonleft0, talonleft1, talonright0, talonright1);

    }

    /**
    * This function is called periodically during autonomous
    */
    public void autonomousPeriodic() {
            rDrive.tankDrive(-0.4, -0.4);
    }

    public void teleopInit() {
    }
    /**
    * This function is called periodically during operator control
    */
    public void teleopPeriodic() {
           
    }
   
    /**
    * This function is called periodically during test mode
    */
    public void testPeriodic() {
   
    }
   
}


RobotDrive by default inverts the command to your right side drive motors (the authors assumed you'd wire red to + on both sides), so calling tankDrive(-.4, -.4) actually sends -.4 and +.4 to your Talons.

tankDrive(-.4, .4) or visa versa should result in identical pulsewidths.

Ozuru 12-02-2015 16:08

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Jared Russell (Post 1442703)
RobotDrive by default inverts the command to your right side drive motors (the authors assumed you'd wire red to + on both sides), so calling tankDrive(-.4, -.4) actually sends -.4 and +.4 to your Talons.

tankDrive(-.4, .4) or visa versa should result in identical pulsewidths.

Does this mean then that when going forwards (or backwards) one talon should be red and the other should be green?

I'm trying to calibrate the talons at the moment but they're simply flashing red (which means failure, according to the document). I'm pressing and holding them while going full throttle forward, going to neutral, and then going full throttle backwards, and then back to neutral. After that, I put them back into neutral. Is that how you guys usually do it?

Ozuru 12-02-2015 16:38

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442709)
Does this mean then that when going forwards (or backwards) one talon should be red and the other should be green?

I'm trying to calibrate the talons at the moment but they're simply flashing red (which means failure, according to the document). I'm pressing and holding them while going full throttle forward, going to neutral, and then going full throttle backwards, and then back to neutral. After that, I put them back into neutral. Is that how you guys usually do it?

Disregard the calibration question. I figured it out -- only calibrate an individual talon at a time. That was my issue.

Jared Russell 12-02-2015 17:17

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Ozuru (Post 1442709)
Does this mean then that when going forwards (or backwards) one talon should be red and the other should be green?

It depends on how you have the motors wired.

Normally, if you wire red to + on both the left and right side, you would expect to see one speed controller flash red while the other flashes green when driving forward (since you will have needed to invert one side in code because it is in the opposite physical orientation).

If you switch the motor leads on one side instead, you would NOT want to invert the command in code, and both sides would blink the same color.

Since there are two ways to invert each motor, it is easy to get confused. For this reason, I HIGHLY recommend NEVER inverting motors electrically...always do red to +, and invert in the code as necessary. This way, if you need to swap in a spare motor or speed controller, you never need to guess which way to wire it up because they are all always the same.

Ozuru 12-02-2015 22:25

Re: Drive Train Curves Only While Backing Up
 
I just wanted to update this and thank you all for your help. Calibrating each of the individual talons fixed this issue (or at least made the curve very hard to notice). I hope that if anyone else has this issue they see this thread and don't have to go through what we did, lol.

GeeTwo 12-02-2015 22:37

Re: Drive Train Curves Only While Backing Up
 
Quote:

Originally Posted by Jared Russell (Post 1442775)
I HIGHLY recommend NEVER inverting motors electrically...always do red to +, and invert in the code as necessary. This way, if you need to swap in a spare motor or speed controller, you never need to guess which way to wire it up because they are all always the same.

YES! Always connect the red wire to M+ and the black wire to M-. Exceptions can be deadly; unnecessary exceptions are criminal. Invert in code.


Quote:

Originally Posted by Ozuru (Post 1442296)
I just wanted to update this and thank you all for your help. Calibrating each of the individual talons fixed this issue (or at least made the curve very hard to notice). I hope that if anyone else has this issue they see this thread and don't have to go through what we did, lol.

On behalf of all who've replied on this thread: You're very welcome!


All times are GMT -5. The time now is 00:46.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi