cruise-automation / webviz

web-based visualization libraries
https://webviz.io/
Apache License 2.0
2.03k stars 412 forks source link

Unable to visualize marker in 3D panel #703

Open vorzawk opened 2 years ago

vorzawk commented 2 years ago

I am new to webviz and started out by reading the documentation. As a first step, I want to visualize a sphere on the node playground, so I have the following code.

import { Input, Messages } from "ros";
import { Marker, MarkerTypes } from "./markers";

type Output = Messages.visualization_msgs__Marker;

export const inputs = ["<topic name>"];
export const output = "/webviz_node/test";

const publisher = (message: Input<"<topic name>">): Messages.visualization_msgs__Marker => 
{
  let marker: Messages.visualization_msgs__Marker;

  marker = new Marker(
  {
    header : {
      frame_id: "vehicle_origin", 
      stamp: {sec: 0, nsec: 0},
      seq: 0,
    },
    type : MarkerTypes.SPHERE,
    pose : {
        position: {x: 1, y: 1, z: 0},
        orientation: {x: 0, y: 0, z: 0, w: 1.0}
    },
    color: {r: 1, g: 0, b: 0, a: 0},
    scale: {x: 1, y: 1, z: 1}
  })
  return marker;
}

export default publisher;

There are no errors, but I do not see the sphere on the 3D panel.

vorzawk commented 2 years ago

I could figure out what the issue was, the a in the color attribute refers to the transparency. The objects were actually getting rendered, but simply invisible as they were fully transparent as a : 0 😔