How to program joystick to control arm and reduce turn velocity

I am new to VEXcode IQ Blocks. I have played round with programming the basic drivetrain controls but found it very basic and limiting (yet quick and easy to get going). We are in the process of changing over from Modkit (having previously had all 9 teams using this).

I am trying to help some teams with their Controller code. We have a few questions -

  1. They have the left joystick (A + B) controlling the Left and Right Drive Motors and want to code the Right Joystick (C + D) to control their front arm motor. In Modkit this was a simple process. Has anyone been able to code this?

  2. They also want to slow their turn velocity (B).

Any assistance with this with would be great. Thanks in advance.

43%20AM

Here is the code we have at the moment.

Sure, here’s some code that does that, probably quite similar to equivalent code in Modkit:
50%20AM

This can be achieved by scaling the joystick B value before adding it to the joystick A value:
10%20AM

3 Likes

Thanks heaps. I managed to get the turn velocity code sorted but the joystick control code didn’t work.

Here is what I did.24%20PM

Thanks in advance!

I will keep persisting! But if you can see a solution that would be amazing! Cheers

Looks like the < needs reversed to a > so it is greater than the deadband, not less than the deadband on your C position near the bottom.

1 Like

I would like to understand for the ‘deadband’ why are you using + for the Left Motor and - for the Right Motor ? Also we are simply using Joystick A for Left Motor and Joystick D for Right Motor. If that is the case, how do we slow down the Motor speed to say 75%. Should we simply use ‘set LeftMotor velocity to 75%’ ? and the same for Right Motor ?
Thank You.

(I think I am correct, but please overrule me if I am not)

Setting the left motor to 75% gets overruled by the joystick. The joystick runs from -100% to +100% and essentially constantly resets the 75% that you are suggesting to hard code in.

In order to reduce the speed, create a variable such as ‘Derate’ and set it to 75%, then multiply your joystick input by this derate percentage.

I will try to code this myself and will try to remember to report back the results.