3.2.x -> 4.0.0
These are the changes since 3.2.2, the latest stable release. 4.0.0 hasn't been released yet, so this page can change before it is.
EZ-Template 4.0.0 needs PROS kernel 4.2.2 or newer. If your project is on an older kernel, pros c apply refuses to install it and says EZ-Template does not support kernel version followed by yours. Upgrade the kernel first by following Upgrading.
Movement functions that take units look the same, chassis.pid_drive_set(24_in, 110) still works. The first section is changes that stop code from compiling, so you'll only hit them if your project does the thing described. The second section is changes that don't stop anything from compiling, but can change how your robot moves.
Changes that stop your code from compiling
Auton mirroring was removed
odom_x_flip(), odom_y_flip(), odom_theta_flip(), odom_x_direction_get(), odom_y_direction_get() and odom_theta_direction_get() are gone, and so is the Mirroring Autons tutorial. Mirroring needed a robot that was mechanically symmetric with a perfectly centered tracking center, which is rare.
There's no replacement. Delete the calls. If you used mirroring to run one auton on both alliances, write the second alliance's coordinates and headings yourself.
The IMU scaler takes a different number
drive_imu_scaler_set() and drive_imu_scaler_get() were renamed to drive_imu_scaler_3600_set() and drive_imu_scaler_3600_get(). If you have more than one imu, drive_imus_scalers_set() and drive_imus_scalers_get() were renamed to drive_imus_scalers_3600_set() and drive_imus_scalers_3600_get().
In 3.2.x the setter took a multiplier like 1.007. Now it takes what the imu reads after you physically turn the robot 3600 degrees, so a call left over from 3.2.x won't compile. Remove it and calibrate again by following Tuning IMU Scale.
If you'd rather not recalibrate, the number to pass is 3600 / multiplier.
EZ-Units replaces OkapiLib
EZ-Template used three things from OkapiLib, the QAngle, QLength and QTime types and their _deg, _in and _ms literals. It now ships EZ-Units for those instead, as ez::QAngle, ez::QLength and ez::QTime, and doesn't ship OkapiLib anymore. If your own code uses OkapiLib, you'll need to keep it installed in your project.
24_in, 90_deg and 100_ms keep working with nothing to change. What happens with a leftover using namespace okapi::literals; in your main.h depends on the rest of your project:
| Your project | What happens | Fix |
|---|---|---|
| OkapiLib is installed and nothing else includes its unit headers | Compiles | Optional, delete the line |
It also has #include "okapi/api.hpp" | Error, operator""_ms(...) is ambiguous | Delete the line |
| OkapiLib is not installed | Error, 'okapi' has not been declared | Delete the line |
Your code declares okapi::QLength and friends itself | Error, no viable conversion from 'QLength' to 'okapi::QLength' | Use ez::QLength |
If you have code inside namespace ez that calls abs, sin, cos, sqrt, pow, round, floor, ceil, hypot, atan2 or copysign without a prefix, change them to std::abs and so on. EZ-Units has functions with those names in ez that hide the global ones.
EZ-Template ships its own copy of EZ-Units at include/EZ-Units/units.hpp, so you don't need to install it separately. If your project also has the standalone EZ-Units template, both install that same file. The second one you apply asks Overwrite the existing files? [y/N], and uninstalling either one removes the file, so run pros c apply EZ-Template@x.x.x --force-apply afterwards to put it back.
using namespace ez; and using namespace std; are no longer applied for you
In 3.2.x, including EZ-Template/api.hpp did using namespace ez; and using namespace std; for you. It doesn't anymore, so code that leaned on it needs the prefix:
ez::Drive chassis(...); // was Drive chassis(...);
std::vector<int> ports = {1, 2}; // was vector<int> ports = {1, 2};
std::string name = "auton"; // was string name = "auton";
You can also put using namespace ez; or using namespace std; at the top of your own source files.
Most projects already write ez::Drive chassis(...) because that's what the docs show, and only need to fix bare std names.
Changes to how your robot moves
These compile without changes, so your autons will run and may behave differently. Check them on your robot.
Slew ramps at the same rate at any speed
distance in the slew constants used to mean "distance to ramp up to this movement's max speed". It now means "distance to ramp up to full speed (127)", and a movement with a lower max speed stops ramping when it reaches that speed.
A movement below full speed used to ramp slower than a full speed one over the same distance, and now they ramp at the same rate. If you tuned slew on movements with a low max speed, they'll ramp faster than before. Retune them by following Tuning Slew Constants.
Big exit time works
In 3.2.x the big exit condition never ran when the small exit condition was set, which is nearly always, so big_exit_time did nothing. It works now, so a move that sits outside small_error but inside big_error for big_exit_time will exit.
If you tuned your autons while it was doing nothing, some moves will exit earlier than they used to. See Tuning Exit Condition Constants.
The velocity exit timer waits for the robot to move
The velocity exit timer used to start counting whenever the velocity was 0, including before the robot had moved at all. It now starts once the robot has moved, or after 1 second if it never moves.
The drive stops when a competition mode ends
With a competition switch or field control connected, EZ-Template sets the drive mode to ez::DISABLE while the robot is disabled, and once when autonomous ends. A motion that field control cut off no longer picks back up when driver control starts. See General Autonomous.
The joystick curve is limited to 0 to 20
Holding a curve button used to raise the scale with no limit, and a value read from the SD card was used as it was. The scale is now kept between 0 and 20 everywhere it's set: the curve buttons, opcontrol_curve_default_set() and the SD card. A value outside of that range is changed to the nearest end. A curve above 20 that you tuned in 3.2.x will now drive like 20. See Joystick Curve.