LinearSystemId

class wpimath.system.plant.LinearSystemId

Bases: pybind11_object

static DCMotorSystem(motor: wpimath._controls._controls.plant.DCMotor, J: kilogram_square_meters, G: float) wpimath._controls._controls.system.LinearSystem_2_1_2

Create a state-space model of a DC motor system. The states of the system are [angular position, angular velocity], inputs are [voltage], and outputs are [angular position, angular velocity].

Parameters:
  • motor – The motor (or gearbox) attached to the system.

  • J – the moment of inertia J of the DC motor.

  • G – Gear ratio from motor to output. @throws std::domain_error if J <= 0 or G <= 0.

static drivetrainVelocitySystem(motor: wpimath._controls._controls.plant.DCMotor, mass: kilograms, r: meters, rb: meters, J: kilogram_square_meters, G: float) wpimath._controls._controls.system.LinearSystem_2_2_2

Create a state-space model of differential drive drivetrain. In this model, the states are [left velocity, right velocity], the inputs are [left voltage, right voltage], and the outputs are [left velocity, right velocity]

Parameters:
  • motor – The motor (or gearbox) driving the drivetrain.

  • mass – The mass of the robot in kilograms.

  • r – The radius of the wheels in meters.

  • rb – The radius of the base (half of the track width), in meters.

  • J – The moment of inertia of the robot.

  • G – Gear ratio from motor to wheel. @throws std::domain_error if mass <= 0, r <= 0, rb <= 0, J <= 0, or G <= 0.

static elevatorSystem(motor: wpimath._controls._controls.plant.DCMotor, mass: kilograms, radius: meters, G: float) wpimath._controls._controls.system.LinearSystem_2_1_1

Create a state-space model of the elevator system. The states of the system are [position, velocity], inputs are [voltage], and outputs are [position].

Parameters:
  • motor – The motor (or gearbox) attached to the carriage.

  • mass – The mass of the elevator carriage, in kilograms.

  • radius – The radius of the elevator’s driving drum, in meters.

  • G – Gear ratio from motor to carriage. @throws std::domain_error if mass <= 0, radius <= 0, or G <= 0.

static flywheelSystem(motor: wpimath._controls._controls.plant.DCMotor, J: kilogram_square_meters, G: float) wpimath._controls._controls.system.LinearSystem_1_1_1

Create a state-space model of a flywheel system, the states of the system are [angular velocity], inputs are [voltage], and outputs are [angular velocity].

Parameters:
  • motor – The motor (or gearbox) attached to the flywheel.

  • J – The moment of inertia J of the flywheel.

  • G – Gear ratio from motor to flywheel. @throws std::domain_error if J <= 0 or G <= 0.

static identifyDrivetrainSystem(*args, **kwargs)

Overloaded function.

  1. identifyDrivetrainSystem(kVLinear: volt_seconds_per_meter, kALinear: volt_seconds_squared_per_meter, kVAngular: volt_seconds_per_meter, kAAngular: volt_seconds_squared_per_meter) -> wpimath._controls._controls.system.LinearSystem_2_2_2

Identify a differential drive drivetrain given the drivetrain’s kV and kA in both linear {(volts/(meter/sec), (volts/(meter/sec²))} and angular {(volts/(radian/sec), (volts/(radian/sec²))} cases. These constants can be found using SysId.

States: [[left velocity], [right velocity]] Inputs: [[left voltage], [right voltage]] Outputs: [[left velocity], [right velocity]]

Parameters:
  • kVLinear – The linear velocity gain in volts per (meters per second).

  • kALinear – The linear acceleration gain in volts per (meters per second squared).

  • kVAngular – The angular velocity gain in volts per (meters per second).

  • kAAngular – The angular acceleration gain in volts per (meters per second squared). @throws domain_error if kVLinear <= 0, kALinear <= 0, kVAngular <= 0, or kAAngular <= 0.

  1. identifyDrivetrainSystem(kVLinear: volt_seconds_per_meter, kALinear: volt_seconds_squared_per_meter, kVAngular: volt_seconds_per_radian, kAAngular: volt_seconds_squared_per_radian, trackwidth: meters) -> wpimath._controls._controls.system.LinearSystem_2_2_2

Identify a differential drive drivetrain given the drivetrain’s kV and kA in both linear {(volts/(meter/sec)), (volts/(meter/sec²))} and angular {(volts/(radian/sec)), (volts/(radian/sec²))} cases. This can be found using SysId.

States: [[left velocity], [right velocity]] Inputs: [[left voltage], [right voltage]] Outputs: [[left velocity], [right velocity]]

Parameters:
  • kVLinear – The linear velocity gain in volts per (meters per second).

  • kALinear – The linear acceleration gain in volts per (meters per second squared).

  • kVAngular – The angular velocity gain in volts per (radians per second).

  • kAAngular – The angular acceleration gain in volts per (radians per second squared).

  • trackwidth – The distance between the differential drive’s left and right wheels, in meters. @throws domain_error if kVLinear <= 0, kALinear <= 0, kVAngular <= 0, kAAngular <= 0, or trackwidth <= 0.

static identifyPositionSystemMeters(kV: volt_seconds_per_meter, kA: volt_seconds_squared_per_meter) wpimath._controls._controls.system.LinearSystem_2_1_1

Create a state-space model for a 1 DOF position system from its kV (volts/(unit/sec)) and kA (volts/(unit/sec²)). These constants can be found using SysId. the states of the system are [position, velocity], inputs are [voltage], and outputs are [position].

You MUST use an SI unit (i.e. meters or radians) for the Distance template argument. You may still use non-SI units (such as feet or inches) for the actual method arguments; they will automatically be converted to SI internally.

The parameters provided by the user are from this feedforward model:

u = K_v v + K_a a

@throws std::domain_error if kV <= 0 or kA <= 0.

Parameters:
  • kV – The velocity gain, in volts/(unit/sec).

  • kA – The acceleration gain, in volts/(unit/sec²).

static identifyPositionSystemRadians(kV: volt_seconds_per_radian, kA: volt_seconds_squared_per_radian) wpimath._controls._controls.system.LinearSystem_2_1_1
static identifyVelocitySystemMeters(kV: volt_seconds_per_meter, kA: volt_seconds_squared_per_meter) wpimath._controls._controls.system.LinearSystem_1_1_1

Create a state-space model for a 1 DOF velocity system from its kV (volts/(unit/sec)) and kA (volts/(unit/sec²)). These constants can be found using SysId. The states of the system are [velocity], inputs are [voltage], and outputs are [velocity].

You MUST use an SI unit (i.e. meters or radians) for the Distance template argument. You may still use non-SI units (such as feet or inches) for the actual method arguments; they will automatically be converted to SI internally.

The parameters provided by the user are from this feedforward model:

u = K_v v + K_a a

Parameters:
  • kV – The velocity gain, in volts/(unit/sec).

  • kA – The acceleration gain, in volts/(unit/sec²). @throws std::domain_error if kV <= 0 or kA <= 0.

static identifyVelocitySystemRadians(kV: volt_seconds_per_radian, kA: volt_seconds_squared_per_radian) wpimath._controls._controls.system.LinearSystem_1_1_1
static singleJointedArmSystem(motor: wpimath._controls._controls.plant.DCMotor, J: kilogram_square_meters, G: float) wpimath._controls._controls.system.LinearSystem_2_1_1

Create a state-space model of a single-jointed arm system.The states of the system are [angle, angular velocity], inputs are [voltage], and outputs are [angle].

Parameters:
  • motor – The motor (or gearbox) attached to the arm.

  • J – The moment of inertia J of the arm.

  • G – Gear ratio from motor to arm. @throws std::domain_error if J <= 0 or G <= 0.