aurora-opensource / streetscape.gl

Visualization framework for autonomy and robotics data encoded in XVIZ

Home Page:http://www.streetscape.gl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to add two ego cars?

JianXinyu opened this issue · comments

Is it possible to show another car using the same car model as the ego car? I'd like to show a shadow-ego car as the historical trajectory.

@JianXinyu One way we approached this was simply to define a pose, such as /ghost_pose, but then we added them directly as a customLayer to the LogViewer props.

@twojtasz Thanks for your answer! I'll test both methods in my project.

const customLayers = [
  new SimpleMeshLayer({
      id: 'shadow-ego',
      opacity: 0.5,
      coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
      coordinateOrigin: matrix?.origin || CAR.origin,
      // Adjust for car center position relative to GPS/IMU
      getTransformMatrix: d =>
        matrix?.vehicleRelativeTransform
          ?.clone()
          ?.translate(origin)
          ?.scale(scale),
      mesh,
      data: CAR_DATA,
      pickable: true,
      getPosition: d => d,
      getColor: [245, 34, 45],
      wireframe: false,
      updateTriggers: {
        getTransformMatrix: matrix?.vehicleRelativeTransform
      },
  })
]

considering this has been answered, I'm going to close this issue. Please re-open or file a new issue.