Communication with MotorControl
Posted: 06 Jun 2011, 11:27
Hello,
After posting over at the aforge forums about precise motor positioning with C# & direct commands, Linus came to my aid and suggested I look into his MotorControl system. It seemed to do exactly what I needed and so I set about expanding on the great work Andrew had done with aforge to provide MotorControl commands. Everything now works great except for one thorny issue .. the IsMotorReady command seems to have a very severe lag.
At first I thought it could be down to my lack of C# experience and so I hacked apart the bluetooth testing software found here : http://www.codeproject.com/KB/cs/nxtBluetooth.aspx to make a little test program so I could be sure that it wasn't anything I'd broken in aforge.
However I see exactly the same behaviour, I send a MotorControl command .. the motor starts spinning, I then manually send a series of IsMotorReady commands and I initially get a positive response (whilst the motor is moving), I keep sending IsMotorReady commands and eventually get a negative response, the motor stops I get a few more false responses followed by positive. It's as though IsMotorReady is offset by at least 2 seconds. I'm leaving all the 30ms (and more) pauses that Linus recommends in his documentation.
I've packaged up the source and compiled program here: The MotorControl command in the text box will move Motor B and the IsMotorReady command will check if Motor B is ready. A response of 31 31 means the motor is ready whilst 31 30 means the motor is currently moving.
I wonder if anyone else with MotorControl installed on their NXT would be able to try and repeat these results or has seen similar behaviour in the past ?
Many thanks,
ben
After posting over at the aforge forums about precise motor positioning with C# & direct commands, Linus came to my aid and suggested I look into his MotorControl system. It seemed to do exactly what I needed and so I set about expanding on the great work Andrew had done with aforge to provide MotorControl commands. Everything now works great except for one thorny issue .. the IsMotorReady command seems to have a very severe lag.
At first I thought it could be down to my lack of C# experience and so I hacked apart the bluetooth testing software found here : http://www.codeproject.com/KB/cs/nxtBluetooth.aspx to make a little test program so I could be sure that it wasn't anything I'd broken in aforge.
However I see exactly the same behaviour, I send a MotorControl command .. the motor starts spinning, I then manually send a series of IsMotorReady commands and I initially get a positive response (whilst the motor is moving), I keep sending IsMotorReady commands and eventually get a negative response, the motor stops I get a few more false responses followed by positive. It's as though IsMotorReady is offset by at least 2 seconds. I'm leaving all the 30ms (and more) pauses that Linus recommends in his documentation.
I've packaged up the source and compiled program here: The MotorControl command in the text box will move Motor B and the IsMotorReady command will check if Motor B is ready. A response of 31 31 means the motor is ready whilst 31 30 means the motor is currently moving.
I wonder if anyone else with MotorControl installed on their NXT would be able to try and repeat these results or has seen similar behaviour in the past ?
Many thanks,
ben