View Single Post
  #1   Spotlight this post!  
Unread 22-03-2013, 19:50
joelg236 joelg236 is offline
4334 Retired Mentor & Alumni
AKA: Joel Gallant
no team
Team Role: Mentor
 
Join Date: Dec 2011
Rookie Year: 2012
Location: Calgary
Posts: 733
joelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond reputejoelg236 has a reputation beyond repute
Automatic 2 Speed Drivetrain Shifting Code

I've been looking into automatic drivetrain shifting code. I've found this thread pretty helpful so far, specifically
apalrd's post. I've basically been looking all over this search. I've also found 254's driving code here and here, but I just don't know enough C++ to understand exactly how it works (or if it even auto-shifts! - I was told that they do but I can't find where it happens). Anyways, I'm just looking for some kind of rundown on how exactly you'd determine whether to shift up or down. So far I've come up with this:

Code:
    if (input > shiftersInputThreshhold && m.encoder.getRate() > shiftersSpeedThreshhold 
        // Make sure not to shift too much
        && (System.currentTimeMillis() - lastShift) > shiftersShiftTimeLimit * 1000) {
        m.gearShifterController.setSecondGear();
        lastShift = System.currentTimeMillis();
    } else {
        m.gearShifterController.setFirstGear();
    }
Although I can't think of them right now, I have a pretty strong feeling that there are a lot of things that this doesn't account for. Just as much, I have no idea what to set "shiftersSpeedThreashhold" or "shiftersInputThreashhold". It seems arbitrary to me. I've been told (and others in old threads have alluded to) that JVN has some kind of way to determine those kinds of threashholds. We're using 2 CIMs and the super shifter gear box (from what I'm told). Is there anywhere you could point to for some ways for algorithms to shift gears?

My goal here is for it to shift when the robot is going fast enough that it needs to, and have enough torque to push others around.

Oh and one last thing, should shifting take turning into account? Right now that's a little bit difficult to do with my code (for implementation reasons). What benefit would something like this
Code:
if(abs(turn) > 0) doNotShiftGears()
give me? Is it really necessary if we aren't using tank drive?
__________________
All opinions are my own.