Search in sources :

Example 1 with PIDConfiguration

use of com.neuronrobotics.sdk.pid.PIDConfiguration in project java-bowler by NeuronRobotics.

the class DrivingTest method setupRealRobot.

private void setupRealRobot(DyIO dyio) {
    DyPIDConfiguration dypid = new // PID group 0
    DyPIDConfiguration(// PID group 0
    0, // Input channel number
    23, // Input mode
    DyIOChannelMode.COUNT_IN_INT, // Output Channel
    11, // Output mode
    DyIOChannelMode.SERVO_OUT);
    PIDConfiguration pid = new // PID group
    PIDConfiguration(// PID group
    0, // enabled
    true, // inverted
    false, // Async
    true, // Kp
    1, // Ki
    1, // Kd
    .5, // Value to latch on index pulse
    0, // Use the latch system
    false, // Stop PID controller on index latch event
    false);
    dyio.ConfigureDynamicPIDChannels(dypid);
    dyio.ConfigurePIDController(pid);
    PIDChannel drive = dyio.getPIDChannel(0);
    ServoChannel srv = new ServoChannel(dyio.getChannel(10));
    AckermanBot a = new AckermanBot(new ServoRotoryLink(srv, new LinkConfiguration(98, 51, 143, 1)), drive);
    ServoChannel sweeper = new ServoChannel(dyio.getChannel(9));
    range = new LaserRangeSensor(new NRSerialPort("/dev/ttyACM0", 115200));
    // range = new LinearRangeSensor(	sweeper,
    // new AnalogInputChannel(dyio.getChannel(12)));
    line = new LineSensor(new AnalogInputChannel(dyio.getChannel(13)), null, new AnalogInputChannel(dyio.getChannel(14)));
    // This flame sensor uses the same servo as the rangefinder
    flame = new LinearRangeSensor(sweeper, new AnalogInputChannel(dyio.getChannel(15)));
    mainRobot = a;
}
Also used : PIDChannel(com.neuronrobotics.sdk.pid.PIDChannel) ServoChannel(com.neuronrobotics.sdk.dyio.peripherals.ServoChannel) LinkConfiguration(com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration) VirtualLineSensor(com.neuronrobotics.addons.driving.virtual.VirtualLineSensor) AnalogInputChannel(com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel) PIDConfiguration(com.neuronrobotics.sdk.pid.PIDConfiguration) DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration) VirtualAckermanBot(com.neuronrobotics.addons.driving.virtual.VirtualAckermanBot) NRSerialPort(gnu.io.NRSerialPort) DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration) ServoRotoryLink(com.neuronrobotics.sdk.addons.kinematics.ServoRotoryLink)

Example 2 with PIDConfiguration

use of com.neuronrobotics.sdk.pid.PIDConfiguration in project java-bowler by NeuronRobotics.

the class RealLineTrack method main.

/**
 * @param args
 */
public static void main(String[] args) {
    final DyIO d = new DyIO();
    ConnectionDialog.getBowlerDevice(d);
    if (d.isAvailable()) {
        new Thread() {

            public void run() {
                DyPIDConfiguration dypid = new // PID group 0
                DyPIDConfiguration(// PID group 0
                0, // Input channel number
                23, // Input mode
                DyIOChannelMode.COUNT_IN_INT, // Output Channel
                11, // Output mode
                DyIOChannelMode.SERVO_OUT);
                PIDConfiguration pid = new // PID group
                PIDConfiguration(// PID group
                0, // enabled
                true, // inverted
                false, // Async
                true, // Kp
                1, // Ki
                1, .5, 0, false, // Kd
                false);
                d.ConfigureDynamicPIDChannels(dypid);
                d.ConfigurePIDController(pid);
                PIDChannel drive = d.getPIDChannel(0);
                ServoChannel srv = new ServoChannel(d.getChannel(10));
                AbstractRobotDrive mainRobot = new AckermanBot(new ServoRotoryLink(srv, new LinkConfiguration(98, 51, 143, 1)), drive);
                AbstractSensor line = new LineSensor(new AnalogInputChannel(d.getChannel(14), true), null, new AnalogInputChannel(d.getChannel(13), true));
            // new LineTrack().runTrack(mainRobot,line);
            }
        }.start();
    } else {
        System.out.println("Failed");
        d.disconnect();
    }
}
Also used : AnalogInputChannel(com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel) PIDConfiguration(com.neuronrobotics.sdk.pid.PIDConfiguration) DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration) DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration) PIDChannel(com.neuronrobotics.sdk.pid.PIDChannel) ServoChannel(com.neuronrobotics.sdk.dyio.peripherals.ServoChannel) LinkConfiguration(com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration) DyIO(com.neuronrobotics.sdk.dyio.DyIO) ServoRotoryLink(com.neuronrobotics.sdk.addons.kinematics.ServoRotoryLink)

Example 3 with PIDConfiguration

use of com.neuronrobotics.sdk.pid.PIDConfiguration in project java-bowler by NeuronRobotics.

the class LegacyPidNamespaceImp method getPIDConfiguration.

@Override
public /* (non-Javadoc)
	 * @see com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace#getPIDConfiguration
	 */
PIDConfiguration getPIDConfiguration(int group) {
    BowlerDatagram conf = getDevice().send(new ConfigurePIDCommand((char) group));
    PIDConfiguration back = new PIDConfiguration(conf);
    return back;
}
Also used : BowlerDatagram(com.neuronrobotics.sdk.common.BowlerDatagram) PIDConfiguration(com.neuronrobotics.sdk.pid.PIDConfiguration) ConfigurePIDCommand(com.neuronrobotics.sdk.commands.bcs.pid.ConfigurePIDCommand)

Example 4 with PIDConfiguration

use of com.neuronrobotics.sdk.pid.PIDConfiguration in project java-bowler by NeuronRobotics.

the class Jfx3dManager method attachArm.

public void attachArm(DyIO master, String xml) {
    for (int i = 0; i < master.getPIDChannelCount(); i++) {
        // disable PID controller, default PID and dypid configurations are
        // disabled.
        master.ConfigureDynamicPIDChannels(new DyPIDConfiguration(i));
        master.ConfigurePIDController(new PIDConfiguration());
    }
    attachArm(new DHParameterKinematics(master, xml));
}
Also used : DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration) PIDConfiguration(com.neuronrobotics.sdk.pid.PIDConfiguration) DHParameterKinematics(com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics) DyPIDConfiguration(com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration)

Example 5 with PIDConfiguration

use of com.neuronrobotics.sdk.pid.PIDConfiguration in project java-bowler by NeuronRobotics.

the class LinkConfiguration method setPidConfiguration.

public void setPidConfiguration(IPidControlNamespace pid) {
    PIDConfiguration conf = pid.getPIDConfiguration(getHardwareIndex());
    if (getType() == LinkType.PID) {
        k[0] = conf.getKP();
        k[1] = conf.getKI();
        k[2] = conf.getKD();
        inverted = conf.isInverted();
        setHomingTicksPerSecond(10000);
    }
    isLatch = conf.isUseLatch();
    indexLatch = (int) conf.getIndexLatch();
    isStopOnLatch = conf.isStopOnIndex();
// if(indexLatch>getUpperLimit() || indexLatch<getLowerLimit() )
// throw new RuntimeException("PID group "+getHardwareIndex()+" Index latch is "+indexLatch+" but needs to be between "+getUpperLimit()+" and "+getLowerLimit());
}
Also used : PIDConfiguration(com.neuronrobotics.sdk.pid.PIDConfiguration)

Aggregations

PIDConfiguration (com.neuronrobotics.sdk.pid.PIDConfiguration)8 DyPIDConfiguration (com.neuronrobotics.sdk.dyio.dypid.DyPIDConfiguration)3 PIDChannel (com.neuronrobotics.sdk.pid.PIDChannel)3 LinkConfiguration (com.neuronrobotics.sdk.addons.kinematics.LinkConfiguration)2 ServoRotoryLink (com.neuronrobotics.sdk.addons.kinematics.ServoRotoryLink)2 InvalidConnectionException (com.neuronrobotics.sdk.common.InvalidConnectionException)2 AnalogInputChannel (com.neuronrobotics.sdk.dyio.peripherals.AnalogInputChannel)2 ServoChannel (com.neuronrobotics.sdk.dyio.peripherals.ServoChannel)2 RuntimeErrorException (javax.management.RuntimeErrorException)2 VirtualAckermanBot (com.neuronrobotics.addons.driving.virtual.VirtualAckermanBot)1 VirtualLineSensor (com.neuronrobotics.addons.driving.virtual.VirtualLineSensor)1 DHParameterKinematics (com.neuronrobotics.sdk.addons.kinematics.DHParameterKinematics)1 ConfigurePIDCommand (com.neuronrobotics.sdk.commands.bcs.pid.ConfigurePIDCommand)1 BowlerDatagram (com.neuronrobotics.sdk.common.BowlerDatagram)1 DyIO (com.neuronrobotics.sdk.dyio.DyIO)1 IPidControlNamespace (com.neuronrobotics.sdk.namespace.bcs.pid.IPidControlNamespace)1 NRSerialPort (gnu.io.NRSerialPort)1