Skip to content

Commit

Permalink
v3.0.1 (#97)
Browse files Browse the repository at this point in the history
* Fixed rotation sensor tick per rev (#47)

* middle step for #49 and #54

* Added piston groups (#54)

* Completed small issues (#56, #55, $54, #52, #48)

* Finished with clean up on constants

* Added set ratio function

* Added practice mode

* Updated PROS Kernel, okapi, fixed #53, general cleaning

* ✨Okapi units (#49, #62)

* ✨ Added `set_relative_turn_pid()` (#59)

* issue #59 - add set_relative_turn_pid function, no issue - fix various cases of wrong function documentation

* issue #59 - set_relative_turn_pid changed casing of variables to snake_case and made it relative to current target, not current heading

* Fixed issue #67

* ✨Okapi units

* New function names #65

* Added okapi units to turns and time, tuned PID, cleaned code, completed #66

* Fixed some names, added `get` functions #73

* Added more gets, removed version # from print  #73

The version number in `ez_template_print` was redundant when version can be checked through pros cli.

* ⬆️ Update Kernel/Okapi to 3.8.0 and 4.8.0 Respectively  (#76)

* Memory optimisation and comments:
when a function is static, it doesn't need to exist for every object. Since this function does not reference any internal variables, it can be static

* Maybe I was wrong

* add new website code

* added running the site locally

* kernel upgrade

* Update Kernel/Okapi

---------

Co-authored-by: Michael Barr <[email protected]>
Co-authored-by: Asik007 <[email protected]>
Co-authored-by: Sylvie <[email protected]>

* Added Ability for user to reverse Drive in opcontrol (#80)

* Update drive.hpp

weird changes

* Added Reversal to opcontrol driving

* mistake deleting active break logic, added back

* Removed old website, updated readme

* Completed #82, fixed formatting

* Cleaned relative turns, added wide swings #59 #83

* Added slew to turns and swings, fixed wide arc bug #59 #83 #84

Backwards right arcs would have the left PID go the wrong direction.

* #49 #59 #65 #84

All functions that have a parameter using okapi units has the ability to be called without using okapi units.

Fixed relative bug that would stop a swing from working off of a turn

Naming convention was fixed on setting constants.

Forward and Reverse PID for swings was implemented.

* namespaced all classes, removed piston group. #50 #54

* Added PID Tuner #85

* PID Tuner can modify increments #85 #86 #87

PID Tuner:
- printing to brain can now be toggled
- won't enable autonselector if it wasn't on prior to enabling PID Tuner
- user can set all increments
- user can get all increments
- renamed functions to be compliant with #65

Completed #86 and #87

* Cleaned example files

* Added example project to this repo and made v3 template

* Final update for 3.0.0 #65

* Squashed commit of the following:

commit 600bc47
Author: Jess Zarchi <[email protected]>
Date:   Sun Jan 28 23:53:53 2024 -0800

    Removed 2.x files

commit 6f6c701
Author: Jess Zarchi <[email protected]>
Date:   Sun Jan 28 23:45:42 2024 -0800

    v3.0.0 (#88)

    * Fixed rotation sensor tick per rev (#47)

    * middle step for #49 and #54

    * Added piston groups (#54)

    * Completed small issues (#56, #55, $54, #52, #48)

    * Finished with clean up on constants

    * Added set ratio function

    * Added practice mode

    * Updated PROS Kernel, okapi, fixed #53, general cleaning

    * ✨Okapi units (#49, #62)

    * ✨ Added `set_relative_turn_pid()` (#59)

    * issue #59 - add set_relative_turn_pid function, no issue - fix various cases of wrong function documentation

    * issue #59 - set_relative_turn_pid changed casing of variables to snake_case and made it relative to current target, not current heading

    * Fixed issue #67

    * ✨Okapi units

    * New function names #65

    * Added okapi units to turns and time, tuned PID, cleaned code, completed #66

    * Fixed some names, added `get` functions #73

    * Added more gets, removed version # from print  #73

    The version number in `ez_template_print` was redundant when version can be checked through pros cli.

    * ⬆️ Update Kernel/Okapi to 3.8.0 and 4.8.0 Respectively  (#76)

    * Memory optimisation and comments:
    when a function is static, it doesn't need to exist for every object. Since this function does not reference any internal variables, it can be static

    * Maybe I was wrong

    * add new website code

    * added running the site locally

    * kernel upgrade

    * Update Kernel/Okapi

    ---------

    Co-authored-by: Michael Barr <[email protected]>
    Co-authored-by: Asik007 <[email protected]>
    Co-authored-by: Sylvie <[email protected]>

    * Added Ability for user to reverse Drive in opcontrol (#80)

    * Update drive.hpp

    weird changes

    * Added Reversal to opcontrol driving

    * mistake deleting active break logic, added back

    * Removed old website, updated readme

    * Completed #82, fixed formatting

    * Cleaned relative turns, added wide swings #59 #83

    * Added slew to turns and swings, fixed wide arc bug #59 #83 #84

    Backwards right arcs would have the left PID go the wrong direction.

    * #49 #59 #65 #84

    All functions that have a parameter using okapi units has the ability to be called without using okapi units.

    Fixed relative bug that would stop a swing from working off of a turn

    Naming convention was fixed on setting constants.

    Forward and Reverse PID for swings was implemented.

    * namespaced all classes, removed piston group. #50 #54

    * Added PID Tuner #85

    * PID Tuner can modify increments #85 #86 #87

    PID Tuner:
    - printing to brain can now be toggled
    - won't enable autonselector if it wasn't on prior to enabling PID Tuner
    - user can set all increments
    - user can get all increments
    - renamed functions to be compliant with #65

    Completed #86 and #87

    * Cleaned example files

    * Added example project to this repo and made v3 template

    * Final update for 3.0.0 #65

    ---------

    Co-authored-by: HakopZarikyan <[email protected]>
    Co-authored-by: Michael Ben-Zvi <[email protected]>
    Co-authored-by: Will Xu <[email protected]>
    Co-authored-by: Michael Barr <[email protected]>
    Co-authored-by: Asik007 <[email protected]>
    Co-authored-by: Sylvie <[email protected]>
    Co-authored-by: Will Xu <[email protected]>
    Co-authored-by: Mactar Gueye <[email protected]>

* Fixed small bugs, refactoring #89, #90, #91, #92)

* Fixed typo in comment, updated readme

* Upgraded kernel, ready for v3.0.1 release

---------

Co-authored-by: HakopZarikyan <[email protected]>
Co-authored-by: Michael Ben-Zvi <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Michael Barr <[email protected]>
Co-authored-by: Asik007 <[email protected]>
Co-authored-by: Sylvie <[email protected]>
Co-authored-by: Will Xu <[email protected]>
Co-authored-by: Mactar Gueye <[email protected]>
  • Loading branch information
9 people authored Apr 2, 2024
1 parent 1fcf7c8 commit 6b1c8ea
Show file tree
Hide file tree
Showing 34 changed files with 946 additions and 545 deletions.
17 changes: 17 additions & 0 deletions EZ-Template-Example-Project/.gitignore
Original file line number Diff line number Diff line change
@@ -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/
Binary file not shown.
Binary file not shown.
Binary file modified EZ-Template-Example-Project/firmware/EZ-Template.a
Binary file not shown.
Binary file modified EZ-Template-Example-Project/firmware/libpros.a
Binary file not shown.
25 changes: 10 additions & 15 deletions EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down Expand Up @@ -1305,31 +1305,26 @@ 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<const_and_name> 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();
void pid_tuner_print_terminal();
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
Expand Down
8 changes: 4 additions & 4 deletions EZ-Template-Example-Project/include/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand All @@ -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"
Expand All @@ -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_
85 changes: 85 additions & 0 deletions EZ-Template-Example-Project/include/pros/gps.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
Loading

0 comments on commit 6b1c8ea

Please sign in to comment.