Go to Post While science and technology can solve difficult problems, it is people and interaction that make it all work. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-06-2010, 02:37
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Current Control

Has anyone tried using Current Mode on the jaguars?
I tried it today in LabVIEW, but it did nothing. (I modified the voltage example to open the Jags in current mode, and replaced the "max voltage" stuff with controls for PID)
It's probably just an incorrect arbitration ID, but I was curious if anybody had already looked into it.

It seems to work with BDC-COMM, although I wonder if the integration was left out, or if the scaling is off. (Given constant load, constant setpoint, and constant nonzero P coefficient, there is a constant error.)
Also, the oscillation point is a little strange; oscilation becomes more apparent at lower speeds, but virtually disappears at higher speeds. I have trouble telling whether jerkiness of the motor is due to slow speed or to the oscillations of the motor. Can the Ziegler–Nichols method be used, or is there a different method? I suppose the inertia of the drivetrain or manipulator will help decrease the frequency of oscillation if I tune on a robot, not a test setup. Perhaps I should also attach a heatsink to the motor so it does not burn up. (At the moment I'm using a Fisher Price with a planetary gearbox)
__________________
-- Marshal Horn
Reply With Quote
  #2   Spotlight this post!  
Unread 12-06-2010, 10:52
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Current Control

I got it working in C++ when we were testing CAN out. What I found is you need to setup PID for it to work and your target current must be MUCH higher than what you actually want (I had to say 40 to get out a reasonable speed when under voltage control). Experiment in BDC-COMM and then transfer over constants that work to your robot code
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #3   Spotlight this post!  
Unread 12-06-2010, 12:09
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Did it actually hold constant current as you varied the load?

Is there a set ratio between setpoint and effective current? I know the current set is actually a fixed point 8.8 number, so if you have a signed word as your amperage, you need to multiply it by 256 (hexadecimal 100). I saw this done in LabVIEW, but it might be something to check.
__________________
-- Marshal Horn
Reply With Quote
  #4   Spotlight this post!  
Unread 12-06-2010, 17:49
Radical Pi Radical Pi is offline
Putting the Jumper in the Bumper
AKA: Ian Thompson
FRC #0639 (Code Red Robotics)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: New York
Posts: 655
Radical Pi has a spectacular aura aboutRadical Pi has a spectacular aura aboutRadical Pi has a spectacular aura about
Re: Current Control

I don't really remember. In my two days with the robot we didn't have time to set up anything fancy like that. This was just my experimenting after I got the CAN bus loaded
__________________

"To have no errors would be life without meaning. No strugle, no joy"
"A network is only as strong as it's weakest linksys"
Reply With Quote
  #5   Spotlight this post!  
Unread 18-06-2010, 16:51
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Quote:
Originally Posted by kamocat View Post
Did it hold constant current as you varied the load?
Anyone?
__________________
-- Marshal Horn
Reply With Quote
  #6   Spotlight this post!  
Unread 18-06-2010, 16:55
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Current Control

Quote:
Originally Posted by kamocat View Post
Anyone?
2468 used current mode with good success this year. Be sure to enable control and tune the PID parameters. It took me a few minutes, but our current was rock solid once tuned.
Reply With Quote
  #7   Spotlight this post!  
Unread 18-06-2010, 19:15
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Well, I tested it again today on the BDC-COMM. I think last time I had only tested the Proportional term, and my observations were based off of that.
The integration works with no problem, and is even scaled correctly. However, I can't seem to get the Proportional term anywhere near high enough to get the motor up to the correct current, because it keeps oscillating.
Okay, so if my 12v motor draws about 2 amps full speed (with no load), then I should want my proportional constant to be 6, so that when I make the setpoint 2A, then the controller will provide full voltage (12v). That is, that would be the case if it were always referenced off of zero, and not the current error.

But check this out:
If I have my setpoint at 40A, and my proportional coefficient coefficient at 1, then it outputs 3.5 volts. (It also says my motor is drawing 2.25A at this low speed) Apparently, 1*(40-2.25) = 3.5 (Or rather, 3.5÷12 full power)
Does that mean that somewhere in here something's scaled incorrectly? However, if I include a little integration (about 0.004) , it quickly jumps up to max speed.
Likewise, when the Proportional coefficient is at 2, setpoint at 40A, the controller outputs 7v (2.5A).
With a coefficient of 3, it outputs 10.7v, oscillating between 1.9 and 2.4A.
And with a coefficient of 3.25, it outputs full voltage, the motor drawing 1.7A.

So, judging by the fact that these outputs are constant (no change, no oscillation), I would infer the Jaguars draw their error not from the setpointprocess variable, but from setpoint - 0. (The Integral parameter probably uses setpointprocess variable)

Thus, with a small Proportional coefficient, the process variable will never even get close to the setpoint, as was observed here.

However, if I make my setpoint 4 Amps, and my Proportional coefficient 10, my motor is very clearly oscillating. (The amperage reads anywhere between 4 and zero)
Perhaps, you might say, the Proportional component is "maxing out" somewhere, thus preventing the oscillation. This is possible, but isn't it strange for the proportional term to "max out" at such a low value, yet scale up with the proportional term and the setpoint?
I can't make sense of this. Is current mode simply not intended to work with small motors? I don't have any CIMs lying around my house.
__________________
-- Marshal Horn

Last edited by kamocat : 18-06-2010 at 19:19.
Reply With Quote
  #8   Spotlight this post!  
Unread 18-06-2010, 19:30
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Current Control

Marshall -

Please make sure you have the latest firmware loaded. There was a small error in the calculations that was patched. I don't think it would create your issue, but you might as well check.

I'm unsure of what the units in the PID are. I tuned it as I tune any other PID loop: blindly.
1) Crank P until it oscillates, cut it in half (or more).
2) Crank I until it hits the set point "quick enough".
3) Mess with D and I until either
a) It looks good, or
b) I find something better to do.

It isn't a great method, but it has worked for me in the past. I'd suggest trying to remove the science from it and go at it from a "fiddle with the knobs" perspective.

Hopefully someone with more science will delete this post and put the real method up.
Reply With Quote
  #9   Spotlight this post!  
Unread 18-06-2010, 19:43
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Yes, I have firmware version 91.

I fiddled with the sliders, but didn't really get anywhere.
Your method of tuning is actually perfectly acceptable and common, and it's just an approximation of Ziegler-Nichols.

However, the oscillation point seems to change on me as I change the setpoint, and that's rather puzzling. (When I have the setpoint at 1A, every P value seems to either cause oscillation, or no output at all.)
__________________
-- Marshal Horn
Reply With Quote
  #10   Spotlight this post!  
Unread 19-06-2010, 10:53
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Current Control

I was driving a CIM, with a set point in the 4-10 amp range. I never tried driving it at just an amp. You might be hitting resolution limits - maximum current is somewhere in the 60+Amp range, I don't recall what one count translates to.
Reply With Quote
  #11   Spotlight this post!  
Unread 20-06-2010, 17:08
EricVanWyk EricVanWyk is offline
Registered User
no team
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Boston
Posts: 1,597
EricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond reputeEricVanWyk has a reputation beyond repute
Send a message via AIM to EricVanWyk
Re: Current Control

Quote:
Originally Posted by kamocat View Post

But check this out:
If I have my setpoint at 40A, and my proportional coefficient coefficient at 1, then it outputs 3.5 volts. (It also says my motor is drawing 2.25A at this low speed) Apparently, 1*(40-2.25) = 3.5 (Or rather, 3.5÷12 full power)
Does that mean that somewhere in here something's scaled incorrectly?
Marshall -

Something in my head just jostled loose regarding this statement.

The PID loop uses the current sensor as an input and gives duty cycle as an output. Therefore, the style of analysis you were attempting does not work in this situation. Your example becomes:

% on time = scaling_factor * 1 * (40-2.5)

instead of

Amps = 1 * (40A-2.5A)
Reply With Quote
  #12   Spotlight this post!  
Unread 20-06-2010, 18:22
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Quote:
Originally Posted by EricVanWyk View Post
Marshall -

Something in my head just jostled loose regarding this statement.

The PID loop uses the current sensor as an input and gives duty cycle as an output. Therefore, the style of analysis you were attempting does not work in this situation. Your example becomes:

% on time = scaling_factor * 1 * (40-2.5)

instead of

Amps = 1 * (40A-2.5A)
Did I mis-state something?.
The output I was recording was the voltage across the motor's leads, as reported by the Jaguar. (I have a Fluke 175 I could use instead if the Jaguars just report a calculated value for voltage)

What do you suppose the scaling factor could be? There is no configuration that relates to this, except perhaps "number of brushes".
__________________
-- Marshal Horn
Reply With Quote
  #13   Spotlight this post!  
Unread 21-06-2010, 12:08
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 189
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
Re: Current Control

Something to note:

If using a Black Jaguar, the current measurement accuracy below 8A is typically +/-2A. When trying to drive at lower currents, you might be reading 0A when it is actually 2A. Above 8A the current accuracy improves to +/- 1A. (This info is in the Black Jaguar Datasheet)

The current sense circuit in Black Jaguar is quite accurate in the higher current range. Unfortunately you get the +/- 1A and +/- 2A thing going on in the lower ranges. This is on our list of things that need improvement.

Gray Jaguar is rated at +/- 1A typically. Like Black Jag, it should improve at higher currents.

-David
Reply With Quote
  #14   Spotlight this post!  
Unread 21-06-2010, 12:37
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: Current Control

Quote:
Originally Posted by dyanoshak View Post
Something to note:

If using a Black Jaguar, the current measurement accuracy below 8A is typically +/-2A. When trying to drive at lower currents, you might be reading 0A when it is actually 2A. Above 8A the current accuracy improves to +/- 1A. (This info is in the Black Jaguar Datasheet)

The current sense circuit in Black Jaguar is quite accurate in the higher current range. Unfortunately you get the +/- 1A and +/- 2A thing going on in the lower ranges. This is on our list of things that need improvement.

Gray Jaguar is rated at +/- 1A typically. Like Black Jag, it should improve at higher currents.

-David
Thank you!
For some reason I hadn't seen it there before.
I see it also says "measurement resolution: 10 bits". Does this refer to the ADC on the ARM? Is the +/- 1A resolution the accuracy of the sensor itself?
__________________
-- Marshal Horn
Reply With Quote
  #15   Spotlight this post!  
Unread 22-06-2010, 16:06
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 189
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
Re: Current Control

Quote:
Originally Posted by kamocat View Post
Thank you!
For some reason I hadn't seen it there before.
I see it also says "measurement resolution: 10 bits". Does this refer to the ADC on the ARM? Is the +/- 1A resolution the accuracy of the sensor itself?
Yes, 10 bit ADC.

The +/- 1A is a combination of the sensor's accuracy and what we measured on multiple Jaguars in the lab.

-David
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
closed-loop torque (current) wheel control for mecanum Ether Programming 3 07-02-2010 00:54
Current Sensors maclaren Electrical 15 04-12-2007 15:21
Current Events? Pavan Dave CD Forum Support 1 18-04-2007 07:49
Current Sensor Joshua May Programming 6 12-02-2004 10:48
Amperage or Current Rob Colatutto Electrical 19 24-01-2003 21:16


All times are GMT -5. The time now is 02:56.

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