Thread: Lag Issue
View Single Post
  #5   Spotlight this post!  
Unread 04-02-2008, 21:28
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Lag Issue

Quote:
Originally Posted by bizarospooky View Post
neat so, baisically ignore the function stuff and do something like in the operator control

If(Joystick_1(that's the desired)>rampspeed(that's the actual? with it starting at 127))
{
rampspeed+=2
SetPWM(1, rampspeed)
}

Something like that?
That will work, but I like how you break the steps out into functions. That's good style and will make it easier to tweak your code. Because you want to add limits (make sure rampspeed stays between 0 and 254), perhaps a deadband (127 +- 10 maybe), or maybe some PID (for greater control). Also consider how your code will handle different situations:

1. If you go from forward to reverse, do you really want to wait for your ramp to count through neutral before it changes direction?

2. If you are going full forward and need to stop (joystick in neutral) do you want to wait for the code to count to neutral?

Good luck!