Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added cbor compression for LaserScan, OccupancyGrid, and PointCloud #25

Merged
merged 2 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Core {
}

changeTopic(topicName, type, autoSubscribe = true) {
const { queueSize, throttleRate } = this.options;
const { compression, queueSize, throttleRate } = this.options;

if (autoSubscribe) {
this.unsubscribe();
Expand All @@ -71,13 +71,14 @@ class Core {
this.messageType = type || this.messageType;
this.topicInstances = (Array.isArray(topicName)
? topicName
: [{ name: topicName, type }]
: [{ name: topicName, messageType: type }]
).map(
({ name, messageType }) =>
new ROSLIB.Topic({
ros: this.ros,
name,
messageType,
compression: compression || 'none',
throttle_rate: throttleRate || 0,
queue_size: queueSize || 10,
}),
Expand Down
6 changes: 5 additions & 1 deletion src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export const DEFAULT_OPTIONS_LASERSCAN = {
alpha: 1,
decayTime: 0,
queueSize: 10,
compression: 'cbor',
colorTransformer: COLOR_TRANSFORMERS.INTENSITY,
flatColor: '#ffffff',
...DEFAULT_OPTIONS_INTENSITY,
Expand All @@ -211,6 +212,7 @@ export const DEFAULT_OPTIONS_LASERSCAN = {
export const DEFAULT_OPTIONS_MAP = {
alpha: 1,
colorScheme: MAP_COLOR_SCHEMES.MAP,
compression: 'cbor',
drawBehind: false,
};

Expand Down Expand Up @@ -242,7 +244,9 @@ export const DEFAULT_OPTIONS_PATH = {
alpha: 1,
};

export const DEFAULT_OPTIONS_POINTCLOUD = {};
export const DEFAULT_OPTIONS_POINTCLOUD = {
compression: 'cbor',
};

export const DEFAULT_OPTIONS_POLYGON = {
color: '#ffffff',
Expand Down