Search in sources :

Example 1 with PowerCommand

use of com.neuronrobotics.sdk.commands.neuronrobotics.dyio.PowerCommand in project java-bowler by NeuronRobotics.

the class DyIO method getBatteryVoltage.

/**
 * THis method will return the current voltage on the battery connected to the DyIO external power connector.
 * @param refresh true if you want to query the device, false to just get the cached value from the last async.
 * @return the voltage of the battery in Volts
 */
public double getBatteryVoltage(boolean refresh) {
    if (refresh) {
        BowlerDatagram data = send(new PowerCommand());
        powerEvent(data);
    }
    return batteryVoltage;
}
Also used : PowerCommand(com.neuronrobotics.sdk.commands.neuronrobotics.dyio.PowerCommand) BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram)

Example 2 with PowerCommand

use of com.neuronrobotics.sdk.commands.neuronrobotics.dyio.PowerCommand in project java-bowler by NeuronRobotics.

the class DyIO method connect.

public boolean connect() {
    if (getConnection() != null) {
        getConnection().addConnectionEventListener(this);
        getConnection().setSynchronusPacketTimeoutTime(3000);
    }
    if (super.connect()) {
        getPid().setConnection(getConnection());
        getPid().setAddress(getAddress());
        getPid().connect();
        send(new PowerCommand());
        startHeartBeat(3000);
        resync();
        return true;
    }
    return false;
}
Also used : PowerCommand(com.neuronrobotics.sdk.commands.neuronrobotics.dyio.PowerCommand)

Aggregations

PowerCommand (com.neuronrobotics.sdk.commands.neuronrobotics.dyio.PowerCommand)2 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1