Ramsete Denetleyicisi

Uyarı

Ramsete Controller has been deprecated. Use LTV Unicycle Controller which has more intuitive tuning.

The Ramsete Controller is a trajectory tracker that is built in to WPILib. This tracker can be used to accurately track trajectories with correction for minor disturbances for differential drivetrains.

Ramsete Denetleyici Nesnesinin-Object Oluşturulması

Ramsete kontrolörü, b ve zeta olmak üzere iki kazançla başlatılmalıdır. Daha büyük b değerleri yakınsamayı orantılı bir terim gibi daha agresif hale getirirken, daha büyük zeta değerleri yanıtta daha fazla sönümleme sağlar. Bu kontrolör kazançları, sadece kontrolörün ayarlanan hızları nasıl çıkaracağını belirler. Robotun gerçek hız takibini ETKİLEMEZ. Bu, bu denetleyici kazançlarının genellikle robottan bağımsız olduğu anlamına gelir.

Not

B ve zeta için 2.0 ve 0.7 kazançları, tüm birimler metre cinsinden olduğunda istenen sonuçları üretmek için tekrar tekrar test edilmiştir. Bu nedenle, RamseteController için sıfır bağımsız değişkenli bir kurucu, bu değerlere varsayılan kazançlarla birlikte mevcuttur.

// Using the default constructor of RamseteController. Here
// the gains are initialized to 2.0 and 0.7.
RamseteController controller1 = new RamseteController();
// Using the secondary constructor of RamseteController where
// the user can choose any other gains.
RamseteController controller2 = new RamseteController(2.1, 0.8);
// Using the default constructor of RamseteController. Here
// the gains are initialized to 2.0 and 0.7.
frc::RamseteController controller1;
// Using the secondary constructor of RamseteController where
// the user can choose any other gains.
frc::RamseteController controller2{2.1, 0.8};
from wpimath.controller import RamseteController
# Using the default constructor of RamseteController. Here
# the gains are initialized to 2.0 and 0.7.
controller1 = RamseteController()
# Using the secondary constructor of RamseteController where
# the user can choose any other gains.
controller2 = RamseteController(2.1, 0.8)

Ayarlanmış Hızları Alma

The Ramsete controller returns “adjusted velocities” so that the when the robot tracks these velocities, it accurately reaches the goal point. The controller should be updated periodically with the new reference, which is where it should be at the current time. The reference comprises of a desired pose, desired linear velocity, and desired angular velocity. Furthermore, the current position of the robot should also be updated periodically. The controller uses these four arguments to return the adjusted linear and angular velocity. Users should command their robot to these linear and angular velocities to achieve optimal trajectory tracking.

Not

The “reference pose” represents the position that the robot should be at a particular timestep when tracking the trajectory. It does NOT represent the final endpoint of the trajectory, which is the goal.

The controller can be updated using the Calculate (C++) / calculate (Java/Python) method. There are two overloads for this method. Both of these overloads accept the current robot position as the first parameter. For the other parameters, one of these overloads takes in the reference as three separate parameters (pose, linear velocity, and angular velocity) whereas the other overload accepts a Trajectory.State object, which contains information about the reference pose. For its ease, users should use the latter method when tracking trajectories.

Trajectory.State reference = trajectory.sample(3.4); // sample the trajectory at 3.4 seconds from the beginning
ChassisSpeeds adjustedSpeeds = controller.calculate(currentRobotPose, reference);
const Trajectory::State reference = trajectory.Sample(3.4_s); // sample the trajectory at 3.4 seconds from the beginning
ChassisSpeeds adjustedSpeeds = controller.Calculate(currentRobotPose, reference);
reference = trajectory.sample(3.4)  # sample the trajectory at 3.4 seconds from the beginning
adjustedSpeeds = controller.calculate(currentRobotPose, reference)

These calculations should be performed at every loop iteration, with an updated robot position and reference.

Ayarlanmış Hızları Kullanma

Ayarlanan hızlar, bir vx (ileri yönde doğrusal hız), bir vy (yan yönde doğrusal hız) ve bir omega (robot çerçevesinin merkezi etrafındaki açısal hız) içeren ChassisSpeeds tipindedir . Ramsete denetleyicisi, holonomik olmayan robotlar (yanlara doğru hareket edemeyen robotlar) için bir denetleyici olduğundan, ayarlanmış hız nesnesinin sıfır vy değeri vardır.

Döndürülen ayarlanmış hızlar, aktarma sistemi tipiniz için kinematik sınıfları kullanılarak kullanılabilir hızlara dönüştürülebilir. Örneğin, ayarlanmış hızlar, bir DifferentialDriveKinematics nesnesi kullanılarak bir diferansiyel sürücü için sol ve sağ hızlara dönüştürülebilir.

ChassisSpeeds adjustedSpeeds = controller.calculate(currentRobotPose, reference);
DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.toWheelSpeeds(adjustedSpeeds);
double left = wheelSpeeds.leftMetersPerSecond;
double right = wheelSpeeds.rightMetersPerSecond;
ChassisSpeeds adjustedSpeeds = controller.Calculate(currentRobotPose, reference);
DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.ToWheelSpeeds(adjustedSpeeds);
auto [left, right] = kinematics.ToWheelSpeeds(adjustedSpeeds);
adjustedSpeeds = controller.calculate(currentRobotPose, reference)
wheelSpeeds = kinematics.toWheelSpeeds(adjustedSpeeds)
left = wheelSpeeds.left
right = wheelSpeeds.right

Because these new left and right velocities are still speeds and not voltages, two PID Controllers, one for each side may be used to track these velocities. Either the WPILib PIDController (C++, Java, Python) can be used, or the Velocity PID feature on smart motor controllers such as the TalonSRX and the SPARK MAX can be used.

Komut Tabanlı Çerçevede - Command-Based Framework Ramsete

For the sake of ease for users, a RamseteCommand class is built in to WPILib. For a full tutorial on implementing a path-following autonomous using RamseteCommand, see Yörünge Rehberi.