System Commands affect the way in which data is transmitted/received or act upon the ScratchLink Firmware or ScratchLink Controller System.
reset
Command Syntax:
reset;
Purpose: resets all devices to their default state.
reboot
Command Syntax:
reboot;
Purpose: reboots i.e. power cycle restart the ScratchLink Controller which is the same as physically unplugging the power. Note that communication connection will be lost and will need to be established again.
Smart Streaming
By default (ie unless change) the streaming command will return values only if there is a sufficient change ie ‘smart’ streaming.
This is turned on and off by
stream config smart on|off;
It will automatically turn on at boot-up.
The ultrasonic and proximity sensors min change value can be set via commands, and is seen in their config data. ie
ultra config smart 50;
proximity config smart 6;
would result in –
{“config”:”Ultra”,”Num”:0,”Enabled”:1,”Pin”:17,”TimeoutDistance”:2000,”EventMin”:200,”EventMax”:700,”Average”:0,”Smart”:50}
{“config”:”Proximity”,”Num”:0,”Enabled”:1,”Pin”:36,”CutOff”:20,”Smart”:6}
Only changes great than the smart value will result in a packet coming back.
For everything else the smart limit (change) is hard coded –
analog group >2
battery voltage >.1
battery current >.1
rfid != last card.
Wii button press changed, or joystick changed by >2
wheels distance or light sensor changed >5.
read
Command Syntax:
read;
Purpose: Read current sensor values from ScratchLink Controller and return values. “read” returns one set of values and is not a “stream” which is continuous.
ping
Command Syntax:
ping;
Command generates a “pong” response in the form:
{pong:time in ms} eg. {pong:10}
Purpose: generates a response “pong” packet indicating the time since the last “ping” command. You can use this to see how fast, and at what intervals, packets are getting to the robot, over any of the connection mechanisms. You do this by calling it multiple times. For example:
for (i=0;i<50;++i) { await sleep(5); socket.send('ping;'); }
Example output: shows that it was about 177 seconds since the last “ping” command and thereafter 4ms and 1ms…
{pong:177877} {pong:4} {pong:1} {pong:1} {pong:1} {pong:1} {pong:1} {pong:38} {pong:2} {pong:2} {pong:2} {pong:0} {pong:1} {pong:0} {pong:1} {pong:7} {pong:9}