Add an image to smartdashboard

I’d like for when I choose an auto in smartdashboard to be able to see the path the robot will take on the field. I have all of the images but I’m not sure how I would do this. The putData method wouldn’t accept an image.

I was thinking something like this:

BufferedImage img;
    try {
      img = ImageIO.read(new File("C:\\Users\\Elliot Scher\\Desktop\\FRC-2815\\Robot Code\\2815_Rapid_React\\PathWeaver\\Autos\\Images\\FiveBall1.png"));
    } catch (IOException e) {
      e.printStackTrace();
      img = null;
    }
    SmartDashboard.putData("FiveBall1", img);

Is this even possible?

Thanks!

Are you using the actual smart dashboard application, or Shuffleboard?

I’m using shuffleboard but the sendablechooser is put into smartdashboard.

I’ve never tried it, but I believe you could use RawSource.

1 Like

how can I add rawsource to smartdashboard?

Like I said, I have not used it, but I imagine it would go something like:

import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.cscore.raw.RawSource;  
import edu.wpi.first.cscore.VideoMode.PixelFormat;

static final String name = "AutoPath";
static final VideoMode.PixelFormat pixelFormat = VideoMode.PixelFormat.kMJPEG;
static final int width = 640;
static final int height = 400;
static final int fps = 1;
RawSource rs = new RawSource​(name, pixelFormat, width, height, fps);
CameraServer.addCamera(rs);
rs.putFrame(...);

Alternatively, I would look at a custom widget.

The easiest and most portable (between different methods of generating trajectories) method will be to directly draw a trajectory onto your field widget and display the field on the dashboard. You can read about the field widget and how to put a trajectory on it here:

2 Likes

Another solution (outside of software really) is to have a piece of laminated printer paper with your autos printed on them.

Makes looking at starting positions easier to judge, and with a dry-erase marker is also a tool for match strategy meetings.

3 Likes