Added support for Falcons, and the ability to disable the CANCoders

This commit is contained in:
thenetworkgrinch
2023-02-16 21:21:26 -06:00
parent e8f6ca3659
commit c747645bcc
118 changed files with 2706 additions and 370 deletions

View File

@@ -0,0 +1,41 @@
package swervelib.simulation.ctre;
import static swervelib.simulation.ctre.PhysicsSim.random;
import com.ctre.phoenix.motorcontrol.can.VictorSPX;
import swervelib.simulation.ctre.PhysicsSim.SimProfile;
/**
* Holds information about a simulated VictorSPX.
*/
class VictorSPXSimProfile extends SimProfile
{
public final VictorSPX _victor;
/**
* Creates a new simulation profile for a VictorSPX device.
*
* @param victor The VictorSPX device
*/
public VictorSPXSimProfile(final VictorSPX victor)
{
this._victor = victor;
}
/**
* Runs the simulation profile.
* <p>
* This uses very rudimentary physics simulation and exists to allow users to test features of our products in
* simulation using our examples out of the box. Users may modify this to utilize more accurate physics simulation.
*/
public void run()
{
// final double period = getPeriod();
// Device voltage simulation
double outPerc = _victor.getSimCollection().getMotorOutputLeadVoltage() / 12;
_victor.getSimCollection().setBusVoltage(12 - outPerc * outPerc * 3 / 4 * random(0.95, 1.05));
}
}