Adds JNI Simulator interface and updated Sim API (#1002)

The simulator was generated by https://github.com/ThadHouse/SimulatorGenerator
This commit is contained in:
Thad House
2018-05-11 12:38:23 -07:00
committed by Peter Johnson
parent 1046371349
commit 337e89cf6e
96 changed files with 8204 additions and 26 deletions

View File

@@ -9,6 +9,7 @@ package edu.wpi.first.wpilibj;
import edu.wpi.first.wpilibj.hal.AnalogJNI;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.sim.AnalogInSim;
import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.util.AllocationException;
@@ -350,4 +351,8 @@ public class AnalogInput extends SensorBase implements PIDSource, Sendable {
builder.setSmartDashboardType("Analog Input");
builder.addDoubleProperty("Value", this::getAverageVoltage, null);
}
public AnalogInSim getSimObject() {
return new AnalogInSim(m_channel);
}
}

View File

@@ -9,6 +9,7 @@ package edu.wpi.first.wpilibj;
import edu.wpi.first.wpilibj.hal.AnalogJNI;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.sim.AnalogOutSim;
import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
@@ -66,4 +67,8 @@ public class AnalogOutput extends SendableBase implements Sendable {
builder.setSmartDashboardType("Analog Output");
builder.addDoubleProperty("Value", this::getVoltage, this::setVoltage);
}
public AnalogOutSim getSimObject() {
return new AnalogOutSim(m_channel);
}
}

View File

@@ -11,6 +11,7 @@ import edu.wpi.first.wpilibj.hal.AccelerometerJNI;
import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
import edu.wpi.first.wpilibj.hal.HAL;
import edu.wpi.first.wpilibj.interfaces.Accelerometer;
import edu.wpi.first.wpilibj.sim.AccelerometerSim;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
/**
@@ -97,4 +98,8 @@ public class BuiltInAccelerometer extends SensorBase implements Accelerometer, S
builder.addDoubleProperty("Y", this::getY, null);
builder.addDoubleProperty("Z", this::getZ, null);
}
public AccelerometerSim getSimObject() {
return new AccelerometerSim();
}
}