Skip to content

Commit

Permalink
⬆️3.2.0-beta.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ssejrog committed Nov 29, 2024
1 parent ff8b17c commit 5c25cb9
Show file tree
Hide file tree
Showing 11 changed files with 463 additions and 456 deletions.
Binary file not shown.
Binary file modified EZ-Template-Example-Project/firmware/EZ-Template.a
Binary file not shown.
19 changes: 12 additions & 7 deletions EZ-Template-Example-Project/include/EZ-Template/drive/drive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3129,16 +3129,16 @@ class Drive {
bool current_slew_on = false;
bool is_odom_turn_bias_enabled = true;
bool odom_turn_bias_enabled();
void odom_turn_bias_set(bool set);
void odom_turn_bias_enable(bool set);
double angle_rad = 0.0;
double global_track_width = 0.0;
bool odometry_enabled = true;
pose odom_target = {0, 0, 0};
pose odom_current = {0, 0, 0};
pose odom_second_to_last = {0, 0, 0};
pose odom_start = {0, 0, 0};
pose odom_target_start = {0, 0, 0};
pose turn_to_point_target = {0, 0, 0};
pose odom_target = {0.0, 0.0, 0.0};
pose odom_current = {0.0, 0.0, 0.0};
pose odom_second_to_last = {0.0, 0.0, 0.0};
pose odom_start = {0.0, 0.0, 0.0};
pose odom_target_start = {0.0, 0.0, 0.0};
pose turn_to_point_target = {0.0, 0.0, 0.0};
bool y_flipped = false;
bool x_flipped = false;
double odom_imu_start = 0.0;
Expand All @@ -3153,6 +3153,11 @@ class Drive {
pose l_pose{0.0, 0.0, 0.0};
pose r_pose{0.0, 0.0, 0.0};
pose central_pose{0.0, 0.0, 0.0};
double xy_current_fake = 0.0;
double xy_last_fake = 0.0;
double xy_delta_fake = 0.0;
double new_current_fake = 0.0;
bool was_odom_just_set = false;
std::pair<float, float> decide_vert_sensor(ez::tracking_wheel* tracker, bool is_tracker_enabled, float ime = 0.0, float ime_track = 0.0);
pose solve_xy_vert(float p_track_width, float current_t, float delta_vert, float delta_t);
pose solve_xy_horiz(float p_track_width, float current_t, float delta_horiz, float delta_t);
Expand Down
852 changes: 426 additions & 426 deletions EZ-Template-Example-Project/project.pros

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions EZ-Template-Example-Project/src/autons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ void default_constants() {
chassis.pid_heading_constants_set(11.0, 0.0, 20.0); // Holds the robot straight while going forward without odom
chassis.pid_turn_constants_set(3.0, 0.05, 20.0, 15.0); // Turn in place constants
chassis.pid_swing_constants_set(6.0, 0.0, 65.0); // Swing constants
chassis.pid_odom_angular_constants_set(5.0, 0.0, 60.0); // Angular control for odom motions
chassis.pid_odom_angular_constants_set(4.7, 0.0, 60.0); // Angular control for odom motions
chassis.pid_odom_boomerang_constants_set(3.5, 0.0, 35.0); // Angular control for boomerang motions

// Exit conditions
// https://ez-robotics.github.io/EZ-Template/tutorials/tuning_exit_conditions
chassis.pid_turn_exit_condition_set(80_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
chassis.pid_swing_exit_condition_set(80_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
chassis.pid_drive_exit_condition_set(80_ms, 1_in, 250_ms, 3_in, 500_ms, 500_ms);
chassis.pid_turn_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
chassis.pid_swing_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
chassis.pid_drive_exit_condition_set(90_ms, 1_in, 250_ms, 3_in, 500_ms, 500_ms);
chassis.pid_odom_turn_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 750_ms);
chassis.pid_odom_drive_exit_condition_set(90_ms, 1_in, 250_ms, 3_in, 500_ms, 750_ms);
chassis.pid_turn_chain_constant_set(3_deg);
Expand All @@ -42,7 +42,7 @@ void default_constants() {

// The amount that turns are prioritized over driving in odom motions
// - if you have tracking wheels, you can run this higher. 1 is the max
chassis.odom_turn_bias_set(0.5);
chassis.odom_turn_bias_set(0.9);

chassis.odom_look_ahead_set(10_in); // This is how far ahead in the path the robot looks at
chassis.odom_boomerang_distance_set(16_in); // This sets the maximum distance away from target that the carrot point can be
Expand Down
26 changes: 14 additions & 12 deletions EZ-Template-Example-Project/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,38 +108,40 @@ void autonomous() {
chassis.drive_sensor_reset(); // Reset drive sensors to 0
chassis.odom_pose_set({0_in, 0_in, 0_deg}); // Set the current position, you can start at a specific position with this
chassis.drive_brake_set(MOTOR_BRAKE_HOLD); // Set motors to hold. This helps autonomous consistency
chassis.drive_width_set(12.0_in); // You can measure this with a tape measure

/*
Odometry and Pure Pursuit are not magic
It is possible to get perfectly consistent results without trackers,
but it is also possible to have extremely inconsistent results without trackers.
When you don't use trackers, you need to:
It is possible to get perfectly consistent results without tracking wheels,
but it is also possible to have extremely inconsistent results without tracking wheels.
When you don't use tracking wheels, you need to:
- avoid wheel slip
- avoid wheelies
- avoid throwing momentum around (super harsh turns, like in the example below)
You can do cool curved motions, but you have to give your robot the best chance
to be consistent
*/

// Drive to 0, 24
chassis.pid_odom_set({{0_in, 24_in}, fwd, 110},
// Drive to 0, 30 and pass through 6, 10 and 0, 20 on the way, with slew
chassis.pid_odom_set({{{6_in, 10_in}, fwd, 110},
{{0_in, 20_in}, fwd, 110},
{{0_in, 30_in}, fwd, 110}},
true);
chassis.pid_wait();

// Turn to face 24, 24
chassis.pid_turn_set({24_in, 24_in}, fwd, 110,
// Turn to face -36, 48 with slew
chassis.pid_turn_set({-36_in, 48_in}, fwd, 110,
true);
chassis.pid_wait();

// Drive to 24, 24
chassis.pid_odom_set({{24_in, 24_in}, fwd, 110},
// Turn to face 36, 48 with slew
chassis.pid_turn_set({36_in, 48_in}, fwd, 110,
true);
chassis.pid_wait();

// Drive backwards through 0, 24 and stop at 0, 0
chassis.pid_odom_set({{{0_in, 24_in}, rev, 110},
// Drive to 0, 0 and pass through -6, 20 and 0, 10 on the way, with slew
chassis.pid_odom_set({{{-6_in, 20_in}, rev, 110},
{{0_in, 10_in}, rev, 110},
{{0_in, 0_in}, rev, 110}},
true);
chassis.pid_wait();
Expand Down
Binary file renamed [email protected][email protected]
Binary file not shown.
Binary file renamed [email protected][email protected]
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EXCLUDE_COLD_LIBRARIES:=
IS_LIBRARY:=1
# TODO: CHANGE THIS!
LIBNAME:=EZ-Template
VERSION:=3.2.0-beta.5
VERSION:=3.2.0-beta.6
# 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)))
Expand Down
8 changes: 4 additions & 4 deletions src/EZ-Template/drive/drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void Drive::drive_defaults_set() {
pid_heading_constants_set(11.0, 0.0, 20.0);
pid_turn_constants_set(3.0, 0.05, 20.0, 15.0);
pid_swing_constants_set(6.0, 0.0, 65.0);
pid_odom_angular_constants_set(5.0, 0.0, 60.0);
pid_odom_angular_constants_set(4.7, 0.0, 60.0);
pid_odom_boomerang_constants_set(3.5, 0.0, 35.0);
pid_turn_min_set(30);
pid_swing_min_set(30);
Expand All @@ -210,9 +210,9 @@ void Drive::drive_defaults_set() {
slew_swing_constants_set(3_in, 80);

// Exit condition constants
pid_turn_exit_condition_set(80_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
pid_swing_exit_condition_set(80_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
pid_drive_exit_condition_set(80_ms, 1_in, 250_ms, 3_in, 500_ms, 500_ms);
pid_turn_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
pid_swing_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 500_ms);
pid_drive_exit_condition_set(90_ms, 1_in, 250_ms, 3_in, 500_ms, 500_ms);
pid_odom_turn_exit_condition_set(90_ms, 3_deg, 250_ms, 7_deg, 500_ms, 750_ms);
pid_odom_drive_exit_condition_set(90_ms, 1_in, 250_ms, 3_in, 500_ms, 750_ms);

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0-beta.4
3.2.0-beta.6

0 comments on commit 5c25cb9

Please sign in to comment.