I have been reprogramming old robots to run in java. I was wondering if the robot can transmit messages back to the user.
Yes. In LabVIEW you could use the “WRITE USER MSG” function in the WPI Library. I would imagine there’s something similar in Java.
**
See the DriverStationLCD class
If you are talking of pre-Crio robots, the answer is yes. In IFI controlleers, you can even use one of the digital ports on the RC to port data back to the OI. It’s tricky but it can be done.
The hard part with the pre-cRIO contollers is they don’t support Java.
The IFI OIs also display a user byte of information from the robot code.
If direct serialization is used, then streaming messages between any language is very simple. “Serialization” means transforming an object to its primitive types, then transforming those primitive types to a byte array in a controlled fashion. So long as the objects are simple and the encoding/decoding is done properly, any developer can do serialization manually.
Perhaps a better way to do it is via a standardized language, like WSDL or IDL. However, using the standard protocols to go along with those languages isn’t possible with any FRC control system that I’m aware of. Instead, WSDL (xml variant) would be compiled on your development machine to its C/C++/Java equivalent classes: each class has an encode() and decode() method that ensures a C object is identical to its Java equivalent. The structure in physical memory will be different at run-time, yet the code can call the same methods and access the same data. For a first-time run through, I recommend that you keep the C/Java objects very simple so they only contain primitive (int/short/long/char]) types.
Overall, my suggestion is to create a WSDL file, compile it into C/Java equivalents, and then use the C classes on the robot and the Java classes on the display. Call class.encode() on the robot to get a byte array, then send that byte array from the robot to the display via the robot’s communications protocols, the class.decode() on the display. There are some more nuances to get it working properly, but this is the fundamental principle that should get you started.
Being able to do this will open up doors in your career. It will enable you to develop brand new features in a new language while still interfacing with legacy systems developed before you were even born. In industrial systems, just because something is ‘old’ doesn’t mean it’s outdated.
We were able to interface the CRIO to our own custom “Radar” display in Java on our laptop in 2009 by doing direct serialization. We could see blips of all other robot trailers detected by the camera on our radar display, as well as have active statuses for the battery, sensors, etc. We didn’t do well that year since the robot had many mechanical issues, but the display piece was solid.