Ramsete Denetleyicisi

Ramsete Kontrol Cihazı, WPILib’e yerleşik bir yörünge izleyicidir. Bu izleyici, küçük rahatsızlıklar için düzeltme ile yörüngeleri doğru bir şekilde izlemek için kullanılabilir.

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

Ramsete kontrolörü, robot bu hızları takip ettiğinde hedef noktasına doğru bir şekilde ulaşması için “ayarlanmış hızları” geri döndürür. Denetleyici, yeni hedefle periyodik olarak güncellenmelidir. Hedef, istenen bir pose, istenen doğrusal hız ve istenen açısal hızdan oluşur. Ayrıca robotun mevcut konumu da periyodik olarak güncellenmelidir. Kontrolör, ayarlanmış doğrusal ve açısal hızı döndürmek için bu dört argümanı kullanır. Kullanıcılar, optimum yörünge takibini elde etmek için robotlarına bu doğrusal ve açısal hızlara kumanda etmelidir.

Not

The “goal 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.

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 goal as three separate parameters (pose, linear velocity, and angular velocity) whereas the other overload accepts a Trajectory.State object, which contains information about the goal pose. For its ease, users should use the latter method when tracking trajectories.

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

Bu hesaplamalar, güncellenmiş bir robot konumu ve hedefi ile her döngü yinelemesinde gerçekleştirilmelidir.

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, goal);
DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.toWheelSpeeds(adjustedSpeeds);
double left = wheelSpeeds.leftMetersPerSecond;
double right = wheelSpeeds.rightMetersPerSecond;
ChassisSpeeds adjustedSpeeds = controller.Calculate(currentRobotPose, goal);
DifferentialDriveWheelSpeeds wheelSpeeds = kinematics.ToWheelSpeeds(adjustedSpeeds);
auto [left, right] = kinematics.ToWheelSpeeds(adjustedSpeeds);
adjustedSpeeds = controller.calculate(currentRobotPose, goal)
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 Rota Eğitimi.