John,
Sounds like you've got the hardware and startup issues covered. I'm with Woody that, pending actual testing, having two pulse inputs simultaneously connected might cause trouble. You might be able to use a simple SPST switch on one of them and test (in the script) each of those pulse inputs (the raw input is I think available among the Roboteq _xxx variables). One might stay connected all the time. If the one with the switch is ON and has output, it could take precedence and the script could ignore the one that's always connected. If the one with the switch is OFF (those pulse inputs will be 0,0), the always on one would take precedence. This is the way that Dynamic handles switchover between user and attendant controls: though, of course, it's by CAN.
Scripting is not hard (you will get the hang of it once you read a primer and the manual with the same care you want others to devote to what you write) and quite flexible. Want a speed pot? Connect one to another analog input, say number 5. Read that with _AIC, 5 and use that value to set the value of vForwardScaling. About 9 lines of code and two of those are a SpeedPot label for the subroutine and a RETURN - just a few lines that actually do something.
- Code: Select all
SpeedPot:
vForwardScaling = GetValue (_AIC, 5)/10 'assuming that you've scaled the pot to read 0-1000, and the voltage is offset to scan 0.5 to 4.5 volts.
'avoid runaway if pot goes over-voltage, but still allow driving at a reasonable speed
IF vForwardScaling > 100 THEN
vForwardScaling = 80
END IF
'allow at least slow driving at minimum pot and even if pot gets disconnected
IF vForwardScaling < 10 THEN
vForwardScaling = 10
END IF
RETURN
Notice that we're starting to run a fair number of wires: power and output from your joystick, RC receiver power and output, speed pot, current sensors (though these could be mounted right at the Roboteq outputs), lights, actuators. Moreover, any time you decide to make a change means changing the harness. One of the other advantages of a CAN bus is that communication is on the same 2 wires to all (data, not actuator) devices, so you can use the same 4-wire cable for all connections: B+ and B-, CAN-hi and CAN-lo. At the moment the Roborun software support of CAN is very primitive. To implement it you'd have to pretty much manually write every frame of CAN information. That script would look like the window that comes up when you build a MicroBasic script, except that the programmer would have to be writing all of that for CAN rather than having the Roborun compiler do it. Maybe by the time I have need of a Roboteq, they will have put some CAN-writing tools into their software, because I'm sure not up to manually writing the many, many CAN frame specifications that would be needed.
By using a pulse joystick you automatically become pretty resistant to EMI, but if you add a speed pot, you now have an "antenna" again. That's another advantage of CAN: it is quite noise resistant. Lastly, with CAN it would be like having an (effectively) infinite number of inputs and outputs on the Roboteq - all CAN devices share the same 2 wires and one CAN-lo and one CAN-hi port. It's like USB. Each module has an identifier, they all transmit simultaneously and repeatedly until a message been acted on. The computer has priority levels for each ID, and it eventually (at computer speed) responds to all of the requests. USB might even be just as good as CAN, but CAN has a long history in vehicular applications so it's become the de facto standard for auto and other mobile applications. Standard is a strange word for CAN - the standard is actually so flexible that manufacturers can do implementations that, unlike for USB, won't talk to each other. That flexibility means that the same basic protocol is still usable after 30 years of hardware improvement, but it does mean that manufacturers can protect "proprietary" interests. I wish I knew enough about it to hack existing protocols (e.g. Dynamic's), but I don't.
Ciao,
Lenny