Go to Post However, as a philosopher, while you need math, you can probably talk your way out of it. - sciguy125 [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 17-02-2012, 00:52
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Help! RobotDrive Error in all 3 languages

After having spent countless hours trying to solve this problem, we are now interested in what new ideas people might have towards solving the following problem. Please read through the entire post. I realize that it is rather lengthy, however this is an important problem that could possibly affect other teams.

When we first started the programming, we started with Java as our programming language. While trying to create a simple program, we discovered that while driving, the robot had a tendency to turn towards one side. After spending several hours solving a series of mechanical problems, we still had the same problem. We then began to test the output of the jaguars with our multi-meter. We discovered that one side was outputting approx. 12.5 volts while the other side was outputting approx. 10 volts. Believing that this was an issue with the jaguar firmware, we went to update the jaguar firmware, however have been unable to update the jaguar firmware so far due to the fact that we do not have access to a computer with a serial port outside of our school district (our school district does not allow us access to the necessary computers).

We later made the discovery that there was yet another problem. We decided to test the control circuit of the PWM cables. We discovered that one side was putting 2.27 volts through the control circuit while the other was putting 0.67 through on the other side. This led us to believe that it was not in fact a jaguar problem, but instead a problem with the cRIO or the digital sidecar. After having swapped out a series of different components, we decided to try something different.

Since we still had the electrical board from last year, we decided to run the program on the old electrical board. We made the necessary changes to the board (such as module placement and cRIO imaging) and then downloaded the test program. We discovered that an entire other electrical board had the same problem. After switching out an additional series of parts, we now believed it to be a programming error.

We then proceeded to reduce the program to the simplest program possible. We wrote the following piece of code.
Quote:
Please see the attached file JavaV1.txt
We then discovered that the program at what seemed to be the simplest level did not work properly.

Discovering that this piece of code did not work properly, we instead decided to try a different programming language. We then proceeded to reformat the cRIO, and prepare a new code sample in Wind River. We discovered that this code had the sample effect as the Java code that we had previously tried.
Quote:
Please see the attached file windriverV1.txt
Since the Wind River program did not work, we reasoned that the Java and Wind River ran on similar libraries, and were perhaps experiencing the same error. We then decided to try Labview on the robot. We reformatted the robot and deployed the basic template code provided with Labview. However this did not work either, providing the same result as Java and Wind River.

With time quickly shortening, we are in desperate need of some help with this problem. Any and all ideas would be appreciated.
Attached Files
File Type: txt JavaV1.txt (566 Bytes, 15 views)
File Type: txt windriverV1.txt (1.2 KB, 15 views)
  #2   Spotlight this post!  
Unread 17-02-2012, 00:58
ehochstein's Avatar
ehochstein ehochstein is offline
Coach, Volunteer & Mentor
AKA: Evan Hochstein
FTC #5943 (ESGM)
Team Role: Coach
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Bloomington, Minnesota
Posts: 933
ehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant futureehochstein has a brilliant future
Re: Help! RobotDrive Error in all 3 languages

Did you switch out the power wires? There could be a frayed wire somewhere...
__________________
Minnesota FIRST Senior Mentor | 2013-?

Stratasys Applications Engineering Technician | 2016-?

2009 Regional Win – 2470 @ 10k Lakes (Thanks 2826 and 1714)
2013 WFFA Recipient – 2470 @ 10K Lakes
2016 Ri3D: 'Snow Problem Reveal
2017 Ri3D: 'Snow Problem Reveal

The opinions expressed above are the personal opinions of the author and do not necessarily represent the views and opinions of any organization the author is affiliated with.
  #3   Spotlight this post!  
Unread 17-02-2012, 01:01
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

We tried both our new electrical board and our board from last year. We did not switch any of the cables between them.
Quote:
Originally Posted by Wiifi View Post
Did you switch out the power wires? There could be a frayed wire somewhere...
  #4   Spotlight this post!  
Unread 17-02-2012, 01:31
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

Just as a note, after some further testing, we discovered that in Java, by controlling the individual jaguars instead of through a RobotDrive instance, I am able to match the speeds correctly.
  #5   Spotlight this post!  
Unread 17-02-2012, 01:58
BitWizard BitWizard is offline
Registered User
FRC #0279
 
Join Date: Dec 2008
Location: Toledo
Posts: 5
BitWizard is an unknown quantity at this point
You didn't mention if you had calibrated the Jaguars ...
  #6   Spotlight this post!  
Unread 17-02-2012, 02:07
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

Quote:
Originally Posted by BitWizard View Post
You didn't mention if you had calibrated the Jaguars ...
I am not sure what you mean by calibrate.
  #7   Spotlight this post!  
Unread 17-02-2012, 07:23
dbeckwith's Avatar
dbeckwith dbeckwith is offline
Lead Programmer
AKA: Daniel Beckwith
FRC #3205 (The Patriots)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: USA
Posts: 84
dbeckwith is an unknown quantity at this point
Re: Help! RobotDrive Error in all 3 languages

In the Java example you initialize the RobotDrive object at its declaration:
Quote:
public class RobotTemplate extends SimpleRobot {
RobotDrive drivetrain = new RobotDrive(1,2);
I'm not sure that's a good way to do it. The constructor might need some resources that are initialized later in order to work properly. I would move it to the robotInit() method just to be safe.
Quote:
public class RobotTemplate extends SimpleRobot {
RobotDrive drivetrain;

public void robotInit() {
drivetrain = new RobotDrive(1,2);
}
}
__________________
q = (2*b) | ~(2*b);

if (life.getLemons() != null) this.lemonade = new Drink(life.getLemons());
else throw new NoLemonsException("What now?");


  #8   Spotlight this post!  
Unread 17-02-2012, 08:34
DavidGitz's Avatar
DavidGitz DavidGitz is offline
Lead Technical Advisor
FRC #1208 (MeTool Brigade)
Team Role: Coach
 
Join Date: Dec 2006
Rookie Year: 1996
Location: O'Fallon, IL
Posts: 341
DavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud ofDavidGitz has much to be proud of
Send a message via AIM to DavidGitz Send a message via MSN to DavidGitz Send a message via Yahoo to DavidGitz
Re: Help! RobotDrive Error in all 3 languages

Quote:
Originally Posted by bdbayes View Post
We discovered that one side was putting 2.27 volts through the control circuit while the other was putting 0.67 through on the other side.
Can you clarify on this more? I assume what you are doing is taking a multi-meter and measuring the voltage on the PWM Signal Wire to Ground. First, this is going to be inaccurate as the PWM frequency is pretty high and your multi-meter may not interpret that as correct, unless you have a true RMS meter. I may be wrong on this point, someone correct me if I am. The better test for this would be to use an oscilloscope and measure the pulse width.

However, this may be a non-issue anyways depending on your electrical and software setup. If you are running the basic tank drive software with all the CIM motors hooked up normally (red-red, black-black) one side will need to be inverted from the other. If this is done in software one side will get a different PWM signal than the other, and this can be easily determined by looking at the speed controllers while driving forwards. If the speed controller led's for the left side are different than the right side that means they are inverted in the software. Which is perfectly fine.

You didn't specify your actual drive-train setup, are you guys doing 4wd or 6wd?

I suspect that you have one or more of the following problems: a) You still have binding issues in your drive-train b) Bad weight distribution on your wheels c) Not all wheels contacting the ground.

If you see the same problem in all 3 programming languages using the default code (disregarding many other teams using the default code without issue) the problem is probably not the software. When you drive fully forwards and the speed controllers led's are constantly on (green or red) that means the software is putting out a full throttle command.
__________________
  #9   Spotlight this post!  
Unread 17-02-2012, 10:55
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

We are actually planning to use a 2WD with 4 motors. After further inspection of the National Instruments documentation of the Jaguars, we discovered that to go in full reverse is 0.67 and to go full forward is 2.27 which is the values we were recieveing. We are using a multimeter to test the output of the control circuit. This now leads me to believe that it is no longer a software problem and instead a firmware problem with the jaguars. Does anyone have a suggestion as to how to update the firmware on the jaguars? When I connect the jaguar to the computer, it just reads 0 for everything, but it says that it is connected.

Thank you to everyone who has contributed towards helping us find a solution to this problem.
  #10   Spotlight this post!  
Unread 17-02-2012, 10:56
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
Smile Re: Help! RobotDrive Error in all 3 languages

Quote:
Originally Posted by DavidGitz View Post

I suspect that you have one or more of the following problems: a) You still have binding issues in your drive-train b) Bad weight distribution on your wheels c) Not all wheels contacting the ground.
I would add d) drive motors (like CIMS) do not run at the same speeds forwards vs backwards for the same absolute value of PWM request. So many robots have a tendency to have a drift to one side. (lots of threads about that out there in SEARCH-land I bet) Adding a small constant bias solves many of the effects of a + b + c + d.

I'm hacking this in pretty fast, but it should get you going ...
Code:
#define SIDE_BIAS 0.1   // TBD from experimentation
#define NEUTRAL_DEADBAND 0.17  // maybe less - experiment
.
.
. 
		while (IsOperatorControl())
		{
                       float yStick = stick.GetY();    //as opposed to stick->GetY(); ....not sure
                       float xStick = stick.GetX();

                       if( (yStick > -NEUTRAL_DEADBAND) && 
                           (yStick < NEUTRAL_DEADBAND )   )
                       { // in the Y deadband ... spin only so no bias to spin
                           yStick = 0. ;  
                       }
                       else // translating fwd/rev add the bias to the spin axis
                       {
                           xStick += SIDE_BIAS ; // set sign correctly, here
                           xStick = (xStick > -1.) ? xStick : -1. ; // keep in range
                           xStick = (xStick < 1.) ? xStick :  1. ;
                       }
              
			//myRobot.ArcadeDrive(stick); // drive with arcade style 

                        // using squared inputs has a smoothing effect on handling
                        myRobot.ArcadeDrive(yStick,xStick,true) ; 

			Wait(0.005); // wait for a motor update time
		}
...something like that....

For better drift compensation, try a yaw rate sensor as feedback to a proportional control of the SIDE_BIAS value

Thanks,
Eric

PS JAG firmware upgrade instructions:

http://www.usfirst.org/sites/default...ructions02.pdf
__________________

Don't PANIC!
S. P. A. M.

Last edited by EricS-Team180 : 17-02-2012 at 11:04.
  #11   Spotlight this post!  
Unread 17-02-2012, 11:07
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 992
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Help! RobotDrive Error in all 3 languages

Quote:
Originally Posted by bdbayes View Post
We are using a multimeter to test the output of the control circuit. This now leads me to believe that it is no longer a software problem and instead a firmware problem with the jaguars.
I doubt it. I would strongly suggest that this is a wiring or mechanical issue. If you flip the PWM connections does the lower output voltage you are measuring follow the PWM signal or stay with the same Jag?

Have you tried measuring the voltage on the input side of the two Jaguars while this condition is occurring?

I think it is likely that the side measuring the lower voltage has mechanical binding and/or improperly terminated wiring or long wire runs and is dropping a greater voltage before it gets to the input of the Jag (and likely dropping more voltage inside the Jag as well if the current draw is higher)

The directional bias mentioned by the previous poster for the CIM motors is a few percent and while it can cause the robot to drift slightly dependent on construction it shouldn't result in the substantial difference you appear to be reporting.
  #12   Spotlight this post!  
Unread 17-02-2012, 11:26
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

@EricS - Thanks for the code sample. I will take a look. We have tried using the updating manual, but it appears as though our school district does not have the drivers installed for the serial port to work.

@RufflesRidge - We are going to go and try and different things with the Jaguars today including what you have mentioned.

Thank you everyone who as contributed towards solving our problem.
  #13   Spotlight this post!  
Unread 17-02-2012, 11:31
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Mentor, LRI, MN RPC
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,835
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Help! RobotDrive Error in all 3 languages

Quote:
Originally Posted by EricS-Team180 View Post
I would add d) drive motors (like CIMS) do not run at the same speeds forwards vs backwards for the same absolute value of PWM request. So many robots have a tendency to have a drift to one side. (lots of threads about that out there in SEARCH-land I bet) Adding a small constant bias solves many of the effects of a + b + c + d.
Seconding this. Even a few percent bias is enough to be noticeable while driving - something we've seen every single year.

If you have an oscilloscope handy, you can actually see what's really going on:

The Jag outputs a PWM signal to the motor - Essentially, it never gives the motor 10V, or 8V (unless that's what your battery is at). Instead, it'll oscillate between a high and low voltage, and the width of the pulses averages out to be 10V, or 8V, or whatever you want.

When hooked up to a motor, the motor essentially does the averaging for you. So if you hook the scope or a multimeter up to a Jag with a motor attached, your going to see the output voltage you expect for the speed its going. On the other hand, if you remove the motor, you'll see the actual square waveform on the scope.

We've done this demonstration on our team (we were fortunate enough to have an old scope donated last fall by our primary sponsor). It's very clear that for the same speed forwards and backwards, the waveforms are simply inverted images of each other.

The issue comes with the motors - they have a forward bias. In other words, they prefer to run forwards. As a result, you'll see the robot drift to one side, since the motors running in reverse are running slightly slower.

Don't believe it? Here's something any team can do with what came in the KoP:

- Hook up the nice rotary encoders we got from US Digital to 2 CIMple boxes.
- Hook a motor up to each CIMple box.
- Place some sort of load on the output shaft of the CIMple boxes, (a flywheel, a pully lifting a weight, something). We don't want to just let these run at free speed with no load.
- Run the motor leads together, but switch polarity - red from one motor meets black from the second motor, and vice-versa.
- Hook the encoders into your digital side car, and that up to the cRio.
- Set them up in code to read out the speed or distance.
- Hook the CIM motor leads directly up to power, with no speed controller between them
- Run the whole thing, and look at the encoder output - you should see that one is running faster than the other!
  #14   Spotlight this post!  
Unread 17-02-2012, 12:27
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
Are you using the same type of jaguar on both sides?
  #15   Spotlight this post!  
Unread 18-02-2012, 01:26
bdbayes bdbayes is offline
Captain
FRC #2927 (Pi Rho Techs)
Team Role: Leadership
 
Join Date: Apr 2011
Rookie Year: 2009
Location: Tacoma, WA
Posts: 75
bdbayes is a jewel in the roughbdbayes is a jewel in the roughbdbayes is a jewel in the rough
Re: Help! RobotDrive Error in all 3 languages

I think that we have solved the problem. On our robot, we have 16" drive wheels. We built a second frame today from the KoP and discovered that it drives very smoothly and very straight when you are only using 6" wheels.

We continued extensive testing on the jaguars and discovered that the jaguar tends to output more power going in reverse than going forward. While this is not a problem with the standard 6" wheels provided, it does present a problem when you have 16" drive wheels and casters on the front. This will likely have to be a programming fix unless anyone has any other ideas because it will be a matter of limiting the reverse power down to what the forward power is outputting.

We believe that we have found the other issue. While trying to drive a couple of days ago, we discovered that one side would stop while the other would keep going full throttle. This problem only seemed to present itself when the robot was pushing against something (ie. a person). We now believe that the gear box could have been assembled incorrectly and is therefore causing issues when the motors come under load.

I will add new information as more is discovered tomorrow.
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:39.

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