Go to Post CAD is the oxygen for engineering. - Bharat Nain [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 26-01-2013, 21:03
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Ramping Motors?

Does anyone have any experience with ramping motors in a command based system? I tried adding a for loop to a subsystem method but then I couldn't drive the robot asynchronously. So I tried adding a command to make the subsystem drive at a variable speed and then creating a command group that uses a for-loop to add a series of that command, each with an increasing parameter. This worked asynchronously, but I needed to be able to change the variables continually throughout the program, not have them be statically set like commands do (if you use them correctly, of course). I could. I know these are both terrible ways to accomplish this besides the caveats I mentioned (the second one particularly bad), but I was desperate.

In short, is there a better way to do this by making the variables both adjustable via the dashboard (instead of being initially set when the robot turns on) AND make this loop operate asynchronously?
Reply With Quote
  #2   Spotlight this post!  
Unread 26-01-2013, 22:37
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: Ramping Motors?

In execute, try something along the lines of:

if (currentVoltage < targetVoltage)
currentVoltage += 0.01
else if (currentVoltage > targetVoltage)
currentVoltage -= 0.01

This will bump your voltage closer to your target voltage each iterative loop.

Of course you'll want to clean it up, but this should give you a general idea.

Do not use loops inside your command executes. They are already looped for you each during iteration. Unlike the SimpleRobot template, you cannot loop inside your command executes for a long period of time. Your execute methods need to run as quickly as possible, so any other parallel commands can be run immediately after. If you loop, you will stall the rest of your code, thus losing the ability to run things asynchronously.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #3   Spotlight this post!  
Unread 27-01-2013, 17:04
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Ramping Motors?

Quote:
Originally Posted by arithehun View Post
Does anyone have any experience with ramping motors in a command based system? I tried adding a for loop to a subsystem method but then I couldn't drive the robot asynchronously. So I tried adding a command to make the subsystem drive at a variable speed and then creating a command group that uses a for-loop to add a series of that command, each with an increasing parameter. This worked asynchronously, but I needed to be able to change the variables continually throughout the program, not have them be statically set like commands do (if you use them correctly, of course). I could. I know these are both terrible ways to accomplish this besides the caveats I mentioned (the second one particularly bad), but I was desperate.

In short, is there a better way to do this by making the variables both adjustable via the dashboard (instead of being initially set when the robot turns on) AND make this loop operate asynchronously?
Instead of trying to do what you want programatically, you might want to use built-in options for your motor controller.

If you are using jaguars, they have ramping modes built in(but disabled by default). To enable voltage ramping, you need to change some jumpers.(see in the attached manual p.12) You can even change the rate of ramping using the serial interface and some NI software.

Checkout page 11 of the attached manual to see if this is what you want. Look at coast/break jumper and the automatic ramp mode.
Attached Files
File Type: pdf black-jaguar-manual.pdf (907.0 KB, 18 views)
Reply With Quote
  #4   Spotlight this post!  
Unread 27-01-2013, 21:37
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: Ramping Motors?

Quote:
Originally Posted by Azrathud View Post
Instead of trying to do what you want programatically, you might want to use built-in options for your motor controller.

If you are using jaguars, they have ramping modes built in(but disabled by default). To enable voltage ramping, you need to change some jumpers.(see in the attached manual p.12) You can even change the rate of ramping using the serial interface and some NI software.

Checkout page 11 of the attached manual to see if this is what you want. Look at coast/break jumper and the automatic ramp mode.
Of course there's a jumper solution. Why didn't I think of it?

Also, the guide on commands was really bad. I'll take it into account that it loops repeatedly. Thanks to you both!
Reply With Quote
  #5   Spotlight this post!  
Unread 27-01-2013, 22:59
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Ramping Motors?

Quote:
Originally Posted by arithehun View Post
Of course there's a jumper solution. Why didn't I think of it?
It depends on what you want the ramping to do for you.

In PWM mode, the ramp is 0.06 seconds from neutral to full throttle.

That's enough to reduce the occurrence of Jag overcurrent trips.

But if you're trying to change the feel of the driver interface it's probably not going to help.


Reply With Quote
  #6   Spotlight this post!  
Unread 28-01-2013, 13:30
Azrathud's Avatar
Azrathud Azrathud is offline
Computer Nerd
AKA: Bryce Guinta
FRC #2945 (BANG)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Colorado
Posts: 24
Azrathud is on a distinguished road
Re: Ramping Motors?

Quote:
Originally Posted by Ether View Post
It depends on what you want the ramping to do for you.

In PWM mode, the ramp is 0.06 seconds from neutral to full throttle.

That's enough to reduce the occurrence of Jag overcurrent trips.

But if you're trying to change the feel of the driver interface it's probably not going to help.


I thought you could change values using a serial interface(just a one time connection) using the BDC-COMM software and then have it work for PWM.
Reply With Quote
  #7   Spotlight this post!  
Unread 28-01-2013, 14:13
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: Ramping Motors?

Oh, sweet, I just downloaded the software. I am using PWM, so that's really helpful.
Reply With Quote
  #8   Spotlight this post!  
Unread 28-01-2013, 15:14
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Ramping Motors?

Quote:
Originally Posted by Azrathud View Post
I thought you could change values using a serial interface(just a one time connection) using the BDC-COMM software and then have it work for PWM.
If that's true, it's good to know.

Q8 & Q9 in the FAQ seem to be saying that the factory "preset value" cannot be changed, and will be used every time the Jag is power cycled. Could someone who has actually done it please confirm?


Attached Thumbnails
Click image for larger version

Name:	Q8.png
Views:	22
Size:	41.9 KB
ID:	13700  Click image for larger version

Name:	Q9.png
Views:	12
Size:	23.7 KB
ID:	13701  

Last edited by Ether : 28-01-2013 at 15:21.
Reply With Quote
  #9   Spotlight this post!  
Unread 28-01-2013, 17:08
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: Ramping Motors?

Quote:
Q8 & Q9 in the FAQ seem to be saying that the factory "preset value" cannot be changed, and will be used every time the Jag is power cycled. Could someone who has actually done it please confirm?
It also mentions that it only resets the ramp rate if the automatic mode is enabled. You can disable the mode, it says in your second thumbnail.
Reply With Quote
  #10   Spotlight this post!  
Unread 28-01-2013, 17:18
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Ramping Motors?

Quote:
Originally Posted by arithehun View Post
It also mentions that it only resets the ramp rate if the automatic mode is enabled. You can disable the mode, it says in your second thumbnail.
If you disable it, it doesn't function in PWM mode. So it's not clear what point you are making. e.g. I have a car with a dead battery. It works fine unless I try to start it.


Reply With Quote
  #11   Spotlight this post!  
Unread 28-01-2013, 18:26
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: Ramping Motors?

Quote:
Originally Posted by Azrathud View Post
I thought you could change values using a serial interface(just a one time connection) using the BDC-COMM software and then have it work for PWM.
No, you can't save a ramp rate and have it stick after a power cycle. The only configuration parameter that is saved in flash (immune to a power cycle) is the Jaguar ID.

The idea behind the Automatic Ramp Mode was to give teams a quick way to prevent high current spikes without having to write code or hook up the CAN/Serial interface.

If you need the ability to tweak your ramp rate, you either need to use CAN/Serial the whole time or write a ramp into your PWM code.

-David

Last edited by dyanoshak : 28-01-2013 at 18:30.
Reply With Quote
  #12   Spotlight this post!  
Unread 28-01-2013, 20:20
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: Ramping Motors?

PWM is stupid, I'm switching to CAN. Unfortunately, I didn't request CAN when I ordered, so now I have to buy the RS232-RJ11 and RJ11-RJ11 cables. Oh well...
Reply With Quote
  #13   Spotlight this post!  
Unread 29-01-2013, 22:05
jesusrambo jesusrambo is offline
Self-Proclaimed Programmer Messiah
AKA: JD Russo
FRC #2035 (Robo Rockin' Bots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Carmel, CA
Posts: 114
jesusrambo is an unknown quantity at this point
Re: Ramping Motors?

If you don't want to use CAN and you still want ramping, you can modify the source file for the Jaguar class to just average out speeds over the last 20 ms or so before setting the output speed.
Reply With Quote
  #14   Spotlight this post!  
Unread 11-02-2013, 00:13
arithehun arithehun is offline
Registered User
AKA: Ari Falkner
FRC #3024
Team Role: Programmer
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Ashland, Oregon
Posts: 27
arithehun is an unknown quantity at this point
Re: Ramping Motors?

Yeah, but now that I read up on it, I may want to use the jaguar PID modules too to keep my own code as clean as possible.
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


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

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