xbot con rastrello21 sml
Robotic beach cleaner by Dronyx


Mixed Mode Steering, also known as tank style steering or skid steering, is easily achieved by selecting from a simple drop down menu in our dual channel controllers.  You can, however, still achieve this style of steering mode when using two single channel motor controllers connected to two individual motors.  Here's How:


Wiring The Controllers

First you will need two network your two single channel motor controllers together via RoboCAN.  If you are not yet familliar with RoboCAN please have a look at our article, RoboCAN:  A Simple Meshed Network, as well as our RoboCAN Practical Example FAQ Article.  Set your Master Controller to Node ID = 1, and your Slave Controller to Node ID = 2.

 Artboard 2

Configuring the Master Controller

After you have established your CAN connections between the two controller and configured them both for RoboCAN, you will now need to set up your command device on the Master Controller.  The MicroBasic script provided at the end of this script will allow you to give commands to your controller via an analog input source (such as an analog joystick), or via a pulse input source (such as an RC Remote).


If using an analog joystick, connect the two analog signal wires to analog inputs 1 and 2 respectively on your Master Controller.  Configure the Capture Type on these two inputs to "Absolute".  Setting the Input Use is not necessary.  Finally, you will want to calibrate both inputs.


If using an RC device, connect the two signals from your RC Receiver to pulse inputs 1 and 2 respectively on your mater controller.  Configure the Captrue Type on these inputs to "Pulse Width".  Again setting the Input Use is not necessary.  Finally, calibrate the two inputs.


MicroBasic Script

After configuring your input type copy and paste the MicroBasic Script below to the Scripting Tab of Roborun+.  As mentioned previously this script has two sections dependent on the command type you are using.  If using an RC device, uncomment the RC CONTROL section and comment out the ANALOG CONTROL section.  If you are using an analog device, you can leave the script as is.  You will then load the script to your Master controller. After you run the script in Roborun+ and confirm it works as expected, you can enable the script to autostart when the controller powers on.


' This script is provided "as-is", without warranty of any kind,
' expressed or implied, including but not limited to the warranties of
' merchatability, fitness for a particular purpose and
' noninfringemement. In no event shall Roboteq be liable for any claim,
' damages or other liability, arising from the use of the software.

Option Explicit
' Mixed mode using two separate controllers
' Script is written for use in any single channel controller.
' Script must be loaded and executed in controller that will serve as Master on a RoboCAN network.
' Second controller will act a Slave. Master node id=1, Slave node id=2
' Script is provided for demonstration purposes, as-is without warranty.
dim Pulse1Present as integer ' Raw pulse 1 value
dim Pulse2Present as integer ' Raw pulse 2 value
dim Throttle as integer ' Throttle Command
dim Steering as integer ' Seering Command
dim LeftMotor as integer ' Left Motor Command
dim RightMotor as integer ' Right Motor Command
dim CANAlive as integer ' Alive Robocan nodes
' Read list of alive RoboCAN nodes
CANAlive = getvalue(_ICL, 2)
'-------------------------------------RC CONTROL----------------------------------------
'Uncomment below to enable RC Command Mode
'Pulse1Present = getvalue(_PI, 1) ' Check if Radio is on by reading raw pulse value
'Pulse2Present = getvalue(_PI, 2)
'if (Pulse1Present > 0 and Pulse2Present > 0 and CANAlive > 0) ' Check that both channels have a signal and slave node is alive
'Capture RC joystick value after scaling and conversion
' Throttle = getvalue(_PIC, 1) ' Throttle on pulse input 1
' Steering = getvalue(_PIC, 2) ' Steering on pulse input 2
' Throttle = 0 ' Radio if off, all commands at 0
' Steering = 0
'end if
'---------------------------ANALOG JOYSTICK CONTROL--------------------------------
' Uncomment below to enable Analog Command Mode
' WARNING there are no safety. If joystick is missing, motors will runaway
if (CANAlive > 1) ' Check that slave node is alive
Throttle = getvalue(_AIC, 1) ' Throttle on analog input 1
Steering = getvalue(_AIC, 2) ' Steering on analog input 2
Throttle = 0
Steering = 0
end if
' Compute Simple mixed mode algorithm
LeftMotor = Throttle + Steering
RightMotor = Throttle - Steering
' Cap commands to +/-1000
If LeftMotor > 1000 then LeftMotor = 1000
If LeftMotor < -1000 then LeftMotor = -1000
If RightMotor > 1000 then RightMotor = 1000
If RightMotor < -1000 then RightMotor = -1000
' Apply Left Command to local motors
SetCommand(_G, 1, LeftMotor) 'Send command to local motor ch1
'SetCommand(_G, 2, LeftMotor) 'Send command to local motor ch2
' Send Right Command to Slave, node 2 on RoboCAN network
SetCANCommand(2, _G, 1, RightMotor) 'Send command to slave motor ch1
'SetCANCommand(2, _G, 2, RightMotor) 'Send command to slave motor ch2
wait(10) ' Repeat loop every 10ms / 100Hz
goto top


Go to top