|
Re: User Messages from robot to driver station
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.
__________________
Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub
Last edited by JesseK : 11-15-2010 at 10:03 AM.
|