robotPy Interfacing with driver


#1

Hello,
Since last season finished, I have been working on making the shift from LabView to Java, and now that we are in a new school year, we have a few students interested in programming. I think starting them in Python is a good place to begin.

So, I have gone through the lit, built some code, and converted the functions of our previous robot to robotpy.

However, I am stuck at the dashboard bit. Right now I am using the simulator, and cannot figure out how to create an interface with shuffleboard or the labview dashboard.

I tried following the directions, but with the simulator, shuffleboard crashes (with no error in the console).

So, my two questions are this.

  1. How can I get the camera feed from a robot py robot into a dashboard (I have the line of code in my robot py project)?
  2. How can I get feedback and controls (some variables like a speed trim etc) into a dashboard?

I am using the term dashboard lightly. I am not married to LabView. In fact, it seems shuffleboard would be perfect, but it keeps crashing. Will this just work, when we try it with a real robot?

Thank you all for developing this. I think it will help us get students to take the lead programming this year.

~Mr. R^2

<edit>
I had some success using shuffleboard with the Pathfinder Demo linked to her (that is an excellent resource by the way).
So perhaps, some of the issue lies in my simulator files.


#2

The camera should work with shuffleboard et al on a real robot if you follow the instructions at https://robotpy.readthedocs.io/en/stable/vision/roborio.html#automatic-camera-streaming


wpilib.CameraServer.launch()

The camera won’t work in simulation.

Feedback and controls will work the same way as in Java. Use the various SmartDashboard/NetworkTables objects to send data.

When in simulation, you have to tell Shuffleboard/Smartdashboard to talk to 127.0.0.1 instead of the robot. There is some light documentation at https://robotpy.readthedocs.io/en/stable/guide/simulator.html#communicating-via-networktables


#3

Thank you. As a follow up, perhaps unrelated, but I did not think it warranted a new thread. When I run on the simulator, or attempt to run on the robot (We are having major unrelated network issues), I see the following… Default IterativeRobot.disabledInit() method… Overload me!

I get the message whether I override the method or not, and whether I use IterativeRobot or not.

Is this normal?

Thanks.
~Mr. R^2


#4

Yes. It also occurs in Java as well.

Vaguely unrelated, recommend you use TimedRobot instead of IterativeRobot.


#5

Thank you. Somehow I had not noticed this in Java.

I have been using timed robot for most of our work thus far. I just switched to Iterative to see if it changed the message. It did not. :slight_smile:


#6

In Java, it doesn’t come out if you override the method and don’t call super