Hey it’s my first year programming and I’m having a few issues. We are currently using the basic Logitech controller to control our robot using a mecanum drive. The problem is that the controls are way weird. Forward on the joystick is forward and backwards is backwards, which is good. But left stick spins it left and right stick spins it right, we want these to make it strafe. Then the left trigger strafes left but the right trigger doesn’t strafe right. We want the bumpers to spin the robot also. Anything that can be offered as advice is much needed.
I think this does the basic, without the bumper spin.
The left joystick should do forward/back/strafe
The Triggers should do spin clockwise/counterclockwise.
If this works as you want, then we can add the bumper spin to it.
All this assumes the wheels are setup correctly and the motors are setup in Begin the way I expect (expectations can be wrong).
Based on the F310 in Flight mode (x emulator switch underneath & mode light off):
Here’s my begin code
I don’t think you should be inverting any of the Mechanum motors, and certainly not one from each side.
Assuming of course that all the motor controller/motors are wired the same way and don’t have crossed wires.
I originally had none of them inverted but when we did joystick right it went forward so our electrical guy said to do that.
Everything is working great with your code, I just need to half the speed of all motors now.
Did you figure out how to use the bumpers, too?
No actually right now left stick moves it forwards backwards and makes it spin while the triggers makes it strafe. And I can’t figure out how to half the speeds.
For the strafe vs spin, try switching the axis zero with the final result of mixing the axis 2 & 3.
To cut the motor speed, multiple all three inputs to the Set by a percentage (0.0 to 1.0), e.g., you’d get 80% power by multiplying by .8
Where in exactly in TeleOp would I do this
I’m not sure why the strafe and rotate are swapped, but you should just be able to swap the controls.
Well, at the risk of getting confusing, here’s that code
- With bumpers added
- Swapping the Left stick X axis for the Trigger outputs.
- Adding in the bumpers to do the same thing as the Triggers
- Reduce power to 80% (you can change all the .8’s to any other percentage to get more or less max power. You could even apply different power to different controls if that works better. A value of 1.0 will return it all to normal.
The triggers are variable power based on how tightly you squeeze them, but the bumpers are just on/off buttons, so the buttons operate by only applying full power.
That’ll get reduced by that 80% power in this example.
I don’t know why but everything is backwards. Left stick makes it strake right and up makes it go backwards.
Need to invert any axis that’s backwards then before they go into the Drive vi.
Ok got everything working but now they want to use the Logitech Extreme 3D and the code isn’t working with that. Any ideas
Going from an xBox controller to a flight stick will mean different mapping of controls.
It also depends on if you’re using one joystick or two separate joysticks.
You get rid of the trigger and bumper logic altogether.
Then if you are using a single Extreme joystick, you would use axis 2 to replace your Trigger input to the Drive set.
The driver has to get used to avoiding inadvertent twisting of the stick.
We’ve been adding different controls but something is always off
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.