Registered: 1443021001 Posts: 112
Reply with quote #16
In a training class on June 23, 2017, I looked at the Simulink Arcade block code with Sandeep.
It didn't look right, and worked strangely ('random' direction reversals), so I suggested this instead, and it works better. You can make your own Arcade type function the old fashioned way: L=Y+X, R=Y-X (with maybe Reversed polarity on one motor) Look at the transfer function of X,Y => L,R motor desired: using 1 as abbrev for 127 X Y L R -1,+1=>+0,+2 0,+1=>+1,+1 +1,+1=>+2,+0 -1,+0=>-1,+1 0,+0=>+0,+0 +1,+0=>+1,-1 -1,-1=>-2,+0 0,-1=>-1,-1 +1,-1=>+0,-2 The same 3x3 grid in descriptive terms makes sense pivot F-L, Forward, pivot F-R spin Left, Stop, spin Right pivot B-L, Back, pivot B-R The motor block already does limiting the -2 to +2 range to just max/min of 1,-1 (127,-127), but if you want to do that on your, you can use Max and Min functions like this: Left =Max(Min( Y+X , +127), -127) Right=Max(Min( Y-X , +127), -127) Hopefully Sandeep will update the Arcade block in time for 2017 programming season. If you have an Arcade programmed, and the L,R motor ports and polarities are mixed up, here is how to straighten them: Look at just the right wheel while operating the joystick. Does it go forward backward correctly, and also go forward when turning forward left? If so, THEN it is right port and right polarity. If both are wrong, THEN swap Just motor polarity. If forward and backward are correct, but it turns in the wrong direction, THEN the right wheel motor is in the Left motor port. Swap motor ports and start over. Now that the right wheel is fixed, just look at the left wheel while operating the joystick Does it go forward backward correctly, and also go forward when turning right? If so, THEN it is in the correct motor port, with correct polarity. If both are wrong, THEN swap Just motor polarity. If forward and backward are correct, but it turns in the wrong direction, THEN you don't have arcade mode programmed correctly. The simplest way to swap polarity is in Hardware at the plug between the MC29 controller and the Motor Screw Terminal Adaptor.