View Single Post
  #2   Spotlight this post!  
Unread 08-05-2015, 00:41
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,058
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: RoboRio and Serial Data

Quote:
Originally Posted by stu54 View Post
I have been trying to hook up a MaxSonar range finder to my RoboRio using the ASCII output of the MaxSonar rather than the analog output. I tried both the RS-232 port (using a TTL-to-RS-232 converter) and the MXP port. My programming language is Java for the WPIlib but that should not matter.

It seems like the syntax of the MaxSonar somehow violates the VISA format
that the RoboRIO expects so I get Java crashes when I try to read the serial
port. I don't know anything about the VISA format - I was just trying to read
the simple ASCII string from the MaxSonar. I know if I just use a loopback
to test my code I can read and write the serial ports but that's probably
because everything is using the VISA format deeper in the libraries.

Does anyone have experience with general ASCII devices on the RoboRIO
or would I have to use a device that put out the VISA format (which I
could only do if I passed the data from the MaxSonar though an Arduino
to re-format it for VISA, and that's a lot more trouble than just using the
analog input).

Thanks for any help.
I find it hard to believe that there would be a VISA-specific format required.

I've not used the serial functionality on the RoboRIO, but typically with serial devices you need to make sure that the baud rate matches (eg, you need to set the port speed to what the device is using) or you'll get unpredictable results similar to what you describe. Typical serial devices tend to be 9600 or 115200 baud, refer to your data sheet to see what your device uses.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff