diff --git a/EZ-Template-Example-Project/.gitignore b/EZ-Template-Example-Project/.gitignore new file mode 100644 index 00000000..e303e2c0 --- /dev/null +++ b/EZ-Template-Example-Project/.gitignore @@ -0,0 +1,17 @@ +# Compiled Object files +*.o +*.obj + +# Executables +*.bin +*.elf + +# PROS +bin/ +.vscode/ +.cache/ +compile_commands.json +temp.log +temp.errors +*.ini +.d/ \ No newline at end of file diff --git a/EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.0.zip b/EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.1.zip similarity index 79% rename from EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.0.zip rename to EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.1.zip index 4b3b258c..327ffed0 100644 Binary files a/EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.0.zip and b/EZ-Template-Example-Project/EZ-Template-Example-Project-v3.0.1.zip differ diff --git a/EZ-Template-Example-Project/EZ-Template@3.0.0.zip b/EZ-Template-Example-Project/EZ-Template@3.0.1.zip similarity index 54% rename from EZ-Template-Example-Project/EZ-Template@3.0.0.zip rename to EZ-Template-Example-Project/EZ-Template@3.0.1.zip index 18de689c..31e8046b 100644 Binary files a/EZ-Template-Example-Project/EZ-Template@3.0.0.zip and b/EZ-Template-Example-Project/EZ-Template@3.0.1.zip differ diff --git a/EZ-Template-Example-Project/firmware/EZ-Template.a b/EZ-Template-Example-Project/firmware/EZ-Template.a index 3633ac8c..16e2bf4a 100644 Binary files a/EZ-Template-Example-Project/firmware/EZ-Template.a and b/EZ-Template-Example-Project/firmware/EZ-Template.a differ diff --git a/EZ-Template-Example-Project/firmware/libpros.a b/EZ-Template-Example-Project/firmware/libpros.a index 05399901..3dbfc1b7 100644 Binary files a/EZ-Template-Example-Project/firmware/libpros.a and b/EZ-Template-Example-Project/firmware/libpros.a differ diff --git a/EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp b/EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp index 6b122d3c..0fddb2eb 100644 --- a/EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp +++ b/EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp @@ -722,7 +722,7 @@ class Drive { * \param toggle_heading * toggle for heading correction */ - void pid_drive_set(double target, int speed, bool slew_on, bool toggle_heading = true); + void pid_drive_set(double target, int speed, bool slew_on = false, bool toggle_heading = true); /** * Sets the robot to turn using PID. @@ -782,7 +782,7 @@ class Drive { * \param speed * 0 to 127, max speed during motion * \param opposite_speed - * 0 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. + * -127 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. */ void pid_swing_set(e_swing type, double target, int speed, int opposite_speed = 0, bool slew_on = false); @@ -796,7 +796,7 @@ class Drive { * \param speed * 0 to 127, max speed during motion * \param opposite_speed - * 0 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. + * -127 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. */ void pid_swing_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed = 0, bool slew_on = false); @@ -810,7 +810,7 @@ class Drive { * \param speed * 0 to 127, max speed during motion * \param opposite_speed - * 0 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. + * -127 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. */ void pid_swing_relative_set(e_swing type, okapi::QAngle p_target, int speed, int opposite_speed = 0, bool slew_on = false); @@ -824,7 +824,7 @@ class Drive { * \param speed * 0 to 127, max speed during motion * \param opposite_speed - * 0 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. + * -127 to 127, max speed of the opposite side of the drive during the swing. This is used for arcs, and is defaulted to 0. */ void pid_swing_relative_set(e_swing type, double target, int speed, int opposite_speed = 0, bool slew_on = false); @@ -1305,14 +1305,13 @@ class Drive { bool slew_swing_using_angle = false; bool pid_tuner_terminal_b = false; bool pid_tuner_lcd_b = true; - struct const_and_name { std::string name = ""; PID::Constants *consts; }; std::vector constants; void pid_tuner_print(); - void pid_tuner_value_modify(double p, double i, double d, double start); + void pid_tuner_value_modify(float p, float i, float d, float start); void pid_tuner_value_increase(); void pid_tuner_value_decrease(); void pid_tuner_print_brain(); @@ -1320,16 +1319,12 @@ class Drive { void pid_tuner_brain_init(); int column = 0; int row = 0; - int column_max = 0; - const int row_max = 3; - std::string name, kp, ki, kd, starti; std::string arrow = " <--\n"; - std::string newline = "\n"; - bool last_controller_curve_state; - bool last_auton_selector_state; + bool last_controller_curve_state = false; + bool last_auton_selector_state = false; bool pid_tuner_on = false; - std::string complete_pid_tuner_output; - double p_increment = 0.1, i_increment = 0.001, d_increment = 0.25, start_i_increment = 1.0; + std::string complete_pid_tuner_output = ""; + float p_increment = 0.1, i_increment = 0.001, d_increment = 0.25, start_i_increment = 1.0; /** * Private wait until for drive diff --git a/EZ-Template-Example-Project/include/api.h b/EZ-Template-Example-Project/include/api.h index 7e923199..6b09de1d 100644 --- a/EZ-Template-Example-Project/include/api.h +++ b/EZ-Template-Example-Project/include/api.h @@ -41,8 +41,8 @@ #define PROS_VERSION_MAJOR 3 #define PROS_VERSION_MINOR 8 -#define PROS_VERSION_PATCH 0 -#define PROS_VERSION_STRING "3.8.0" +#define PROS_VERSION_PATCH 3 +#define PROS_VERSION_STRING "3.8.3" #include "pros/adi.h" #include "pros/colors.h" @@ -56,8 +56,8 @@ #include "pros/misc.h" #include "pros/motors.h" #include "pros/optical.h" -#include "pros/rtos.h" #include "pros/rotation.h" +#include "pros/rtos.h" #include "pros/screen.h" #include "pros/vision.h" @@ -66,6 +66,7 @@ #include "pros/distance.hpp" #include "pros/gps.hpp" #include "pros/imu.hpp" +#include "pros/link.hpp" #include "pros/llemu.hpp" #include "pros/misc.hpp" #include "pros/motors.hpp" @@ -74,7 +75,6 @@ #include "pros/rtos.hpp" #include "pros/screen.hpp" #include "pros/vision.hpp" -#include "pros/link.hpp" #endif #endif // _PROS_API_H_ diff --git a/EZ-Template-Example-Project/include/pros/gps.h b/EZ-Template-Example-Project/include/pros/gps.h index 1b2e7e7b..917f6938 100644 --- a/EZ-Template-Example-Project/include/pros/gps.h +++ b/EZ-Template-Example-Project/include/pros/gps.h @@ -188,6 +188,91 @@ double gps_get_error(uint8_t port); */ gps_status_s_t gps_get_status(uint8_t port); +/** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_x_position(uint8_t port); + +/** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_y_position(uint8_t port); + +/** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The pitch in (-90,90] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_pitch(uint8_t port); + +/** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The roll in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_roll(uint8_t port); + +/** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The yaw in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_yaw(uint8_t port); + /** * Get the heading in [0,360) degree values. * diff --git a/EZ-Template-Example-Project/include/pros/gps.hpp b/EZ-Template-Example-Project/include/pros/gps.hpp index fce40c2a..7a321239 100644 --- a/EZ-Template-Example-Project/include/pros/gps.hpp +++ b/EZ-Template-Example-Project/include/pros/gps.hpp @@ -52,8 +52,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -77,8 +77,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -95,8 +95,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Pointer to cartesian 4-Quadrant X offset from center of turning (meters) @@ -113,8 +113,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xInitial * Initial 4-Quadrant X Position, with (0,0) being at the center of the field (meters) @@ -133,8 +133,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param rate * Data rate in milliseconds (Minimum: 5 ms) @@ -149,8 +149,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return Possible RMS (Root Mean Squared) error in meters for GPS position. * If the operation failed, returns PROS_ERR_F and errno is set. @@ -163,8 +163,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return A struct (gps_status_s_t) containing values mentioned above. @@ -173,14 +173,89 @@ class Gps { */ virtual pros::c::gps_status_s_t get_status() const; + /** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_x_position() const; + + /** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_y_position() const; + + /** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The pitch in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_pitch() const; + + /** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The roll in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_roll() const; + + /** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The yaw in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_yaw() const; + /** * Get the heading in [0,360) degree values. * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return The heading in [0,360) degree values. If the operation failed, @@ -194,8 +269,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The heading in [DOUBLE_MIN, DOUBLE_MAX] values. If the operation * fails, returns PROS_ERR_F and errno is set. @@ -208,8 +283,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The elased heading in degrees. If the operation fails, returns * PROS_ERR_F and errno is set. @@ -222,8 +297,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param target * Target rotation value to set rotation value to @@ -238,8 +313,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -252,8 +327,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The raw gyroscope values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. @@ -266,8 +341,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating. * * \param port * The V5 GPS's port number from 1-21 diff --git a/EZ-Template-Example-Project/include/pros/imu.h b/EZ-Template-Example-Project/include/pros/imu.h index f5a1cdc3..d87508c4 100644 --- a/EZ-Template-Example-Project/include/pros/imu.h +++ b/EZ-Template-Example-Project/include/pros/imu.h @@ -29,11 +29,20 @@ namespace c { #endif typedef enum imu_status_e { - E_IMU_STATUS_CALIBRATING = 0x01, - E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is - // necessarily in an error state + E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating + E_IMU_STATUS_CALIBRATING = 1, // IMU is calibrating + E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is + // necessarily in an error state } imu_status_e_t; +typedef enum imu_orientation_e { + E_IMU_Z_UP = 0, // IMU has the Z axis UP (VEX Logo facing DOWN) + E_IMU_Z_DOWN = 1, // IMU has the Z axis DOWN (VEX Logo facing UP) + E_IMU_X_UP = 2, // IMU has the X axis UP + E_IMU_X_DOWN = 3, // IMU has the X axis DOWN + E_IMU_Y_UP = 4, // IMU has the Y axis UP + E_IMU_Y_DOWN = 5, // IMU has the Y axis DOWN +} imu_orientation_e_t; typedef struct __attribute__((__packed__)) quaternion_s { double x; double y; @@ -91,10 +100,10 @@ int32_t imu_reset(uint8_t port); /** * Calibrate IMU and Blocks while Calibrating * - * Calibration takes approximately 2 seconds and blocks during this period, + * Calibration takes approximately 2 seconds and blocks during this period, * with a timeout for this operation being set a 3 seconds as a safety margin. - * Like the other reset function, this function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Like the other reset function, this function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. * * This function uses the following values of errno when an error state is @@ -296,7 +305,6 @@ imu_accel_s_t imu_get_accel(uint8_t port); * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -309,7 +317,7 @@ imu_status_e_t imu_get_status(uint8_t port); // void imu_set_mode(uint8_t port, uint32_t mode); // uint32_t imu_get_mode(uint8_t port); -//Value reset functions: +// Value reset functions: /** * Resets the current reading of the Inertial Sensor's heading to zero * @@ -422,7 +430,7 @@ int32_t imu_tare_euler(uint8_t port); */ int32_t imu_tare(uint8_t port); -//Value set functions: +// Value set functions: /** * Sets the current reading of the Inertial Sensor's euler values to * target euler values. Will default to +/- 180 if target exceeds +/- 180. @@ -463,7 +471,7 @@ int32_t imu_set_rotation(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -482,7 +490,7 @@ int32_t imu_set_heading(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's pitch to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -501,7 +509,7 @@ int32_t imu_set_pitch(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -520,7 +528,7 @@ int32_t imu_set_roll(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -536,6 +544,21 @@ int32_t imu_set_roll(uint8_t port, double target); */ int32_t imu_set_yaw(uint8_t port, double target); +/** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ +imu_orientation_e_t imu_get_physical_orientation(uint8_t port); + #ifdef __cplusplus } } diff --git a/EZ-Template-Example-Project/include/pros/imu.hpp b/EZ-Template-Example-Project/include/pros/imu.hpp index 99b28c8d..3f6f3933 100644 --- a/EZ-Template-Example-Project/include/pros/imu.hpp +++ b/EZ-Template-Example-Project/include/pros/imu.hpp @@ -19,6 +19,7 @@ #define _PROS_IMU_HPP_ #include + #include "pros/imu.h" namespace pros { @@ -31,47 +32,47 @@ class Imu { /** * Calibrate IMU * - * Calibration takes approximately 2 seconds and blocks during this period if - * the blocking param is true, with a timeout for this operation being set a 3 - * seconds as a safety margin. This function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Calibration takes approximately 2 seconds and blocks during this period if + * the blocking param is true, with a timeout for this operation being set a 3 + * seconds as a safety margin. This function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor * EAGAIN - The sensor is already calibrating, or time out setting the status flag. * - * \param blocking + * \param blocking * Whether this function blocks during calibration. * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. */ virtual std::int32_t reset(bool blocking = false) const; /** - * Set the Inertial Sensor's refresh interval in milliseconds. - * - * The rate may be specified in increments of 5ms, and will be rounded down to - * the nearest increment. The minimum allowable refresh rate is 5ms. The default - * rate is 10ms. - * - * As values are copied into the shared memory buffer only at 10ms intervals, - * setting this value to less than 10ms does not mean that you can poll the - * sensor's values any faster. However, it will guarantee that the data is as - * recent as possible. - * - * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating - * - * \param rate - * The data refresh interval in milliseconds - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - */ + * Set the Inertial Sensor's refresh interval in milliseconds. + * + * The rate may be specified in increments of 5ms, and will be rounded down to + * the nearest increment. The minimum allowable refresh rate is 5ms. The default + * rate is 10ms. + * + * As values are copied into the shared memory buffer only at 10ms intervals, + * setting this value to less than 10ms does not mean that you can poll the + * sensor's values any faster. However, it will guarantee that the data is as + * recent as possible. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * EAGAIN - The sensor is still calibrating + * + * \param rate + * The data refresh interval in milliseconds + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + */ virtual std::int32_t set_data_rate(std::uint32_t rate) const; /** * Get the total number of degrees the Inertial Sensor has spun about the z-axis @@ -310,7 +311,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -345,7 +346,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -380,7 +381,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -435,7 +436,6 @@ class Imu { * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -450,6 +450,21 @@ class Imu { * false if it is not. */ virtual bool is_calibrating() const; + + /** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The physical orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ + virtual pros::c::imu_orientation_e_t get_physical_orientation() const; }; using IMU = Imu; diff --git a/EZ-Template-Example-Project/include/pros/screen.h b/EZ-Template-Example-Project/include/pros/screen.h index 8076daa9..5c6b538f 100644 --- a/EZ-Template-Example-Project/include/pros/screen.h +++ b/EZ-Template-Example-Project/include/pros/screen.h @@ -67,7 +67,7 @@ typedef struct screen_touch_status_s { #define TEXT_MEDIUM pros::E_TEXT_MEDIUM #define TEXT_LARGE pros::E_TEXT_LARGE #define TEXT_MEDIUM_CENTER pros::E_TEXT_MEDIUM_CENTER -#define TEXT_LARGE_CENTER pros::E_LARGE_CENTER +#define TEXT_LARGE_CENTER pros::E_TEXT_LARGE_CENTER #define TOUCH_RELEASED pros::E_TOUCH_RELEASED #define TOUCH_PRESSED pros::E_TOUCH_PRESSED #define TOUCH_HELD pros::E_TOUCH_HELD diff --git a/EZ-Template-Example-Project/project.pros b/EZ-Template-Example-Project/project.pros index 50d1830a..bf4c88d4 100644 --- a/EZ-Template-Example-Project/project.pros +++ b/EZ-Template-Example-Project/project.pros @@ -5,31 +5,31 @@ "target": "v5", "templates": { "EZ-Template": { - "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\EZ-Template@3.0.0", + "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\EZ-Template@3.0.1", "metadata": { "origin": "local" }, "name": "EZ-Template", "py/object": "pros.conductor.templates.local_template.LocalTemplate", - "supported_kernels": "^3.8.0", + "supported_kernels": "^3.8.3", "system_files": [ - "include\\EZ-Template\\slew.hpp", - "include\\EZ-Template\\api.hpp", "include\\EZ-Template\\sdcard.hpp", + "include\\EZ-Template\\slew.hpp", "include\\EZ-Template\\drive\\drive.hpp", + "include\\EZ-Template\\auton_selector.hpp", "include\\EZ-Template\\auton.hpp", - "include\\EZ-Template\\piston.hpp", "include\\EZ-Template\\util.hpp", + "include\\EZ-Template\\PID.hpp", + "include\\EZ-Template\\piston.hpp", "firmware\\EZ-Template.a", - "include\\EZ-Template\\auton_selector.hpp", - "include\\EZ-Template\\PID.hpp" + "include\\EZ-Template\\api.hpp" ], "target": "v5", "user_files": [], - "version": "3.0.0" + "version": "3.0.1" }, "kernel": { - "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\kernel@3.8.0", + "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\kernel@3.8.3", "metadata": { "cold_addr": "58720256", "cold_output": "bin/cold.package.bin", @@ -42,152 +42,152 @@ "py/object": "pros.conductor.templates.local_template.LocalTemplate", "supported_kernels": null, "system_files": [ - "include/display/lv_core/lv_vdb.h", - "include/display/lv_core/lv_core.mk", - "include/display/lv_misc/lv_math.h", - "include/display/lv_objx/lv_tabview.h", - "include/display/lv_misc/lv_color.h", - "include/display/lv_hal/lv_hal_indev.h", - "include/display/lv_fonts/lv_fonts.mk", - "include/display/lv_misc/lv_symbol_def.h", - "include/display/lv_hal/lv_hal.mk", - "include/display/lv_themes/lv_theme_night.h", - "include/display/lv_draw/lv_draw_triangle.h", - "include/pros/optical.hpp", - "include/display/lv_draw/lv_draw_vbasic.h", - "include/display/lv_objx/lv_objx_templ.h", - "include/display/lv_core/lv_refr.h", - "include/pros/link.hpp", - "include/display/lv_objx/lv_btnm.h", - "include/display/lv_objx/lv_cb.h", - "firmware/v5-common.ld", - "include/pros/ext_adi.h", - "include/pros/rotation.h", - "include/display/lv_objx/lv_spinbox.h", - "include/display/lv_misc/lv_circ.h", - "include/display/lv_misc/lv_mem.h", - "include/display/lv_objx/lv_page.h", - "include/display/lv_objx/lv_ddlist.h", - "include/display/lv_core/lv_group.h", - "include/display/lvgl.h", - "include/display/lv_objx/lv_chart.h", - "include/pros/distance.h", - "include/display/lv_objx/lv_list.h", - "include/pros/vision.h", - "include/pros/misc.hpp", - "include/display/lv_draw/lv_draw.h", - "include/display/lv_objx/lv_label.h", - "include/display/lv_misc/lv_font.h", - "include/display/lv_draw/lv_draw_img.h", - "include/display/lv_misc/lv_log.h", - "include/display/lv_misc/lv_templ.h", - "include/pros/llemu.h", - "include/display/lv_objx/lv_btn.h", - "include/display/lv_fonts/lv_font_builtin.h", - "include/display/lv_objx/lv_calendar.h", - "firmware/libm.a", - "include/display/lv_conf.h", - "include/display/lv_objx/lv_sw.h", - "include/display/lv_draw/lv_draw_rect.h", - "include/display/lv_objx/lv_cont.h", - "include/pros/vision.hpp", - "include/display/lv_objx/lv_mbox.h", - "include/pros/adi.hpp", - "include/pros/imu.hpp", - "include/display/lv_objx/lv_table.h", - "include/pros/screen.hpp", - "include/display/lv_draw/lv_draw_label.h", - "include/display/lv_misc/lv_txt.h", - "include/pros/api_legacy.h", - "include/display/lv_objx/lv_lmeter.h", - "include/display/lv_themes/lv_theme_templ.h", - "include/pros/apix.h", - "include/display/lv_draw/lv_draw.mk", - "include/display/lv_themes/lv_theme_alien.h", - "include/pros/colors.hpp", - "include/display/lv_objx/lv_img.h", - "firmware/libc.a", - "include/display/lv_themes/lv_theme_zen.h", - "include/display/lv_themes/lv_theme_material.h", - "include/display/lv_draw/lv_draw_arc.h", - "include/display/lv_themes/lv_theme_mono.h", - "include/display/lv_themes/lv_themes.mk", - "include/display/lv_objx/lv_slider.h", - "include/pros/serial.h", - "include/display/lv_themes/lv_theme.h", - "include/display/README.md", - "include/display/lv_objx/lv_canvas.h", - "include/pros/misc.h", - "include/display/lv_misc/lv_fs.h", - "include/pros/rtos.h", - "include/display/lv_core/lv_indev.h", - "include/pros/motors.hpp", - "include/display/lv_core/lv_style.h", - "include/display/lv_version.h", - "include/display/lv_core/lv_lang.h", - "include/api.h", - "include/display/lv_objx/lv_gauge.h", - "include/pros/rtos.hpp", - "include/display/lv_hal/lv_hal_disp.h", - "include/pros/motors.h", - "include/display/lv_objx/lv_led.h", - "include/display/lv_draw/lv_draw_rbasic.h", - "include/display/lv_objx/lv_kb.h", - "include/display/lv_conf_checker.h", - "include/display/lv_hal/lv_hal.h", - "include/display/lv_draw/lv_draw_line.h", - "include/pros/gps.hpp", - "include/display/lv_objx/lv_objx.mk", - "include/display/lv_objx/lv_win.h", - "include/display/lv_core/lv_obj.h", - "include/display/lv_objx/lv_arc.h", - "include/pros/link.h", - "include/display/lv_objx/lv_preload.h", - "include/display/lv_misc/lv_area.h", - "include/display/lv_misc/lv_ll.h", - "include/pros/optical.h", - "include/pros/serial.hpp", - "include/pros/screen.h", - "include/display/lv_themes/lv_theme_nemo.h", - "include/pros/llemu.hpp", - "firmware/libpros.a", - "include/display/lv_misc/lv_gc.h", - "include/display/lv_misc/lv_anim.h", - "include/display/lv_objx/lv_line.h", - "include/pros/distance.hpp", - "include/pros/rotation.hpp", - "include/pros/error.h", - "include/display/lv_objx/lv_tileview.h", - "include/pros/gps.h", - "include/display/lv_misc/lv_task.h", - "include/pros/imu.h", - "firmware/v5-hot.ld", - "include/display/lv_misc/lv_misc.mk", - "include/pros/colors.h", + "include\\display\\lv_themes\\lv_theme_mono.h", + "include\\display\\lv_themes\\lv_theme_nemo.h", + "include\\display\\lv_objx\\lv_calendar.h", + "include\\display\\lv_themes\\lv_theme_zen.h", + "include\\display\\lv_objx\\lv_spinbox.h", + "include\\pros\\screen.hpp", + "include\\display\\lv_objx\\lv_ddlist.h", + "include\\display\\lv_themes\\lv_theme.h", + "include\\display\\lv_hal\\lv_hal.h", + "include\\display\\lv_draw\\lv_draw_arc.h", + "include\\display\\lv_objx\\lv_list.h", + "include\\display\\lv_themes\\lv_themes.mk", + "include\\pros\\motors.hpp", + "include\\pros\\adi.h", + "include\\display\\lv_draw\\lv_draw.h", + "include\\pros\\colors.hpp", + "include\\display\\licence.txt", + "include\\display\\lv_draw\\lv_draw_img.h", + "include\\display\\lv_fonts\\lv_fonts.mk", + "include\\display\\lv_draw\\lv_draw_rect.h", + "include\\display\\lv_core\\lv_group.h", + "include\\display\\lv_draw\\lv_draw_label.h", + "include\\pros\\llemu.h", + "include\\pros\\error.h", + "include\\display\\lv_misc\\lv_ufs.h", + "firmware\\libm.a", + "include\\display\\lv_objx\\lv_led.h", + "include\\display\\lv_objx\\lv_btn.h", + "include\\display\\lv_misc\\lv_misc.mk", + "include\\display\\lv_objx\\lv_canvas.h", + "include\\display\\lv_objx\\lv_preload.h", + "include\\pros\\misc.hpp", + "include\\display\\lv_misc\\lv_fs.h", + "include\\pros\\rotation.hpp", + "include\\pros\\colors.h", + "include\\pros\\vision.hpp", + "include\\display\\lv_objx\\lv_img.h", + "include\\display\\lv_fonts\\lv_font_builtin.h", + "include\\display\\lv_objx\\lv_lmeter.h", + "include\\display\\lv_misc\\lv_font.h", + "firmware\\v5.ld", + "include\\display\\lv_objx\\lv_tileview.h", + "include\\display\\lv_hal\\lv_hal_tick.h", + "include\\display\\lv_core\\lv_vdb.h", + "include\\display\\lv_core\\lv_indev.h", + "include\\pros\\vision.h", + "firmware\\v5-hot.ld", + "include\\display\\lv_objx\\lv_kb.h", + "include\\display\\lv_misc\\lv_symbol_def.h", + "firmware\\libc.a", + "include\\display\\lv_objx\\lv_label.h", + "include\\display\\lv_objx\\lv_tabview.h", + "firmware\\libpros.a", + "include\\display\\lv_misc\\lv_ll.h", + "include\\display\\lv_misc\\lv_log.h", + "include\\pros\\screen.h", + "include\\display\\lv_hal\\lv_hal.mk", + "include\\pros\\serial.hpp", + "include\\pros\\optical.hpp", + "include\\display\\lv_misc\\lv_txt.h", + "include\\display\\lv_misc\\lv_task.h", + "firmware\\v5-common.ld", + "include\\pros\\optical.h", + "include\\pros\\rtos.hpp", + "include\\display\\lv_conf_checker.h", + "include\\display\\lv_misc\\lv_math.h", + "include\\display\\lv_draw\\lv_draw_rbasic.h", + "include\\display\\lv_themes\\lv_theme_alien.h", + "include\\pros\\motors.h", + "include\\pros\\misc.h", + "include\\display\\lv_themes\\lv_theme_default.h", + "include\\pros\\gps.h", + "include\\display\\lv_misc\\lv_templ.h", + "include\\display\\lv_misc\\lv_circ.h", + "include\\api.h", + "include\\display\\lv_objx\\lv_ta.h", + "include\\display\\lv_draw\\lv_draw_triangle.h", + "include\\display\\lv_misc\\lv_mem.h", + "include\\display\\lv_objx\\lv_imgbtn.h", + "include\\pros\\link.h", + "include\\display\\lv_version.h", + "include\\display\\lv_conf.h", + "include\\display\\lv_objx\\lv_mbox.h", + "include\\display\\lv_misc\\lv_anim.h", + "include\\display\\lv_hal\\lv_hal_indev.h", + "include\\display\\lv_objx\\lv_btnm.h", + "include\\display\\lv_misc\\lv_color.h", + "include\\display\\lv_draw\\lv_draw_vbasic.h", + "include\\pros\\distance.hpp", + "include\\display\\lv_objx\\lv_bar.h", + "include\\display\\lv_objx\\lv_gauge.h", + "include\\display\\lv_draw\\lv_draw.mk", + "include\\display\\lvgl.h", + "include\\display\\lv_objx\\lv_slider.h", + "include\\display\\lv_objx\\lv_objx.mk", + "include\\display\\README.md", + "include\\display\\lv_core\\lv_lang.h", + "include\\display\\lv_objx\\lv_arc.h", + "include\\pros\\serial.h", + "include\\pros\\llemu.hpp", + "include\\pros\\adi.hpp", + "include\\display\\lv_objx\\lv_table.h", + "include\\display\\lv_draw\\lv_draw_line.h", + "include\\display\\lv_misc\\lv_area.h", + "include\\display\\lv_core\\lv_core.mk", + "include\\display\\lv_objx\\lv_line.h", + "include\\display\\lv_hal\\lv_hal_disp.h", + "include\\display\\lv_misc\\lv_gc.h", + "include\\pros\\rotation.h", + "include\\display\\lv_themes\\lv_theme_material.h", + "include\\display\\lv_core\\lv_style.h", + "include\\display\\lv_objx\\lv_cb.h", + "include\\display\\lv_objx\\lv_chart.h", "common.mk", - "include/display/lv_objx/lv_roller.h", - "include/display/lv_objx/lv_bar.h", - "include/display/lv_themes/lv_theme_default.h", - "firmware/v5.ld", - "include/display/lv_misc/lv_ufs.h", - "include/display/lv_hal/lv_hal_tick.h", - "include/display/licence.txt", - "include/display/lv_objx/lv_ta.h", - "include/display/lv_objx/lv_imgbtn.h", - "include/pros/adi.h" + "include\\pros\\ext_adi.h", + "include\\display\\lv_objx\\lv_objx_templ.h", + "include\\display\\lv_core\\lv_refr.h", + "include\\display\\lv_core\\lv_obj.h", + "include\\pros\\api_legacy.h", + "include\\pros\\rtos.h", + "include\\pros\\imu.h", + "include\\display\\lv_objx\\lv_win.h", + "include\\display\\lv_objx\\lv_cont.h", + "include\\display\\lv_themes\\lv_theme_templ.h", + "include\\pros\\link.hpp", + "include\\pros\\distance.h", + "include\\display\\lv_objx\\lv_roller.h", + "include\\display\\lv_objx\\lv_sw.h", + "include\\pros\\imu.hpp", + "include\\pros\\gps.hpp", + "include\\display\\lv_themes\\lv_theme_night.h", + "include\\pros\\apix.h", + "include\\display\\lv_objx\\lv_page.h" ], "target": "v5", "user_files": [ - "src/main.cc", - ".gitignore", + "include\\main.h", + "src\\main.c", + "include\\main.hpp", + "include\\main.hh", + "src\\main.cpp", + "src\\main.cc", "Makefile", - "src/main.cpp", - "src/main.c", - "include/main.hpp", - "include/main.hh", - "include/main.h" + ".gitignore" ], - "version": "3.8.0" + "version": "3.8.3" }, "okapilib": { "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\okapilib@4.8.0", diff --git a/EZ-Template-Example-Project/src/main.cpp b/EZ-Template-Example-Project/src/main.cpp index 58bf5284..c836f129 100644 --- a/EZ-Template-Example-Project/src/main.cpp +++ b/EZ-Template-Example-Project/src/main.cpp @@ -118,7 +118,14 @@ void autonomous() { chassis.drive_sensor_reset(); // Reset drive sensors to 0 chassis.drive_brake_set(MOTOR_BRAKE_HOLD); // Set motors to hold. This helps autonomous consistency - ez::as::auton_selector.selected_auton_call(); // Calls selected auton from autonomous selector + // ez::as::auton_selector.selected_auton_call(); // Calls selected auton from autonomous selector + int dist = 48; + chassis.pid_drive_set(dist, 127, true); + chassis.pid_wait_until(dist - 5); + + int dist2 = -(dist-6); + chassis.pid_drive_set(dist2, 127, true); + chassis.pid_wait_until(dist2 + 5); } diff --git a/EZ-Template@3.0.0.zip b/EZ-Template@3.0.1.zip similarity index 54% rename from EZ-Template@3.0.0.zip rename to EZ-Template@3.0.1.zip index 18de689c..31e8046b 100644 Binary files a/EZ-Template@3.0.0.zip and b/EZ-Template@3.0.1.zip differ diff --git a/Makefile b/Makefile index 4916542d..78588c4e 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:= IS_LIBRARY:=1 # TODO: CHANGE THIS! LIBNAME:=EZ-Template -VERSION:=3.0.0 +VERSION:=3.0.1 # EXCLUDE_SRC_FROM_LIB= $(SRCDIR)/unpublishedfile.c # this line excludes opcontrol.c and similar files EXCLUDE_SRC_FROM_LIB+=$(foreach file, $(SRCDIR)/autons $(SRCDIR)/main,$(foreach cext,$(CEXTS),$(file).$(cext)) $(foreach cxxext,$(CXXEXTS),$(file).$(cxxext))) diff --git a/firmware/libpros.a b/firmware/libpros.a index 05399901..3dbfc1b7 100644 Binary files a/firmware/libpros.a and b/firmware/libpros.a differ diff --git a/include/api.h b/include/api.h index 7e923199..6b09de1d 100644 --- a/include/api.h +++ b/include/api.h @@ -41,8 +41,8 @@ #define PROS_VERSION_MAJOR 3 #define PROS_VERSION_MINOR 8 -#define PROS_VERSION_PATCH 0 -#define PROS_VERSION_STRING "3.8.0" +#define PROS_VERSION_PATCH 3 +#define PROS_VERSION_STRING "3.8.3" #include "pros/adi.h" #include "pros/colors.h" @@ -56,8 +56,8 @@ #include "pros/misc.h" #include "pros/motors.h" #include "pros/optical.h" -#include "pros/rtos.h" #include "pros/rotation.h" +#include "pros/rtos.h" #include "pros/screen.h" #include "pros/vision.h" @@ -66,6 +66,7 @@ #include "pros/distance.hpp" #include "pros/gps.hpp" #include "pros/imu.hpp" +#include "pros/link.hpp" #include "pros/llemu.hpp" #include "pros/misc.hpp" #include "pros/motors.hpp" @@ -74,7 +75,6 @@ #include "pros/rtos.hpp" #include "pros/screen.hpp" #include "pros/vision.hpp" -#include "pros/link.hpp" #endif #endif // _PROS_API_H_ diff --git a/include/pros/gps.h b/include/pros/gps.h index 1b2e7e7b..917f6938 100644 --- a/include/pros/gps.h +++ b/include/pros/gps.h @@ -188,6 +188,91 @@ double gps_get_error(uint8_t port); */ gps_status_s_t gps_get_status(uint8_t port); +/** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_x_position(uint8_t port); + +/** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_y_position(uint8_t port); + +/** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The pitch in (-90,90] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_pitch(uint8_t port); + +/** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The roll in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_roll(uint8_t port); + +/** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating + * + * \param port + * The V5 GPS port number from 1-21 + * + * \return The yaw in (-180,180] degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ +double gps_get_yaw(uint8_t port); + /** * Get the heading in [0,360) degree values. * diff --git a/include/pros/gps.hpp b/include/pros/gps.hpp index fce40c2a..7a321239 100644 --- a/include/pros/gps.hpp +++ b/include/pros/gps.hpp @@ -52,8 +52,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -77,8 +77,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Cartesian 4-Quadrant X offset from center of turning (meters) @@ -95,8 +95,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xOffset * Pointer to cartesian 4-Quadrant X offset from center of turning (meters) @@ -113,8 +113,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param xInitial * Initial 4-Quadrant X Position, with (0,0) being at the center of the field (meters) @@ -133,8 +133,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param rate * Data rate in milliseconds (Minimum: 5 ms) @@ -149,8 +149,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return Possible RMS (Root Mean Squared) error in meters for GPS position. * If the operation failed, returns PROS_ERR_F and errno is set. @@ -163,8 +163,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return A struct (gps_status_s_t) containing values mentioned above. @@ -173,14 +173,89 @@ class Gps { */ virtual pros::c::gps_status_s_t get_status() const; + /** + * Gets the X position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The X position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_x_position() const; + + /** + * Gets the Y position in meters of the robot relative to the starting position. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The Y position in meters. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_y_position() const; + + /** + * Gets the pitch of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The pitch in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_pitch() const; + + /** + * Gets the roll of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The roll in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_roll() const; + + /** + * Gets the yaw of the GPS in degrees relative to the starting orientation. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. + * + * + * \return The yaw in [0,360) degree values. If the operation failed, + * returns PROS_ERR_F and errno is set. + */ + virtual double get_yaw() const; + /** * Get the heading in [0,360) degree values. * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * * \return The heading in [0,360) degree values. If the operation failed, @@ -194,8 +269,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The heading in [DOUBLE_MIN, DOUBLE_MAX] values. If the operation * fails, returns PROS_ERR_F and errno is set. @@ -208,8 +283,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The elased heading in degrees. If the operation fails, returns * PROS_ERR_F and errno is set. @@ -222,8 +297,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \param target * Target rotation value to set rotation value to @@ -238,8 +313,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. @@ -252,8 +327,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as a GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS. + * EAGAIN - The sensor is still calibrating. * * \return The raw gyroscope values. If the operation failed, all the * structure's members are filled with PROS_ERR_F and errno is set. @@ -266,8 +341,8 @@ class Gps { * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an GPS - * EAGAIN - The sensor is still calibrating + * ENODEV - The port cannot be configured as a GPS + * EAGAIN - The sensor is still calibrating. * * \param port * The V5 GPS's port number from 1-21 diff --git a/include/pros/imu.h b/include/pros/imu.h index f5a1cdc3..d87508c4 100644 --- a/include/pros/imu.h +++ b/include/pros/imu.h @@ -29,11 +29,20 @@ namespace c { #endif typedef enum imu_status_e { - E_IMU_STATUS_CALIBRATING = 0x01, - E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is - // necessarily in an error state + E_IMU_STATUS_READY = 0, // IMU is connected but not currently calibrating + E_IMU_STATUS_CALIBRATING = 1, // IMU is calibrating + E_IMU_STATUS_ERROR = 0xFF, // NOTE: used for returning an error from the get_status function, not that the IMU is + // necessarily in an error state } imu_status_e_t; +typedef enum imu_orientation_e { + E_IMU_Z_UP = 0, // IMU has the Z axis UP (VEX Logo facing DOWN) + E_IMU_Z_DOWN = 1, // IMU has the Z axis DOWN (VEX Logo facing UP) + E_IMU_X_UP = 2, // IMU has the X axis UP + E_IMU_X_DOWN = 3, // IMU has the X axis DOWN + E_IMU_Y_UP = 4, // IMU has the Y axis UP + E_IMU_Y_DOWN = 5, // IMU has the Y axis DOWN +} imu_orientation_e_t; typedef struct __attribute__((__packed__)) quaternion_s { double x; double y; @@ -91,10 +100,10 @@ int32_t imu_reset(uint8_t port); /** * Calibrate IMU and Blocks while Calibrating * - * Calibration takes approximately 2 seconds and blocks during this period, + * Calibration takes approximately 2 seconds and blocks during this period, * with a timeout for this operation being set a 3 seconds as a safety margin. - * Like the other reset function, this function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Like the other reset function, this function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. * * This function uses the following values of errno when an error state is @@ -296,7 +305,6 @@ imu_accel_s_t imu_get_accel(uint8_t port); * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -309,7 +317,7 @@ imu_status_e_t imu_get_status(uint8_t port); // void imu_set_mode(uint8_t port, uint32_t mode); // uint32_t imu_get_mode(uint8_t port); -//Value reset functions: +// Value reset functions: /** * Resets the current reading of the Inertial Sensor's heading to zero * @@ -422,7 +430,7 @@ int32_t imu_tare_euler(uint8_t port); */ int32_t imu_tare(uint8_t port); -//Value set functions: +// Value set functions: /** * Sets the current reading of the Inertial Sensor's euler values to * target euler values. Will default to +/- 180 if target exceeds +/- 180. @@ -463,7 +471,7 @@ int32_t imu_set_rotation(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -482,7 +490,7 @@ int32_t imu_set_heading(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's pitch to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -501,7 +509,7 @@ int32_t imu_set_pitch(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -520,7 +528,7 @@ int32_t imu_set_roll(uint8_t port, double target); /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -536,6 +544,21 @@ int32_t imu_set_roll(uint8_t port, double target); */ int32_t imu_set_yaw(uint8_t port, double target); +/** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ +imu_orientation_e_t imu_get_physical_orientation(uint8_t port); + #ifdef __cplusplus } } diff --git a/include/pros/imu.hpp b/include/pros/imu.hpp index 99b28c8d..3f6f3933 100644 --- a/include/pros/imu.hpp +++ b/include/pros/imu.hpp @@ -19,6 +19,7 @@ #define _PROS_IMU_HPP_ #include + #include "pros/imu.h" namespace pros { @@ -31,47 +32,47 @@ class Imu { /** * Calibrate IMU * - * Calibration takes approximately 2 seconds and blocks during this period if - * the blocking param is true, with a timeout for this operation being set a 3 - * seconds as a safety margin. This function also blocks until the IMU - * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum + * Calibration takes approximately 2 seconds and blocks during this period if + * the blocking param is true, with a timeout for this operation being set a 3 + * seconds as a safety margin. This function also blocks until the IMU + * status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum * blocking time of 5ms and a timeout of 1 second if it's never set. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor * EAGAIN - The sensor is already calibrating, or time out setting the status flag. * - * \param blocking + * \param blocking * Whether this function blocks during calibration. * \return 1 if the operation was successful or PROS_ERR if the operation * failed, setting errno. */ virtual std::int32_t reset(bool blocking = false) const; /** - * Set the Inertial Sensor's refresh interval in milliseconds. - * - * The rate may be specified in increments of 5ms, and will be rounded down to - * the nearest increment. The minimum allowable refresh rate is 5ms. The default - * rate is 10ms. - * - * As values are copied into the shared memory buffer only at 10ms intervals, - * setting this value to less than 10ms does not mean that you can poll the - * sensor's values any faster. However, it will guarantee that the data is as - * recent as possible. - * - * This function uses the following values of errno when an error state is - * reached: - * ENXIO - The given value is not within the range of V5 ports (1-21). - * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating - * - * \param rate - * The data refresh interval in milliseconds - * \return 1 if the operation was successful or PROS_ERR if the operation - * failed, setting errno. - */ + * Set the Inertial Sensor's refresh interval in milliseconds. + * + * The rate may be specified in increments of 5ms, and will be rounded down to + * the nearest increment. The minimum allowable refresh rate is 5ms. The default + * rate is 10ms. + * + * As values are copied into the shared memory buffer only at 10ms intervals, + * setting this value to less than 10ms does not mean that you can poll the + * sensor's values any faster. However, it will guarantee that the data is as + * recent as possible. + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * EAGAIN - The sensor is still calibrating + * + * \param rate + * The data refresh interval in milliseconds + * \return 1 if the operation was successful or PROS_ERR if the operation + * failed, setting errno. + */ virtual std::int32_t set_data_rate(std::uint32_t rate) const; /** * Get the total number of degrees the Inertial Sensor has spun about the z-axis @@ -310,7 +311,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's heading to target value * Target will default to 360 if above 360 and default to 0 if below 0. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -345,7 +346,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's yaw to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -380,7 +381,7 @@ class Imu { /** * Sets the current reading of the Inertial Sensor's roll to target value * Will default to +/- 180 if target exceeds +/- 180. - * + * * This function uses the following values of errno when an error state is * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). @@ -435,7 +436,6 @@ class Imu { * reached: * ENXIO - The given value is not within the range of V5 ports (1-21). * ENODEV - The port cannot be configured as an Inertial Sensor - * EAGAIN - The sensor is still calibrating * * \param port * The V5 Inertial Sensor port number from 1-21 @@ -450,6 +450,21 @@ class Imu { * false if it is not. */ virtual bool is_calibrating() const; + + /** + * Returns the physical orientation of the IMU + * + * This function uses the following values of errno when an error state is + * reached: + * ENXIO - The given value is not within the range of V5 ports (1-21). + * ENODEV - The port cannot be configured as an Inertial Sensor + * + * \param port + * The V5 Inertial Sensor port number from 1-21 + * \returns The physical orientation of the Inertial Sensor or PROS_ERR if an error occured. + * + */ + virtual pros::c::imu_orientation_e_t get_physical_orientation() const; }; using IMU = Imu; diff --git a/include/pros/screen.h b/include/pros/screen.h index 8076daa9..5c6b538f 100644 --- a/include/pros/screen.h +++ b/include/pros/screen.h @@ -67,7 +67,7 @@ typedef struct screen_touch_status_s { #define TEXT_MEDIUM pros::E_TEXT_MEDIUM #define TEXT_LARGE pros::E_TEXT_LARGE #define TEXT_MEDIUM_CENTER pros::E_TEXT_MEDIUM_CENTER -#define TEXT_LARGE_CENTER pros::E_LARGE_CENTER +#define TEXT_LARGE_CENTER pros::E_TEXT_LARGE_CENTER #define TOUCH_RELEASED pros::E_TOUCH_RELEASED #define TOUCH_PRESSED pros::E_TOUCH_PRESSED #define TOUCH_HELD pros::E_TOUCH_HELD diff --git a/project.pros b/project.pros index d827947a..728bdc0f 100644 --- a/project.pros +++ b/project.pros @@ -5,7 +5,7 @@ "target": "v5", "templates": { "kernel": { - "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\kernel@3.8.0", + "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\kernel@3.8.3", "metadata": { "cold_addr": "58720256", "cold_output": "bin/cold.package.bin", @@ -18,152 +18,152 @@ "py/object": "pros.conductor.templates.local_template.LocalTemplate", "supported_kernels": null, "system_files": [ - "include/display/lv_core/lv_vdb.h", - "include/display/lv_core/lv_core.mk", - "include/display/lv_misc/lv_math.h", - "include/display/lv_objx/lv_tabview.h", - "include/display/lv_misc/lv_color.h", - "include/display/lv_hal/lv_hal_indev.h", - "include/display/lv_fonts/lv_fonts.mk", - "include/display/lv_misc/lv_symbol_def.h", - "include/display/lv_hal/lv_hal.mk", - "include/display/lv_themes/lv_theme_night.h", - "include/display/lv_draw/lv_draw_triangle.h", - "include/pros/optical.hpp", - "include/display/lv_draw/lv_draw_vbasic.h", - "include/display/lv_objx/lv_objx_templ.h", - "include/display/lv_core/lv_refr.h", - "include/pros/link.hpp", - "include/display/lv_objx/lv_btnm.h", - "include/display/lv_objx/lv_cb.h", - "firmware/v5-common.ld", - "include/pros/ext_adi.h", - "include/pros/rotation.h", - "include/display/lv_objx/lv_spinbox.h", - "include/display/lv_misc/lv_circ.h", - "include/display/lv_misc/lv_mem.h", - "include/display/lv_objx/lv_page.h", - "include/display/lv_objx/lv_ddlist.h", - "include/display/lv_core/lv_group.h", - "include/display/lvgl.h", - "include/display/lv_objx/lv_chart.h", - "include/pros/distance.h", - "include/display/lv_objx/lv_list.h", - "include/pros/vision.h", - "include/pros/misc.hpp", - "include/display/lv_draw/lv_draw.h", - "include/display/lv_objx/lv_label.h", - "include/display/lv_misc/lv_font.h", - "include/display/lv_draw/lv_draw_img.h", - "include/display/lv_misc/lv_log.h", - "include/display/lv_misc/lv_templ.h", - "include/pros/llemu.h", - "include/display/lv_objx/lv_btn.h", - "include/display/lv_fonts/lv_font_builtin.h", - "include/display/lv_objx/lv_calendar.h", - "firmware/libm.a", - "include/display/lv_conf.h", - "include/display/lv_objx/lv_sw.h", - "include/display/lv_draw/lv_draw_rect.h", - "include/display/lv_objx/lv_cont.h", - "include/pros/vision.hpp", - "include/display/lv_objx/lv_mbox.h", - "include/pros/adi.hpp", - "include/pros/imu.hpp", - "include/display/lv_objx/lv_table.h", - "include/pros/screen.hpp", - "include/display/lv_draw/lv_draw_label.h", - "include/display/lv_misc/lv_txt.h", - "include/pros/api_legacy.h", - "include/display/lv_objx/lv_lmeter.h", - "include/display/lv_themes/lv_theme_templ.h", - "include/pros/apix.h", - "include/display/lv_draw/lv_draw.mk", - "include/display/lv_themes/lv_theme_alien.h", - "include/pros/colors.hpp", - "include/display/lv_objx/lv_img.h", - "firmware/libc.a", - "include/display/lv_themes/lv_theme_zen.h", - "include/display/lv_themes/lv_theme_material.h", - "include/display/lv_draw/lv_draw_arc.h", - "include/display/lv_themes/lv_theme_mono.h", - "include/display/lv_themes/lv_themes.mk", - "include/display/lv_objx/lv_slider.h", - "include/pros/serial.h", - "include/display/lv_themes/lv_theme.h", - "include/display/README.md", - "include/display/lv_objx/lv_canvas.h", - "include/pros/misc.h", - "include/display/lv_misc/lv_fs.h", - "include/pros/rtos.h", - "include/display/lv_core/lv_indev.h", - "include/pros/motors.hpp", - "include/display/lv_core/lv_style.h", - "include/display/lv_version.h", - "include/display/lv_core/lv_lang.h", - "include/api.h", - "include/display/lv_objx/lv_gauge.h", - "include/pros/rtos.hpp", - "include/display/lv_hal/lv_hal_disp.h", - "include/pros/motors.h", - "include/display/lv_objx/lv_led.h", - "include/display/lv_draw/lv_draw_rbasic.h", - "include/display/lv_objx/lv_kb.h", - "include/display/lv_conf_checker.h", - "include/display/lv_hal/lv_hal.h", - "include/display/lv_draw/lv_draw_line.h", - "include/pros/gps.hpp", - "include/display/lv_objx/lv_objx.mk", - "include/display/lv_objx/lv_win.h", - "include/display/lv_core/lv_obj.h", - "include/display/lv_objx/lv_arc.h", - "include/pros/link.h", - "include/display/lv_objx/lv_preload.h", - "include/display/lv_misc/lv_area.h", - "include/display/lv_misc/lv_ll.h", - "include/pros/optical.h", - "include/pros/serial.hpp", - "include/pros/screen.h", - "include/display/lv_themes/lv_theme_nemo.h", - "include/pros/llemu.hpp", - "firmware/libpros.a", - "include/display/lv_misc/lv_gc.h", - "include/display/lv_misc/lv_anim.h", - "include/display/lv_objx/lv_line.h", - "include/pros/distance.hpp", - "include/pros/rotation.hpp", - "include/pros/error.h", - "include/display/lv_objx/lv_tileview.h", - "include/pros/gps.h", - "include/display/lv_misc/lv_task.h", - "include/pros/imu.h", - "firmware/v5-hot.ld", - "include/display/lv_misc/lv_misc.mk", - "include/pros/colors.h", + "include\\display\\lv_themes\\lv_theme_mono.h", + "include\\display\\lv_themes\\lv_theme_nemo.h", + "include\\display\\lv_objx\\lv_calendar.h", + "include\\display\\lv_themes\\lv_theme_zen.h", + "include\\display\\lv_objx\\lv_spinbox.h", + "include\\pros\\screen.hpp", + "include\\display\\lv_objx\\lv_ddlist.h", + "include\\display\\lv_themes\\lv_theme.h", + "include\\display\\lv_hal\\lv_hal.h", + "include\\display\\lv_draw\\lv_draw_arc.h", + "include\\display\\lv_objx\\lv_list.h", + "include\\display\\lv_themes\\lv_themes.mk", + "include\\pros\\motors.hpp", + "include\\pros\\adi.h", + "include\\display\\lv_draw\\lv_draw.h", + "include\\pros\\colors.hpp", + "include\\display\\licence.txt", + "include\\display\\lv_draw\\lv_draw_img.h", + "include\\display\\lv_fonts\\lv_fonts.mk", + "include\\display\\lv_draw\\lv_draw_rect.h", + "include\\display\\lv_core\\lv_group.h", + "include\\display\\lv_draw\\lv_draw_label.h", + "include\\pros\\llemu.h", + "include\\pros\\error.h", + "include\\display\\lv_misc\\lv_ufs.h", + "firmware\\libm.a", + "include\\display\\lv_objx\\lv_led.h", + "include\\display\\lv_objx\\lv_btn.h", + "include\\display\\lv_misc\\lv_misc.mk", + "include\\display\\lv_objx\\lv_canvas.h", + "include\\display\\lv_objx\\lv_preload.h", + "include\\pros\\misc.hpp", + "include\\display\\lv_misc\\lv_fs.h", + "include\\pros\\rotation.hpp", + "include\\pros\\colors.h", + "include\\pros\\vision.hpp", + "include\\display\\lv_objx\\lv_img.h", + "include\\display\\lv_fonts\\lv_font_builtin.h", + "include\\display\\lv_objx\\lv_lmeter.h", + "include\\display\\lv_misc\\lv_font.h", + "firmware\\v5.ld", + "include\\display\\lv_objx\\lv_tileview.h", + "include\\display\\lv_hal\\lv_hal_tick.h", + "include\\display\\lv_core\\lv_vdb.h", + "include\\display\\lv_core\\lv_indev.h", + "include\\pros\\vision.h", + "firmware\\v5-hot.ld", + "include\\display\\lv_objx\\lv_kb.h", + "include\\display\\lv_misc\\lv_symbol_def.h", + "firmware\\libc.a", + "include\\display\\lv_objx\\lv_label.h", + "include\\display\\lv_objx\\lv_tabview.h", + "firmware\\libpros.a", + "include\\display\\lv_misc\\lv_ll.h", + "include\\display\\lv_misc\\lv_log.h", + "include\\pros\\screen.h", + "include\\display\\lv_hal\\lv_hal.mk", + "include\\pros\\serial.hpp", + "include\\pros\\optical.hpp", + "include\\display\\lv_misc\\lv_txt.h", + "include\\display\\lv_misc\\lv_task.h", + "firmware\\v5-common.ld", + "include\\pros\\optical.h", + "include\\pros\\rtos.hpp", + "include\\display\\lv_conf_checker.h", + "include\\display\\lv_misc\\lv_math.h", + "include\\display\\lv_draw\\lv_draw_rbasic.h", + "include\\display\\lv_themes\\lv_theme_alien.h", + "include\\pros\\motors.h", + "include\\pros\\misc.h", + "include\\display\\lv_themes\\lv_theme_default.h", + "include\\pros\\gps.h", + "include\\display\\lv_misc\\lv_templ.h", + "include\\display\\lv_misc\\lv_circ.h", + "include\\api.h", + "include\\display\\lv_objx\\lv_ta.h", + "include\\display\\lv_draw\\lv_draw_triangle.h", + "include\\display\\lv_misc\\lv_mem.h", + "include\\display\\lv_objx\\lv_imgbtn.h", + "include\\pros\\link.h", + "include\\display\\lv_version.h", + "include\\display\\lv_conf.h", + "include\\display\\lv_objx\\lv_mbox.h", + "include\\display\\lv_misc\\lv_anim.h", + "include\\display\\lv_hal\\lv_hal_indev.h", + "include\\display\\lv_objx\\lv_btnm.h", + "include\\display\\lv_misc\\lv_color.h", + "include\\display\\lv_draw\\lv_draw_vbasic.h", + "include\\pros\\distance.hpp", + "include\\display\\lv_objx\\lv_bar.h", + "include\\display\\lv_objx\\lv_gauge.h", + "include\\display\\lv_draw\\lv_draw.mk", + "include\\display\\lvgl.h", + "include\\display\\lv_objx\\lv_slider.h", + "include\\display\\lv_objx\\lv_objx.mk", + "include\\display\\README.md", + "include\\display\\lv_core\\lv_lang.h", + "include\\display\\lv_objx\\lv_arc.h", + "include\\pros\\serial.h", + "include\\pros\\llemu.hpp", + "include\\pros\\adi.hpp", + "include\\display\\lv_objx\\lv_table.h", + "include\\display\\lv_draw\\lv_draw_line.h", + "include\\display\\lv_misc\\lv_area.h", + "include\\display\\lv_core\\lv_core.mk", + "include\\display\\lv_objx\\lv_line.h", + "include\\display\\lv_hal\\lv_hal_disp.h", + "include\\display\\lv_misc\\lv_gc.h", + "include\\pros\\rotation.h", + "include\\display\\lv_themes\\lv_theme_material.h", + "include\\display\\lv_core\\lv_style.h", + "include\\display\\lv_objx\\lv_cb.h", + "include\\display\\lv_objx\\lv_chart.h", "common.mk", - "include/display/lv_objx/lv_roller.h", - "include/display/lv_objx/lv_bar.h", - "include/display/lv_themes/lv_theme_default.h", - "firmware/v5.ld", - "include/display/lv_misc/lv_ufs.h", - "include/display/lv_hal/lv_hal_tick.h", - "include/display/licence.txt", - "include/display/lv_objx/lv_ta.h", - "include/display/lv_objx/lv_imgbtn.h", - "include/pros/adi.h" + "include\\pros\\ext_adi.h", + "include\\display\\lv_objx\\lv_objx_templ.h", + "include\\display\\lv_core\\lv_refr.h", + "include\\display\\lv_core\\lv_obj.h", + "include\\pros\\api_legacy.h", + "include\\pros\\rtos.h", + "include\\pros\\imu.h", + "include\\display\\lv_objx\\lv_win.h", + "include\\display\\lv_objx\\lv_cont.h", + "include\\display\\lv_themes\\lv_theme_templ.h", + "include\\pros\\link.hpp", + "include\\pros\\distance.h", + "include\\display\\lv_objx\\lv_roller.h", + "include\\display\\lv_objx\\lv_sw.h", + "include\\pros\\imu.hpp", + "include\\pros\\gps.hpp", + "include\\display\\lv_themes\\lv_theme_night.h", + "include\\pros\\apix.h", + "include\\display\\lv_objx\\lv_page.h" ], "target": "v5", "user_files": [ - "src/main.cc", - ".gitignore", + "include\\main.h", + "src\\main.c", + "include\\main.hpp", + "include\\main.hh", + "src\\main.cpp", + "src\\main.cc", "Makefile", - "src/main.cpp", - "src/main.c", - "include/main.hpp", - "include/main.hh", - "include/main.h" + ".gitignore" ], - "version": "3.8.0" + "version": "3.8.3" }, "okapilib": { "location": "C:\\Users\\union\\AppData\\Roaming\\PROS\\templates\\okapilib@4.8.0", diff --git a/src/main.cpp b/src/main.cpp index 1f2f3f28..4f5d144c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,25 +10,25 @@ ez::Drive chassis ( // Left Chassis Ports (negative port will reverse it!) // the first port is used as the sensor - {-10, -19, 20, 9} + {-7, -6, -8, 20} // Right Chassis Ports (negative port will reverse it!) // the first port is used as the sensor - ,{3, -4, -11, 12} + ,{-12, 2, 5, 11} // IMU Port - ,6 + ,15 // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!) - ,3.25 + ,4.0 // Cartridge RPM - ,600 + ,400 // External Gear Ratio (MUST BE DECIMAL) This is WHEEL GEAR / MOTOR GEAR // eg. if your drive is 84:36 where the 36t is powered, your RATIO would be 84/36 which is 2.333 // eg. if your drive is 36:60 where the 60t is powered, your RATIO would be 36/60 which is 0.6 - ,1.18343195266 + ,1.0 ); diff --git a/version b/version index 56fea8a0..13d683cc 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.0.0 \ No newline at end of file +3.0.1 \ No newline at end of file