Go to Post None. Ours is anorexic at the moment. Lets see if the building people can come up with a simple tetra-knockdown mechanism. - Fixen [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 11-11-2009, 17:37
ethan_orion ethan_orion is offline
Registered User
FTC #0071
 
Join Date: Oct 2009
Location: Wyoming
Posts: 48
ethan_orion will become famous soon enoughethan_orion will become famous soon enough
[FTC]: Spin Motor Wind Down: Programming

Does anyone have any creative ideas about how to get our launch motors to wind down slowly instead of just crashing to a stop.

When I release button one or one of the joystick controls I'd like our launcher to not just crunch to a halt which is painful to hear and I'm sure is doing damage to the motor and the gears.

Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 11-11-2009, 18:46
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: [FTC]: Spin Motor Wind Down: Programming

I would use this

if(joystick.joy1_y1 == 0 && motorspeed > 0)
{
motorspeed = motorspeed - (desired decrement)

}

it's simple and simplicity is the key. So what is basically happening in this code is that if you've let go of the left joystick and the motor hasn't stopped then it will decrease the speed then the rest of the code will execute then the process will repeat. The only tricky thing about this is the decrement will have to be small because the code will repeat almost immediately.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-11-2009, 19:09
ethan_orion ethan_orion is offline
Registered User
FTC #0071
 
Join Date: Oct 2009
Location: Wyoming
Posts: 48
ethan_orion will become famous soon enoughethan_orion will become famous soon enough
Re: [FTC]: Spin Motor Wind Down: Programming

Thanks. Make's sense in C but not in labview.

Thanks though.
Reply With Quote
  #4   Spotlight this post!  
Unread 11-11-2009, 19:35
l0jec l0jec is offline
Registered User
no team
 
Join Date: Oct 2009
Rookie Year: 2004
Location: St. Louis, MO
Posts: 52
l0jec has a spectacular aura aboutl0jec has a spectacular aura about
Re: [FTC]: Spin Motor Wind Down: Programming

jamie_1930, while your approach is indeed simple, I do not believe it would ramp down the speed over a long enough period of time. I would suggest you refactor your strategy into a separate task which could employ a wait statement inside of a loop until the speed reaches zero. This would allow you to properly slow down the speed over the course of several seconds. Also, I imagine you would likely want to employ the same approach to ramping up speed.

This is assuming you are not actually trying to control the speed of launcher motors interactively with an analog stick... which I would also not recommend as it would be very difficult to shoot any distance consistently other than full speed and you still run the risk of stopping the motors hard.
Reply With Quote
  #5   Spotlight this post!  
Unread 11-11-2009, 22:53
jamie_1930's Avatar
jamie_1930 jamie_1930 is offline
Registered User
FRC #2228 (Cougartech)
Team Role: Student
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Rush-Henrietta
Posts: 371
jamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to beholdjamie_1930 is a splendid one to behold
Re: [FTC]: Spin Motor Wind Down: Programming

Quote:
Originally Posted by l0jec View Post
jamie_1930, while your approach is indeed simple, I do not believe it would ramp down the speed over a long enough period of time. I would suggest you refactor your strategy into a separate task which could employ a wait statement inside of a loop until the speed reaches zero. This would allow you to properly slow down the speed over the course of several seconds. Also, I imagine you would likely want to employ the same approach to ramping up speed.

This is assuming you are not actually trying to control the speed of launcher motors interactively with an analog stick... which I would also not recommend as it would be very difficult to shoot any distance consistently other than full speed and you still run the risk of stopping the motors hard.
This was the main concern I had with implementing that code although this should work fine. Just make x (x = iterations ; creates the needed pause) the right number. (here it's 1000 just for the sake of example)

if(joystick1.joy_y1 == 0 && motorspeed > 0)
{
x = x + 1;
if(x=1000){x = 0; motorspeed = motorspeed - 1;}
motor[shooter] = motorspeed;

}

if(joystick1.joy_y1 != 0){motor[shooter] = ((joystick1.joy_y1 * 100) / 127);}

or if your using a button

if(joy1Btn(1) == 0 && motorspeed > 0)
{
x = x + 1;
if(x=1000){x = 0; motorspeed = motorspeed - 1;}
motor[shooter] = motorspeed;

}

if(joy1Btn(1) ==1){motor[shooter] = 100;}

that should work much better
Reply With Quote
  #6   Spotlight this post!  
Unread 12-11-2009, 08:17
l0jec l0jec is offline
Registered User
no team
 
Join Date: Oct 2009
Rookie Year: 2004
Location: St. Louis, MO
Posts: 52
l0jec has a spectacular aura aboutl0jec has a spectacular aura about
Re: [FTC]: Spin Motor Wind Down: Programming

jamie_1930:

Yes, that should do the trick as well. You'd need to add a little more code to reset your runtime counter (x) once it hits 1000 or if the launcher is reactivated and do some testing to find the optimal limit. Even though it is just sample code, a team using the analog sticks would need to also compensate for a deadzone in your first example.

One last note on this is that my students observed a difference in how smoothly the shooter mechanism came to a stop depending upon whether or not they floated the motors. If braking was enabled (the default) then the mechanism would slow down until about 20% power and still stop fairly hard due to the motor attempting to brake (maintain speed) at low power and not overcoming the torque to keep driving the gears. If they floated the motors first, then the mechanism would slow down nice and smooth all the way using its own momentum.
Test and experiment; YMMV.

EricVanWyk:

ROBOTC makes it easy to spin up separate threads (tasks for the NXT) where you can use wait statements without pausing your primary control loop code (located in the main task). In this model, you shouldn't care how fast the processor can execute your primary control loop and have to guess a counter limit, because you can explicitly set how many milliseconds you want to wait between stepping up or down power to a motor in a separate task. No guessing and the code will be much more optimized anyway.
Yes, ROBOTC supports floating point calculations.

Last edited by l0jec : 12-11-2009 at 08:28. Reason: Combine answers to single post
Reply With Quote
  #7   Spotlight this post!  
Unread 16-11-2009, 12:26
clwilligham clwilligham is offline
Registered User
FTC #2845 (Team Duct Tape)
Team Role: Programmer
 
Join Date: Nov 2009
Rookie Year: 2006
Location: Florida
Posts: 4
clwilligham is an unknown quantity at this point
Re: [FTC]: Spin Motor Wind Down: Programming

we had the same problem. however since we found out how much damage it can cause on the motors the hard way at a competition, we did a quick and dirty fix. we set it to an idle speed. this way the motors always ran. sped up nicely, and slowed down nicely.only down side was everyone thought we did something wrong in the code, and it would occasionally spew out a ball or two because we had the idle speed to high.

i think the nicest solution would be to turn of the brakes on the motors some how. although i don't know how you would do that.
Reply With Quote
  #8   Spotlight this post!  
Unread 16-11-2009, 13:09
l0jec l0jec is offline
Registered User
no team
 
Join Date: Oct 2009
Rookie Year: 2004
Location: St. Louis, MO
Posts: 52
l0jec has a spectacular aura aboutl0jec has a spectacular aura about
Re: [FTC]: Spin Motor Wind Down: Programming

Quote:
Originally Posted by clwilligham View Post
i think the nicest solution would be to turn of the brakes on the motors some how. although i don't know how you would do that.
In ROBOTC, there is a global variable which controls this for all motors. You should be able to set it to true/false to enable/disable floating at will. However, from my student's experience it can be a little buggy with the Tetrix motor controllers, so make sure you test.

Code:
//float motors
bFloatDuringInactiveMotorPWM = true;

//brake motors
bFloatDuringInactiveMotorPWM = false;
Reply With Quote
  #9   Spotlight this post!  
Unread 16-11-2009, 13:23
clwilligham clwilligham is offline
Registered User
FTC #2845 (Team Duct Tape)
Team Role: Programmer
 
Join Date: Nov 2009
Rookie Year: 2006
Location: Florida
Posts: 4
clwilligham is an unknown quantity at this point
Re: [FTC]: Spin Motor Wind Down: Programming

we tried that. the motors did some very odd things. the motors pretty much went haywire when we did this.

but we don't really want to turn off the brakes for all the motors. is there a way to set just 2 motors to float like in NXTG?
Reply With Quote
  #10   Spotlight this post!  
Unread 16-11-2009, 14:09
l0jec l0jec is offline
Registered User
no team
 
Join Date: Oct 2009
Rookie Year: 2004
Location: St. Louis, MO
Posts: 52
l0jec has a spectacular aura aboutl0jec has a spectacular aura about
Re: [FTC]: Spin Motor Wind Down: Programming

Quote:
Originally Posted by clwilligham View Post
we tried that. the motors did some very odd things. the motors pretty much went haywire when we did this.

but we don't really want to turn off the brakes for all the motors. is there a way to set just 2 motors to float like in NXTG?
Your experience seems to match ours. One of my students came up with a possible fix (*hack*) which appeared to prevent their drive motors from flipping out when they wanted to coast their shooter motors. I'll check with him to see what it was and if it is a viable workaround; if it is, we'll post it.
Reply With Quote
  #11   Spotlight this post!  
Unread 16-11-2009, 17:10
clwilligham clwilligham is offline
Registered User
FTC #2845 (Team Duct Tape)
Team Role: Programmer
 
Join Date: Nov 2009
Rookie Year: 2006
Location: Florida
Posts: 4
clwilligham is an unknown quantity at this point
Re: [FTC]: Spin Motor Wind Down: Programming

thanks. that would help a lot.

in the mean time something like this might help for anyone else trying to keep there motors alive:

Code:
int motorSpeed = 100;


void powerDown()
{
  if(time10[T1] > 10 && motorSpeed > 10)
  {
    time10[T1] = 0;
    motorSpeed --;
  }
  else
  {
    motorSpeed = 0;
  }
  motor[shooter] = motorSpeed;
}
i haven't tested this either, but it is pretty simple and based off of previous functions from last year which worked consistently.

Last edited by clwilligham : 16-11-2009 at 17:15.
Reply With Quote
  #12   Spotlight this post!  
Unread 11-11-2009, 19:52
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: [FTC]: Spin Motor Wind Down: Programming

Quote:
Originally Posted by ethan_orion View Post
Thanks. Make's sense in C but not in labview.

Thanks though.
There is a (poorly written) article I put first forge that might help:
http://thinktank.wpi.edu/article/140

Page 5 shows that code implemented in labVIEW.

l0jec - I've never competed in / programmed for FTC, but I have used this method many times in FRC. It is a quick'n'dirty method that can be effective in a pinch.

How often does the FTC code run? I'm used to 40/50/200Hz for FRC.
Does it do floating point or just fixed point?
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
Wind River License Server Down? keericks C/C++ 4 19-06-2009 20:02
[FTC]: January Run Down and New FTC Pictures ttldomination FIRST Tech Challenge 6 04-02-2009 13:18
Driver Station Watch Dog / Motor Won't Spin Issue RMiller FRC Control System 5 20-01-2009 09:58
Motor Spin Direction archiver 2000 6 23-06-2002 23:43
How Many RPM does a Fisher-Price Motor Spin At? archiver 2000 7 23-06-2002 23:22


All times are GMT -5. The time now is 17:15.

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