Wheels

Drive Direction Word

Syntax:

wheels.driveDirectionWordCmd('direction',power)
//inputs
power: 0-100 and negative values
2WD|Tank|6WD direction: 'Forward'|'Right Turn'|'Left Turn'|'Hard Left Turn'|'Hard Right Turn'|'Backwards'
Omni direction: 'Forward'|'Right Turn'|'Left Turn'|'Hard Left Turn'|'Hard Right Turn'|'Backwards'|'Left Diagonal'|'Right Diagonal'|'Left Shift'|'Right Shift'

Example:

wheels.driveDirectionWordCmd('Forward',50)
control.wait(2)
wheels.stopCmd('brake')

Drive Direction Degrees

Syntax:

wheels.driveDirectionDegreesCmd(angle,power)
// inputs
angle: 0-360
power: 0-100 and negative values

Example:

wheels.driveDirectionDegreesCmd(0,50)
control.wait(2)
wheels.driveDirectionDegreesCmd(90,50)
control.wait(2)
wheels.stopCmd('brake')

Drive Radius

Note that this command only works with 2WD eBots because they have stepper motors which provide highly accurate distance.

Syntax:

wheels.driveRadiusCmd(radius,degrees,power,brake)
// inputs
degrees: 0-360
power: 0-100 and negative values
radius: number (mm) use inner wheel radius
brake: 'Brake'|'Coast'
// 2WD eBots only

Example:

wheels.driveRadiusCmd(200,360,50,'brake')
//only for 2WD eBots

Drive Power

Syntax:

wheels.drivePowerCmd(powerLHS,powerRHS)
// inputs
powerLHS & powerRHS: 0-100 and negative values

Example:

wheels.drivePowerCmd(50,50)
control.wait(2)
wheels.stopCmd('brake')

Stop

Syntax:

wheels.stopCmd('Brake'|'Coast')

Example:

wheels.drivePowerCmd(50,50)
control.wait(2)
wheels.stopCmd('brake')

Stop on Events

Stop on Events should be used for any time critical situations such as stay in the ring challenge or line follow etc. They allow eBot to stop without any delay caused by the WIFI relay of data to and from the browser. This works by automatically stopping any wheels commands on the eBot then relaying this info up to the browser after it has occured.

Wheels stop events are available for both line sensors (BW), both ultrasonic sensors and the colour sensor. The stop event for that sensor needs to be configured and then turned on. It can also be turned off at any time.

The wheels stop on event will stop all non-blocking (not time/distance based wheel command) wheel commands upon that event.

Stop on Black/White (BW)

Syntax:

wheels.stopOnBwCmd('on'|'off', 'black'|'white','LHS'|'RHS'|'LHS & RHS')

Example:

wheels.stopOnBwCmd('on','black','LHS & RHS')
wheels.driveDirectionWordCmd('Forward',50)
//eBot will continue driving until either line sensor shows black

Stop on Ultrasonic

The "Stop on Ultrasonic" works by setting either a "max" or "min" ultra value or setting both. This will generate events and when you turn on the "Stop on Ultrasonic" functionality eBot will autmatically stop whenever that event occurs.

Syntax:

wheels.setUltraEventCmd('LHS'|'RHS'|'LHS & RHS','Min'|'Max',distance in mm)
wheels.stopOnUltraCmd('on'|'off', 'LHS'|'RHS'|'LHS & RHS')

Firstly, set the Ultrasonic event (multiple events are OK).

wheels.setUltraEventCmd('LHS'|'RHS','Min'|'Max',distance in mm)

Secondly, turn ON the Wheels Stop on Ultrasonic.

wheels.stopOnUltraCmd('on', 'LHS & RHS')

Example:

// firstly set the Min Ultrasonic event for 30cm
wheels.setUltraEventCmd('LHS','min',30)
// then turn on the stoponUltraCmd
wheels.stopOnUltraCmd('on','min','LHS')
// eBot will stop when ultrasonic is less than 30cm)
wheels.driveDirectionWordCmd('Forward',50) // start going forwards

Stop on Colour

The Wheels Stop on Colour is turned on with any colour in the command below and turned off with 'Off'. The colour definitions may need calibrating depending your lighting conditions and colour patches (if not using our standard colour tapes). The Colour Guess system uses an algorithm to distinguish colours. We have calibrated it using Norton Bear brand Cloth tape of colours White, Red, Green, Blue, Black, Tan and Yellow. So for best results use that tape. Our standard Colour Guess calibration returns the following colours: White, Red, Green, Blue, Black, Tan and Yellow.

Syntax:

wheels.stopOnColourCmd('Off'|'White'|'Red'|'Green'|'Blue'|'Black'|'Yellow'|'Tan')

Example:

wheels.stopOnColourCmd('red')
wheels.drivePowerCmd(50,50)