Hey guys. I have a question about the turn ratio parameter for the SetOutputState direct command. I understand what it is supposed to do--that is, set the speed of a motor relative to the speed of the motor to which it is synchronized--but it does not seem to be working for me. Here is my code (Objective-C):
Unfortunately, this does not effect any sort of turning. Calls to GetOutputState for both motors (B and C) reveal that their turn ratios are correctly set to 100 and 0, respectively. So I do not understand why this isn't working. I am using the enhanced NXC/NBC firmware, v. 1.31. Any help would be appreciated.
Also, you have to send two identical packets, one to each motor. In your example, turnRatio:100 should be set both times. Movement will only start with the 2nd packet.
If you get strange results with multiple commands, make sure to reset BlockTachoCount of both motors and turn off both motors between calls (pairs of calls) to SetOutputState.
RWTH - Mindstorms NXT Toolbox for MATLAB
state of the art in nxt remote control programming http://www.mindstorms.rwth-aachen.de MotorControl now also in Python, .net, and Mathematica
If you are using the enhanced NBC/NXC firmware you can use a single direct command for this and so long as you only have 2 motors connected you can do it via a single command with the standard firmware as well (I am pretty sure). 0xFF means all ports with the standard firmware. I'm not 100% certain what happens when you set 3 motors on and regulated with sync and a turn ratio. My guess is it would sync A and B but I could be wrong.
With the enhanced NBC/NXC firmware you can pass 3 for AB, 4 for AC, 5 for BC, and 6 for ABC or you can pass 0xFC for AB, 0xFD for AC, and 0xFE for BC.
Gosh I never realized that there was so much more to the enhanced NBC/NXC firmware in addition to support for multi-dimensional arrays! And it's 100% compatible with the standard NXT firmware too.