-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for LTV Unicycle Controller #2792
base: main
Are you sure you want to change the base?
Add documentation for LTV Unicycle Controller #2792
Conversation
7921bb9
to
ac12f3e
Compare
RamseteController was deprecated in wpilibsuite/allwpilib#6494 Does 1 part of wpilibsuite#2651 Signed-off-by: Jade Turner <[email protected]>
ac12f3e
to
ce8e711
Compare
7d4f988
to
eb547d3
Compare
eb547d3
to
e7143e7
Compare
|
||
## Constructing the LTV Unicycle Controller Object | ||
|
||
The LTV Unicycle controller should be initialized with four parameters. `qelms` is a vector of the maximum desired error tolerance in the X and Y directions and heading. `relms` is a vector of the desired control effort in linear velocity and angular velocity. `dt` represents the timestep used in calculations (the default loop rate of 20 ms is a reasonable value) and `maxVelocity` should be the max velocity your robot can achieve. See :ref:`The State Space contrl LQR Tuning <docs/software/advanced-controls/state-space/state-space-intro:LQR: tuning>` for more information on the effect of `relms` and `qelms` on the controller. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qelms
and relms
are misspelled. LTVUnicycleController.java spells them qelems
and relems
, like "Q elements" and "R elements".
|
||
The LTV Unicycle controller should be initialized with four parameters. `qelms` is a vector of the maximum desired error tolerance in the X and Y directions and heading. `relms` is a vector of the desired control effort in linear velocity and angular velocity. `dt` represents the timestep used in calculations (the default loop rate of 20 ms is a reasonable value) and `maxVelocity` should be the max velocity your robot can achieve. See :ref:`The State Space contrl LQR Tuning <docs/software/advanced-controls/state-space/state-space-intro:LQR: tuning>` for more information on the effect of `relms` and `qelms` on the controller. | ||
|
||
The code example below initialize the LTV Unicycle Controller with `qelms` of 0.0625 m in X, 0.125 m in Y, and 2 radians in heading; `relms` of 1 m/s of linear velocity, and 2 rad/sec angular velocity; `dt` of 20 ms; and `maxVelocity` of 9 m/s. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code example below initialize the LTV Unicycle Controller with `qelms` of 0.0625 m in X, 0.125 m in Y, and 2 radians in heading; `relms` of 1 m/s of linear velocity, and 2 rad/sec angular velocity; `dt` of 20 ms; and `maxVelocity` of 9 m/s. | |
The code example below initializes the LTV Unicycle Controller with `qelms` of 0.0625 m in X, 0.125 m in Y, and 2 radians in heading; `relms` of 1 m/s of linear velocity, and 2 rad/sec angular velocity; `dt` of 20 ms; and `maxVelocity` of 9 m/s. |
This should probably justify why the heading tolerance is so large so students don't repeatedly ask about it. It's to allow the y controller (crosstrack error controller) to overpower the heading controller so crosstrack error gets driven to zero.
## Getting Adjusted Velocities | ||
The LTV Unicycle 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 goal. The goal 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. | ||
|
||
.. note:: 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't entirely accurate. The trajectory classes define goal to be where the robot should be eventually, and they define reference to be where the robot should be right now.
## Using the Adjusted Velocities | ||
The adjusted velocities are of type ``ChassisSpeeds``, which contains a ``vx`` (linear velocity in the forward direction), a ``vy`` (linear velocity in the sideways direction), and an ``omega`` (angular velocity around the center of the robot frame). | ||
|
||
The returned adjusted speeds can be converted to usable speeds using the kinematics classes for your drivetrain type. For example, the adjusted velocities can be converted to left and right velocities for a differential drive using a ``DifferentialDriveKinematics`` object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mention earlier in the article that this controller only applies to nonholonomic drivetrains like differential drive. Holonomic drivetrains can use strictly better controllers like separate decoupled PD controllers, because they don't have to deal with nonholonomic limitations like not being able to move sideways. Using a nonholonomic controller on a holonomic drivetrain unnecessarily makes the feedback response worse.
Co-authored-by: Tyler Veness <[email protected]>
The LTV Unicycle Controller ([C++](https://github.wpilib.org/allwpilib/docs/release/cpp/classfrc_1_1_l_t_v_unicycle_controller.html), [Java](https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/math/controller/LTVUnicycleController.html), :external:py:class:`Python <wpimath.controller.LTVUnicycleController>`) is a trajectory tracker that is built in to WPILib. This tracker can be used to accurately track trajectories with correction for minor disturbances. | ||
|
||
## Constructing the LTV Unicycle Controller Object | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Control is misspelled in State Space contrl LQR tuning
RamseteController was deprecated in wpilibsuite/allwpilib#6494
Does 1 part of #2651