Skip to content

Commit ecbb719

Browse files
committed
Merge pull request #64 from adamantivm/latched-publisher
Adds latch parameter to Topics for publishing
2 parents effb20c + 7564840 commit ecbb719

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/core/Topic.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ROSLIB.Topic = function(options) {
2525
this.isAdvertised = false;
2626
this.compression = options.compression || 'none';
2727
this.throttle_rate = options.throttle_rate || 0;
28+
this.latch = options.latch || false;
2829

2930
// Check for valid compression types
3031
if (this.compression && this.compression !== 'png' && this.compression !== 'none') {
@@ -99,7 +100,8 @@ ROSLIB.Topic.prototype.advertise = function() {
99100
op : 'advertise',
100101
id : advertiseId,
101102
type : this.messageType,
102-
topic : this.name
103+
topic : this.name,
104+
latch : this.latch
103105
};
104106
this.ros.callOnConnection(call);
105107
this.isAdvertised = true;
@@ -136,7 +138,8 @@ ROSLIB.Topic.prototype.publish = function(message) {
136138
op : 'publish',
137139
id : publishId,
138140
topic : this.name,
139-
msg : message
141+
msg : message,
142+
latch : this.latch
140143
};
141144
this.ros.callOnConnection(call);
142145
};

0 commit comments

Comments
 (0)