mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Adds JNI Simulator interface and updated Sim API (#1002)
The simulator was generated by https://github.com/ThadHouse/SimulatorGenerator
This commit is contained in:
committed by
Peter Johnson
parent
1046371349
commit
337e89cf6e
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user