Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
/ robotiq-ft-java Public archive

An unofficial Java package for cross-platform serial communication with a Robotiq FT Sensor

License

Notifications You must be signed in to change notification settings

engnadeau/robotiq-ft-java

Repository files navigation


Logo

Robotiq FT Sensor - Java

An unofficial Java package for cross-platform serial communication with a Robotiq FT Sensor

Release

GitHub tag GitHub issues GitHub forks GitHub stars GitHub license

Twitter

Communication Protocol

The communication protocol (and basis for config.properties) for using a FT Sensor can be found here.

Usage

Tested Platforms

  • Windows 10 x64
  • OSX 10.11.5 x64

Quick Tests

  • Run SerialUtilities.java to list available serial ports (sensor should be connected and seen here)
  • Update comm_port in config.properties to the proper serial port (e.g., COM3 for Windows, cu.usbserial-FTXU0M1B for OSX)
  • Run RobotiqFtMaster.java for a 20 second burst of data printed to the console

Example

public static void main(String[] args) {
    Logger.info("Running simple RobotiqFT connection test");
    RobotiqFtMaster robotiqFtMaster = new RobotiqFtMaster();
    try {
        robotiqFtMaster.connect();

        int maxTime = 20;
        Logger.info(String.format("Reading from sensor for %d seconds", maxTime));
        long startTime = System.currentTimeMillis();
        while ((System.currentTimeMillis() - startTime) < (maxTime * 1000)) {
            try {
                System.out.println(Arrays.toString(robotiqFtMaster.getCompleteMeasure()));
            } catch (ModbusException e) {
                Logger.error(e);
            }
        }
    } catch (Exception e) {
        Logger.error(e);
    }
}