aggiornati pacchetti universal_robot e universal_robots_ros_driver
This commit is contained in:
@@ -19,6 +19,7 @@ class Analog {
|
||||
if (initObj === null) {
|
||||
// initObj === null is a special case for deserialization where we don't initialize fields
|
||||
this.pin = null;
|
||||
this.domain = null;
|
||||
this.state = null;
|
||||
}
|
||||
else {
|
||||
@@ -28,6 +29,12 @@ class Analog {
|
||||
else {
|
||||
this.pin = 0;
|
||||
}
|
||||
if (initObj.hasOwnProperty('domain')) {
|
||||
this.domain = initObj.domain
|
||||
}
|
||||
else {
|
||||
this.domain = 0;
|
||||
}
|
||||
if (initObj.hasOwnProperty('state')) {
|
||||
this.state = initObj.state
|
||||
}
|
||||
@@ -41,6 +48,8 @@ class Analog {
|
||||
// Serializes a message object of type Analog
|
||||
// Serialize message field [pin]
|
||||
bufferOffset = _serializer.uint8(obj.pin, buffer, bufferOffset);
|
||||
// Serialize message field [domain]
|
||||
bufferOffset = _serializer.uint8(obj.domain, buffer, bufferOffset);
|
||||
// Serialize message field [state]
|
||||
bufferOffset = _serializer.float32(obj.state, buffer, bufferOffset);
|
||||
return bufferOffset;
|
||||
@@ -52,13 +61,15 @@ class Analog {
|
||||
let data = new Analog(null);
|
||||
// Deserialize message field [pin]
|
||||
data.pin = _deserializer.uint8(buffer, bufferOffset);
|
||||
// Deserialize message field [domain]
|
||||
data.domain = _deserializer.uint8(buffer, bufferOffset);
|
||||
// Deserialize message field [state]
|
||||
data.state = _deserializer.float32(buffer, bufferOffset);
|
||||
return data;
|
||||
}
|
||||
|
||||
static getMessageSize(object) {
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
|
||||
static datatype() {
|
||||
@@ -68,13 +79,17 @@ class Analog {
|
||||
|
||||
static md5sum() {
|
||||
//Returns md5sum for a message object
|
||||
return '341541c8828d055b6dcc443d40207a7d';
|
||||
return 'f41c08a810adf63713aec88712cd553d';
|
||||
}
|
||||
|
||||
static messageDefinition() {
|
||||
// Returns full string definition for message
|
||||
return `
|
||||
uint8 VOLTAGE=0
|
||||
uint8 CURRENT=1
|
||||
|
||||
uint8 pin
|
||||
uint8 domain # can be VOLTAGE or CURRENT
|
||||
float32 state
|
||||
|
||||
`;
|
||||
@@ -93,6 +108,13 @@ class Analog {
|
||||
resolved.pin = 0
|
||||
}
|
||||
|
||||
if (msg.domain !== undefined) {
|
||||
resolved.domain = msg.domain;
|
||||
}
|
||||
else {
|
||||
resolved.domain = 0
|
||||
}
|
||||
|
||||
if (msg.state !== undefined) {
|
||||
resolved.state = msg.state;
|
||||
}
|
||||
@@ -104,4 +126,10 @@ class Analog {
|
||||
}
|
||||
};
|
||||
|
||||
// Constants for message
|
||||
Analog.Constants = {
|
||||
VOLTAGE: 0,
|
||||
CURRENT: 1,
|
||||
}
|
||||
|
||||
module.exports = Analog;
|
||||
|
||||
Reference in New Issue
Block a user