Search in sources :

Example 1 with LinearInterpolationCommand

use of com.neuronrobotics.sdk.commands.cartesian.LinearInterpolationCommand in project java-bowler by NeuronRobotics.

the class BowlerBoardDevice method sendLinearSection.

/**
 * This function will set up a multi-dimentional send for position and interpolation
 * @param x new x position
 * @param y new y position
 * @param z new z position
 * @param mmOfFiliment new target for mm of filiment
 * @param ms time in MS
 * @return number of spaces in the buffer
 */
public int sendLinearSection(TransformNR taskSpaceTransform, double mmOfFiliment, int ms, boolean forceNoBuffer) {
    // Log.enableInfoPrint();
    RuntimeException e = new RuntimeException("There is no more room left");
    ;
    if (numSpacesRemaining == 0) {
        throw e;
    }
    BowlerDatagram dg = send(new LinearInterpolationCommand(taskSpaceTransform, mmOfFiliment, ms, forceNoBuffer));
    if (dg.getRPC().equalsIgnoreCase("_err")) {
        throw e;
    }
    try {
        numSpacesRemaining = ByteList.convertToInt(// Starting index
        dg.getData().getBytes(// Starting index
        0, // number of bytes
        4), // True for signed data
        false);
        sizeOfBuffer = ByteList.convertToInt(// Starting index
        dg.getData().getBytes(// Starting index
        4, // number of bytes
        4), // True for signed data
        false);
        // Log.enableSystemPrint(false);
        return numSpacesRemaining;
    } catch (RuntimeException ex) {
        Log.error("Response failed: " + dg);
        ex.printStackTrace();
        throw ex;
    }
}
Also used : BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) LinearInterpolationCommand(com.neuronrobotics.sdk.commands.cartesian.LinearInterpolationCommand)

Aggregations

LinearInterpolationCommand (com.neuronrobotics.sdk.commands.cartesian.LinearInterpolationCommand)1 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1