8.1. act command
All the following act instructions use POST, and the URL is /action/act.
8.1.1. Save teaching points
Command name: save_point.
Command parameters:
/**
* @param string name The name of the teaching point recorded by string name
* @param string speed speed
* @param string elbow_speed elbow speed
* @param string acc acceleration
* @param string elbow_acc elbow acceleration
* @param string toolnum Tool number
* @param string workpiecenum Workpiece number
*/
Instruction example:
{
cmd: "save_point",
data:{
name: "point1",
speed: "100",
elbow_speed: "100",
acc: "100",
elbow_acc: "100",
toolnum: "1",
workpiecenum: "1"
}
}
Command feedback:
/**
* @return status:200 "success"
* @return status:404 "fail"
*/
8.2. sta command
All the following sta instructions use POST, and the URL is /action/ sta .
8.2.1. Get robot status data
Command name: basic.
Command parameters: none.
Instruction example:
{
cmd: "basic",
}
Command feedback:
/**
* @return status:200
* @param object joints joint position
* @param object tcp Descartes pose
* @param array exAxisPos External axis position
* @return status:404 "fail"
*/
{
joints: {
j1: "90",
j2: "90",
j3: "90",
j4: "90",
j5: "90",
j6: "90",
},
tcp: {
x: "100",
x: "100",
z: "100",
rx: "90",
ry: "90",
rz: "90",
},
exAxisPos: [0,0,0,0]
}
8.3. get command
All the following get instructions use POST, and the URL is /action/get.
8.3.1. Get teaching points
Command name: get_points().
Command parameters: none.
Instruction example:
{
cmd: "get_points"
}
Command feedback:
/**
* @return status:200 "success"
* @param ${point_name}: object teaching point related information
* @return status:404 "fail"
*/
Instruction feedback case:
{
"localpoint1": {
"name":"localpoint1",
"elbow_speed":"1",
"elbow_acc":"1",
"x": "1",
"y": "1",
"z": "1",
"rx": "1",
"ry": "1",
"rz": "1",
"j1": "1",
"j2": "1",
"j3": "1",
"j4": "1",
"j5": "1",
"j6": "1",
"toolnum": "1",
"workpiecenum": "1",
"speed": "1",
"acc": "1",
"E1": "1",
"E2: "1",
"E3": "1",
"E4": "1"
}
}
8.3.2. Get system configuration
Command name: get_syscfg().
Command parameters: none.
Instruction example:
{
cmd: "get_syscfg"
}
Command feedback:
/**
* @return status:200 "success"
* @param string log_count Maximum number of log days recorded
* @param string language Currently using language pack
* @param string lifespan overtime time
* * @return status:404 "fail"
*/
Instruction feedback case:
{
log_count:"10",
language:"zh",
lifespan:"1800"
}
8.4. set command
All the following set instructions use POST, and the URL is /action/set.
8.4.1. Issue system variable instructions
Command name: 511.
Command parameters:
/**
* @param int index system variable serial number: 1-20
* @param int value system variable value
*/
Instruction example:
{
cmd: 511,
data:{
content:"SetSysVarValue(2,1)"
}
}
Command feedback:
/**
* @return status:200 1: represents success, 0: represents
* @return status:404 "fail"
*/
Instruction feedback case:
1
8.4.2. Get system variable instructions
Command name: 512.
Command parameters:
/**
* @param int index system variable serial number: 1-20
* /
Instruction example:
{
cmd: 512,
data:{
content:"GetSysVarValue(2)"
}
}
Command feedback:
/**
* @return status:200
* @param int value system variable value
* @return status:404 "fail"
* /
Instruction feedback case:
1
8.5. better-sqlite3 directive
8.5.1. Query the first row of records in the database
Command parameters:
/**
* @param string db_name Database name (including absolute path)
* @param string sql sql statement
* @return string result The first row of records queried
*/
Instruction content:
queryget(string db_name, string sql);
8.5.2. Query all records in the database
Command parameters:
/**
* @param string db_name Database name (including absolute path)
* @param string sql sql statement
* @return string result All records queried
*/
Instruction content:
queryall(string db_name, string sql);
8.5.3. Execute database statements
/**
* @param string db_name Database name (including absolute path)
* @param string sql sql statement
* @param object obj sql Parameters required for sql statement execution
* @return \
*/
Command parameters:
exec(string db_name, string sql, object obj);
Instruction content:
8.6. socket command
8.6.1. socket send
Command parameters:
/**
* @param string send_content socket Socket communication command sends content
* @return \
*/
Instruction content:
socket_cmd.send(string send_content);//8065
socket_file.send(string send_content);//8067
8.6.2. socket recv
Command parameters:
/**
* @return string recv_content socket Socket communication command reply content
*/
Instruction content:
socket_cmd.recv();//8065
socket_file.recv();//8067
8.7. File Operation Commands
8.7.1. Write File Content
/**
* @param String filename File path
* @param string content Content to write
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @return true/false
*/
write(filename, content, callback);
8.7.2. Read File Content
/**
* @param String filename File path
* @param string content Content to write
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @return String File content
*/
read(filename, callback);
8.7.3. Modify File Permissions
/**
* @param String filename File path
* @param Number mode Permission mode (e.g. 0644)
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @return true/false
*/
chmod(filename, mode, callback);
8.7.4. Read Directory Contents (Including Subdirectories)
/**
* @param String path File path
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @return Array Filename array
*/
readdir(path, callback);
8.8. Compression/Decompression Commands
Note
Distinguish between LA and QX versions (LA version doesn’t need callback parameter).
LA module import: var execSync = require(‘child_process’).execSync;
QX module import: var tar_utils = require(‘/usr/local/etc/node/sys/tools/tar_utils’);
8.8.1. Create tar.gz Archive
Create tar.gz example (LA):
var cmd = 'cd / && tar -zcvf ' + FILENAME + '-C ' + DIR;
execSync(cmd);
Create tar.gz command description (QX):
/**
* @param {Array|String} sourcePaths Source file/directory path array or single path
* @param String targetFile Target archive path
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @param String basePath Base path, defaults to '/'
* @return \
*/
createTarGz(sourcePaths, targetFile, callback, basePath);
8.8.2. Extract tar.gz File
Extract tar.gz example (LA):
var cmd = 'cd / && tar -zxvf ' + FILENAME;
execSync(cmd);
Extract tar.gz command description (QX):
/**
* @param String sourceFile Source archive path
* @param String targetDir Target extraction directory
* @param Function callback Callback function with (error) parameter (not needed for LA version)
* @return \
*/
extractTarGz(sourceFile, targetDir, callback);