Wheels

ScratchLink ebots utilise stepper motors for drive power to the wheels and will respond to the “wheels” commands which have functionality specifically designed for a mobile robot.The scratchlink and eBot stepper motor driver can control two bipolar stepper motors up to to 3 Amps.  eBot uses two Nema17 bipolar stepper motors producing 45 Ncm torque with 2 Amps.

wheels config

ScratchLink firmware will auto-detect the ScratchLink stepper controller and configure it to default and enable it without any user input.  

ScratchLink has an inbuilt 3 speed automatic software “gearbox” that automatically provides the highest torque for the selected speed by utilising microstepping of the stepper motors that drive the wheels.  This function is automatically enabled but can be disabled so that only single stepping is used.

The following configuration commands are available.

Command Syntax:

wheels config info;

Purpose:  Reports currently stored wheels configuration.

Command Syntax:

wheels config enable [on|off];

Default: On

Purpose: Disable or enable wheels configuration.

Command Syntax:

 wheels config save; 

Purpose: saves wheels settings to configuration.

Command Syntax:

 wheels config default; 

Purpose: set wheels configuration back to default settings.

Command Syntax:

 wheels config auto [on|off]; 

Purpose: turns the microstepping based auto gearbox on or off

Command Syntax:

 wheels config set [circ][track][auto_off_ms]; 

Purpose: set the wheels configuration where:

“circ” is the circumference of the wheels in mm
“track” is the distance in mm between the vertical center of the two wheels in mm
“auto_off_ms” is how many msecs that the steppers will stay on if they aren’t doing anything (default is 3000).

Wheels Off & Brake

Command Syntax:

wheels off;
wheels; 

Purpose:  Turn off all power to the wheels – this is the same as off with coast.

Command Syntax:

wheels off brake;

Purpose:  Stop the wheels with a brake i.e. wheels “hold” their position

Note: wheels will brake and “hold” their position for 2 seconds (unless issued another command)

Command Syntax:

wheels off coast;

Purpose:  Stop the wheels with a coast i.e. wheels do not “hold” their position but are in “free wheel mode”

Wheels Distance Counter (stepper based eBots only)

The wheels distance counter (only for stepper based eBots) is configured for the wheel diameter and calculates the theoretical distance traveled for the robot (ignoring slippage and obstructions). The distance counter calculates net distance so is increase when the robot moves forward and is reduced when the robot moves backwards for each wheel and can be “read” and “reset”.

Command Syntax:

wheels zero;

Purpose:  Zero the distance counter for both wheels.

Command Syntax:

wheels read;

Purpose:  Reports total distance traveled by each wheel since last it was set to zero and if wheels are going (“0” means not moving while “1” means wheels are going)

Example report: {Wd: [247.1,230.4,1]} 

Wheels Distance (only for stepper based eBots)

The purpose of the “wheels distance” commands is to move the robot based on travel distance.

Note: Distance units are cm and can have one decimal point eg 3.1cm

Command Syntax:  “[ ]” means optional argument and “|” means OR

Command Syntax:

wheels distance [distance_cm];Purpose: both wheels move [distance_cm] at full speed.

Example: move both wheels forward 3.1cm

wheels distance 3.1;

Command Syntax:

wheels distance [lhs_cm][rhs_cm] [speed] [brake];

where:

  • [lhs_cm][rhs_cm] are distance for left and right wheels
  • [speed] are whole numbers from 0-100-
  • [brake] is either “on” for stop with brake (holds for 2 seconds automatically) or “off” for stop with coast

Purpose: wheels move desired distance at speed (optional) with either brake or coast (optional).
Example: move both wheels forward 3.1cm at full speed with coast after stop

wheels distance 3.1;
wheels distance 3.1 3.1 100 off;

Example: move left wheel 10cm and right wheel 9cm at half speed with a brake stop

wheels distance 10 9 50 on;

Wheels Power

The purpose of the “wheels power” command is to move the robot based on travel speed subject to travel time and with or without brake stop.

Note:  “[ ]” means optional argument and “|” means OR

Command Syntax:

wheels power [lhs_power] [rhs_power] [time] [brake];

where:

  • [lhs_power][rhs_power] are speed for left and right wheels from -100 to 100 (default is 100 i.e. full speed)
  • [time] is duration for travel in seconds which can have a single decimal value (default is indefinite)
  • [brake] is either “on” for stop with brake (holds for 2 seconds automatically) or “off” for stop with coast (default is “off” i.e. coast stop)

Example: move both wheels forward at half speed indefinitely with a coast stop i.e. no brake

wheels power 50 50 off;  OR  wheels power 50;

Note: to stop the wheels issue “wheels off;” OR “wheels off coast” OR “wheels off brake” as desired.

Example: move left wheel at half speed and right wheel at full speed for 2 seconds with a brake stop

wheels power 50 100 2 on;

Wheels RPM

Purpose: move the robot based on travel speed defined as revolutions per minute (rpm) subject to travel time and with or without brake stop.

Note:  “[ ]” means optional argument and “|” means OR

Command Syntax:

wheels rpm [lhs_rpm] [rhs_rpm] [time] [brake];

where:

  • [lhs_rpm][rhs_rpm] are rpm for left and right wheels from -150 to 150 (default is 150 i.e. full speed)
  • [time] is duration for travel in seconds which can have a single decimal value (default is indefinite)
  • [brake] is either “on” for stop with brake (holds for 2 seconds automatically) or “off” for stop with coast (default is “off” i.e. coast stop)

Example: move both wheels forward at half speed i.e. 75 rpm indefinitely with a coast stop i.e. no brake

wheels rpm 75 75 off;  OR  wheels rpm 75;

Example: move left wheel at half speed (75 rpm)  and right wheel at full speed (150 rpm) for 2 seconds with a brake stop

wheels rpm 75 150 2 on;

Wheels Circle

Purpose: turn the robot in a defined circle for a specific arc segment, at a defined speed with or without brake stop.

Note:  “[ ]” means optional argument and “|” means OR

Command Syntax:

wheels circle [degrees] [radius] [speed] [brake];

where:

  • [degrees] defines the traveled arc segment of the outer wheel
  • [radius] of the circle to be traveled to the outer wheel in cm
  • [speed] of the outer wheel from -100 to 100
  • [brake] is either “on” for stop with brake (holds for 2 seconds automatically) or “off” for stop with coast (default is “off” i.e. coast stop)

Defaults: 50cm radius for 90 degrees at full speed

Example using defaults: turn 90 degrees with a radius of 50 cm at full speed

wheels circle;

Example: move both wheels forward at half speed i.e. 75 rpm indefinitely with a coast stop i.e. no brake

wheels circle

Example: turn 180 degrees at 1/4 speed with 30 cm radius with a brake stop

wheels circle 180 30 25 on;

Wheels Drive

Purpose: move the robot based on drive commands at desired speed with optional conditions of time or for stepper eBots also distance.

Note:  “[ ]” means optional argument and “|” means OR

Command Syntax:

wheels drive [direction] [speed] (distance [cm] | time [sec]) [brake];

where:

  • [direction] can be forward [f], right turn [rt], left turn [lt], hard right turn [hrt], hard left turn [hlt], backwards [b]
  • [speed] of the fastest wheel from -100 to 100
  • [cm] is distance in cm
  • [sec] is time in seconds
  • [brake] is either on or off after stop (default is no brake stop)

Defaults: forward at full speed
Example using defaults: drive forward at full speed

 wheels drive;  

Example: drive forwards with a hard right turn at half speed

wheels drive hrt 50;

Example: reverse hard right turn at half speed

wheels drive hrt -50;

Example: reverse hard right turn at half speed for a distance of 30cm (measured by LHS wheel)

wheels drive hrt -50 distance 30;

Example: reverse hard right turn at half speed for 10 seconds.

wheels drive hrt -50 time 10;

Example: reverse hard right turn at half speed for 10 seconds with a brake stop.

 wheels drive hrt -50 time 10 on; 

Omni Direction Commands

These are the Omni Directions:

LD: Left Diagonal ([Same power for Front LHS + Rear RHS] but [0 power for Rear LHS + Front RHS])
RD: Right Diagonal ([Same power for Front RHS + Rear LHS] but [0 power for Front LHS + Rear RHS])
LS: Left Shift ([Same +ve power for Front LHS + Rear RHS] and [-ve same power for Rear LHS + Front RHS])
RS: Right Shift ([Same +ve power for Front RHS + Rear LHS] and [-ve same power for Rear RHS + Front LHS])

Wheels Summary Commands

ALL Wheels

wheels [off] [brake|coast]; // default is off brake;
wheels read; //read the current wheel values
wheels power [LHS_SPEED] [RHS_SPEED] [TIME_SEC=00] [on];
wheels drive [DIRECTION=f] [SPEED=100] [time] [TIME_SEC] [on];
wheels config enable [on|off];
wheels config info; // show the info
wheels config sensors [on|off]; // trun light sensors off and on.
wheels config remove; removes existing wheels config and resets- must power cycle
wheels config stream [MSEC]; // sets the time for the wheels to report back when streaming in msec. Can't be less than 50. Default is 50
bw stop [on|off] [white|black] [lhs|rhs];

BDC MOTOR Wheels only

wheels pwm [LHS_SPEED] [RHS_SPEED] [TIME_SEC=00] [on]; // speed is in raw PWM - ONLY FOR DCMOTERS
wheels drive [DIRECTION=f] [SPEED=100] [on]; // direction (s,f, rt, lt,hrt,hlt,b) or (stop,forward,backward,left,right, lefthard, righthard) Omni directions(LD,RD,LS,RS) at speed.

STEPPER wheels only

wheels zero; // zero the distance counter for both wheels.
wheels distance [LHS_MM] [RHS_MM=LHS_MM] [LHS_SPEED=100] [RHS_SPEED=LHS_SPEED] [on]; // the 'on' is to brake at the end
wheels distance notify [LHS_MM] [RHS_MM]; // if distance is left out, assumes 0 which turns it off.
wheels rpm [LHS_SPEED] [RHS_SPEED] [TIME_SEC=00] [on];
wheels mms [LHS_SPEED] [RHS_SPEED] [TIME_SEC=00] [on]; // speed is in mm/s
wheels circle [DEGREES=90] [RADIUS_MM=500] [SPEED=100] [on]; // radius applies to inner wheel, so 0 would be stopped inner wheel.
wheels drive [DIRECTION=f] [SPEED=100] [distance] [DISTANCE=00] [on]; // direction (s,f, rt, lt,hrt,hlt,b) or (stop,forward,backward,left,right, lefthard, righthard) Omni directions(LD,RD,LS,RS) at speed.
wheels config auto [on|off]; // turns the auto 'gearbox' on or off. By default it is on, but it will remember between boots.
wheels config set [circ] [track] [auto_off_ms]; // set the circumference, track, and auto of interval;