studio icon indicating copy to clipboard operation
studio copied to clipboard

"User Script did not produce a message" but no error details

Open jtbandes opened this issue 1 year ago • 1 comments

Description

  • Version: latest web
  • OS: Chrome / macos
  • Data source (e.g. bag file, mcap file, rosbridge, ROS 1/2 native): https://librealsense.intel.com/rs-tests/TestData/stairs.bag

Steps To Reproduce

  • Load this data source: https://librealsense.intel.com/rs-tests/TestData/stairs.bag
  • Add a user script with this code:
import { Input, Message } from "./types";
type Output = Message<"foxglove_msgs/ImageAnnotations">;
type PointsAnnotationMsgType = Message<"foxglove_msgs/PointsAnnotation">;

export const inputs = ["/device_0/sensor_1/Color_0/image/data"];
export const output = "/studio_script/point_annotations";

export default function node(
  event: Input<"/device_0/sensor_1/Color_0/image/data">
): Output {
  const out = {} as Output;
  out.points = new Array();
  const line_points = {} as PointsAnnotationMsgType;
  line_points.points = new Array();
  line_points.outline_colors = new Array();
  (line_points as any).outline_color = { r: 1, g: 1, b: 1, a: 1 };
  let x0: number = 0;
  let x1: number = 1920;
  let y0: number = 500;
  let step: number = 10;
  let i: number = 0;
  while (x0 + i * step <= x1) {
    let xi: number = i * step;
    line_points.points.push({ x: xi, y: y0 });
    i++;
  }
  line_points.type = 3;
  line_points.timestamp = event.message.header.stamp;
  if (line_points.points.length % 2 !== 0) {
    line_points.points.length -= 1;
    line_points.outline_colors.length -= 1;
  }
  out.points.push(line_points);
  return out;
}

Expected Behavior Some error should show me why my user script didn't produce a message.

Actual Behavior image

jtbandes avatar Aug 10 '22 01:08 jtbandes

You also have to enable the annotation topic in an Image panel:

image

jtbandes avatar Aug 17 '22 19:08 jtbandes

image

When I open the user script editor I see this problem.

So there is an additional error shown.

defunctzombie avatar Aug 17 '22 19:08 defunctzombie