Update on control testing with keys and switching to Cat5e control:
My current critical issues are in
bold.
The following code is a second attempt at sending mixed mode and speed commands to the RoboClaw (via Pro28) so that motors turn when a key is pressed and motors stop when it is released. I am happy to say it works fairly well and is smooth.
The previous code attempt was more complex as I used IF statements (like fool-goof code suggested earlier) to determine if a different key was pressed (ie different key = command or speed). It was working okay, but I started over from scratch which resulted in the following code.
Code:
Address Var Byte
Command Var Byte
Speed Var Byte
Checksum Var Byte
Clear
Address = 128
SETHSERIAL1 H38400
Main
Serin s_in, i38400, 100000, Main, [dec2 Command, dec3 Speed]
Checksum = Address + Command + Speed
hserout [Address, Command, Speed, (checksum & 0X7F)]
pauseus 100000
'Serout s_out, i38400, [13, "Command:", Command, 13, "Speed:", Speed, 13]
speed = 0
Checksum = Address + Command + Speed
hserout [Address, Command, Speed, (checksum & 0X7F)]
Goto main
In both attempts, there is a very slight hiccup after a key is pressed (ex key pressed -> motor turn -> minor pause -> motors continue).
Is the hiccup related to Fallentine's reference below? Also, the timing is tricky as suggested by Fallentine. I tinkered with the 'pauseus' location and duration a great deal (pauseus 100000). The current setup is the smoothest and most responsive yet.
Can it be improved? I also discovered that it is very important to send a 'full stop' command to transition between mix mode commands (refer to code where speed = 0).
Fallentine wrote:
Getting the timing right will be a bit tricky, my biggest issue was the fact the first repeate is different than the other repeats, so with the timing of like 250ms, your bot will keep doing what it was doing for a full 250ms after you stopped sending commands.
Br@y++'s terminal program doesn't always like virtual serial ports.. The only time it works with bluetooth serial ports is if i use bluesoleil as the stack, and even then it has problems.
Also, the RS232/RJ45 converter is working so I can communicate with Cat5e. Unfortunately, Terminal by Br@y doesn't work with virtual com port so I am still using serial cable when testing using terminal macros. Hopefully, Flowstone will solve the issue so I can send macro commands via Cat5e.
Can anyone recommend a flowstone example which might kickstart sending macros over virtual com port or via network connection? The following Flowstone applications (macro.exe or lynxmotionminiterminal.fsm) don't seem to work with virtual com port (?!?). I am playing around with Flowstone and reverse engineering samples to acheive basic communication over Cat5e. Then I can eliminate the serial cable, except when programming with BasicMicro Studio.
Mike
RoboClaw Mixed Mode being used:
Key Action Command Speed Value Range
F1 Turn Left 11 0-127
F2 Both Forward 08 0-127
F3 Turn Right 10 0-127
F14 Backward 09 0-127
Sample Macro Format being used: (two-digit command then three digit speed)
11064
08064
10064