ooooohhh⌠youâre using a 3-speed DeWalt transmission⌠weâve used those before.
This year we had two robots and only used gears 1 and 2 (only one shifter, it was for our arm).
In LabVIEW I created a 2x2 matrix for the shift states. The column was the numeric equivalent to the boolean robot variable (false for competition, true for practice). The row was the numeric equivalent to the boolean shift state variable. This worked just fine for only going from 1 to 2. I set the shift point when deploying so there was not much load on the arm at the time it shifted and it never missed a shift.
In the past, we have used all three gears (for drivetrains), and had the servo overshoot and come back when shifting into second, to make more certain the shift was successful (the shift from 2 to 3 at speed is kinda hard anyway).
The simple way to do this would be to use a state-machine and have a value for âLowâ, âMidâ, and âHighâ. This will make the robot stay in gear when you remove your hands from the buttons. To do this, create an Enum control, right-click, and hit âEdit Itemsâ. Then, type in your three states, preferably with Low as 0 and High as 2. Then, create an array and place a Numeric type inside, making a numeric array. This will store your shift points. There are three rows in the numeric array that we care about: the first three. The first one corresponds to Low (assuming Low is the 0 in the list), and so on. Servo values are between 0 and 170 in degrees. When you have set them (you can do this while the code is running), stop the code, right-click on the array, and go to Data Operations -> Make Current Value Default. Then, go to the place where you set the servo, get the array and enum, and Index the array (using Arrau->Index Array) where the index is the enum. This will give you the correct angle for the state that the Enum is set to, which you can set to your servo. Then, to set the enum, you can have a button for Low, Mid, and High. Just have a Switch for each button, and feed the current state of the enum into the False of the first one (then string the output of the first to the False of the second and so on). Then, set the True to the value of the button, either Low Mid or High. The output of the last one gets set to the enum. You could save buttons by having a Shiftup and Shiftdn button, but that would require an indicator of the current gear (Dashboard or LED) and a rising-edge trigger, both of which are more complex then you probably want. I would make pictures to go along with this but my LabVIEW laptop is broken.
Also, donât forget to remove the detent from the shifter (a little black tab that holds it in gear, it makes it harder for the servo to shift)