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

Add static transform (/tf_static) to 3DViz Panel #336

Closed
Closed
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
3 changes: 2 additions & 1 deletion packages/webviz-core/src/panels/ThreeDimensionalViz/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Transforms from "webviz-core/src/panels/ThreeDimensionalViz/Transforms";
import withTransforms from "webviz-core/src/panels/ThreeDimensionalViz/withTransforms";
import type { Frame, Topic } from "webviz-core/src/players/types";
import type { SaveConfig } from "webviz-core/src/types/panels";
import { TRANSFORM_TOPIC } from "webviz-core/src/util/globalConstants";
import { TRANSFORM_TOPIC, TRANSFORM_STATIC_TOPIC } from "webviz-core/src/util/globalConstants";

export type ThreeDimensionalVizConfig = {
enableTopicTree?: boolean,
Expand Down Expand Up @@ -259,6 +259,7 @@ export default hot(
FrameCompatibilityDEPRECATED(withTransforms(Renderer), [
...getGlobalHooks().perPanelHooks().ThreeDimensionalViz.topics,
TRANSFORM_TOPIC,
TRANSFORM_STATIC_TOPIC,
])
)
);
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as React from "react";
import { getGlobalHooks } from "../../loadWebviz";
import Transforms from "webviz-core/src/panels/ThreeDimensionalViz/Transforms";
import type { Frame } from "webviz-core/src/players/types";
import { TRANSFORM_TOPIC } from "webviz-core/src/util/globalConstants";
import { TRANSFORM_TOPIC, TRANSFORM_STATIC_TOPIC } from "webviz-core/src/util/globalConstants";

type State = {| transforms: Transforms |};

Expand Down Expand Up @@ -44,6 +44,14 @@ function withTransforms<Props: *>(ChildComponent: React.ComponentType<Props>) {
}
}
}
const tfs_static = frame[TRANSFORM_STATIC_TOPIC];
if (tfs_static) {
for (const msg of tfs_static) {
for (const tf of msg.message.transforms) {
transforms.consume(tf);
}
}
}
return { transforms };
}

Expand Down
1 change: 1 addition & 0 deletions packages/webviz-core/src/util/globalConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const TEST_EVERYTHING_LAYOUT_QUERY_VAL = "_integration-test-everything-la
export const DEFAULT_WEBVIZ_NODE_PREFIX = "/webviz_node/";

export const TRANSFORM_TOPIC = "/tf";
export const TRANSFORM_STATIC_TOPIC = "/tf_static";
export const DIAGNOSTIC_TOPIC = "/diagnostics";
export const ROSOUT_TOPIC = "/rosout";
export const SOCKET_KEY = "dataSource.websocket";
Expand Down