You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Fanuc robot connected over ethercat. If I use the SDK to read the data from the robot, it comes in as type RAW and is a raw byte array. The Javascript code used by the node-red modules does not handle this situation. In CtrlxDataLayerV2.js, on line 306, there is a call to res.setEncoding('utf8'). This breaks the ability to receive raw bytes. If this line is removed, then the functionality there will correctly read the raw bytes into a javascript buffer type. It can then be converted to a utf8 string and parsed by the JSON parser. If that fails (and the buffer contains data), then the raw buffer data could be returned in JSON format as a hex string or something similar. Here is the code I have modified as an proposed solution:
const req = https.request(options, (res) => {
let data = Buffer.alloc(0);
//res.setEncoding('utf8');
res.on('data', function(chunk) {
data = Buffer.concat([data, chunk]);
});
res.on('end', function() {
// We expect 200 on success
if (res.statusCode !== 200) {
callback(CtrlxProblemError.fromHttpResponse(res, data));
return;
}
let dataString = data.toString('utf8');
console.debug(data)
console.debug(dataString)
// Try to parse the data
let payload;
try {
payload = CtrlxDatalayer._parseData(dataString);
} catch (err) {
let payloadString = data.toString('hex');
payload = { data: payloadString };
//callback(err, null);
}
// No error, return payload data.
callback(null, payload);
});
});
The text was updated successfully, but these errors were encountered:
Hello,
do you use a ctrlX Core to read the data from the Fanuc robot over PLC? How to you fetch the data from the robot? Please provide some more information's about. This library can only be used to communicate with a ctrlX OS Automation system.
We're going to verify this issue and provide a fix as soon as possible.
Thank you for reporting.
I have a Fanuc robot connected over ethercat. If I use the SDK to read the data from the robot, it comes in as type RAW and is a raw byte array. The Javascript code used by the node-red modules does not handle this situation. In CtrlxDataLayerV2.js, on line 306, there is a call to res.setEncoding('utf8'). This breaks the ability to receive raw bytes. If this line is removed, then the functionality there will correctly read the raw bytes into a javascript buffer type. It can then be converted to a utf8 string and parsed by the JSON parser. If that fails (and the buffer contains data), then the raw buffer data could be returned in JSON format as a hex string or something similar. Here is the code I have modified as an proposed solution:
The text was updated successfully, but these errors were encountered: