Skip to content

Commit

Permalink
run clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Aang099 committed Jul 28, 2024
1 parent 1db0acb commit 9b6e23c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
6 changes: 4 additions & 2 deletions include/controller/fusions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

namespace controllers {

template <typename Target, typename In, typename Out, typename = std::enable_if<Isomorphic<typeof(std::declval<Out> + std::declval<Out>), Out>>> // todo is this really necessary? Probably
template <typename Target, typename In, typename Out,
typename = std::enable_if<Isomorphic<typeof(std::declval<Out> + std::declval<Out>),
Out>>> // todo is this really necessary? Probably
class AdditiveFusionController : public Controller<Target, In, Out> {
static_assert(std::declval<Out>() + std::declval<Out>());
static_assert(std::declval<Out>() + std::declval<Out>());
Controller<Target, In, Out>&controller1, &controller2;
Out current;
public:
Expand Down
35 changes: 17 additions & 18 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* to keep execution time for this mode under a few seconds.
*/
void initialize() {
controllers::pidConfig<Length, Voltage> config{1, 2, 3};
controllers::PID<Length, Voltage> pid(config, 10_in);
controllers::Slewed<Length, Voltage> testSlewed(pid, 0.1_volt);
controllers::pidConfig<Length, Voltage> config {1, 2, 3};
controllers::PID<Length, Voltage> pid(config, 10_in);
controllers::Slewed<Length, Voltage> testSlewed(pid, 0.1_volt);
}

/**
Expand Down Expand Up @@ -59,21 +59,20 @@ void autonomous() {}
* task, not resume it from where it left off.
*/
void opcontrol() {
pros::Controller master(pros::E_CONTROLLER_MASTER);
pros::MotorGroup left_mg({1, -2, 3}); // Creates a motor group with forwards ports 1 & 3 and reversed port 2
pros::MotorGroup right_mg({-4, 5, -6}); // Creates a motor group with forwards port 5 and reversed ports 4 & 6
pros::Controller master(pros::E_CONTROLLER_MASTER);
pros::MotorGroup left_mg({1, -2, 3}); // Creates a motor group with forwards ports 1 & 3 and reversed port 2
pros::MotorGroup right_mg({-4, 5, -6}); // Creates a motor group with forwards port 5 and reversed ports 4 & 6

while (true) {
pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2,
(pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1,
(pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0); // Prints status of the emulated screen LCDs

while (true) {
pros::lcd::print(0, "%d %d %d", (pros::lcd::read_buttons() & LCD_BTN_LEFT) >> 2,
(pros::lcd::read_buttons() & LCD_BTN_CENTER) >> 1,
(pros::lcd::read_buttons() & LCD_BTN_RIGHT) >> 0); // Prints status of the emulated screen LCDs

// Arcade control scheme
int dir = master.get_analog(ANALOG_LEFT_Y); // Gets amount forward/backward from left joystick
int turn = master.get_analog(ANALOG_RIGHT_X); // Gets the turn left/right from right joystick
left_mg.move(dir - turn); // Sets left motor voltage
right_mg.move(dir + turn); // Sets right motor voltage
pros::delay(20); // Run for 20 ms then update
}
// Arcade control scheme
int dir = master.get_analog(ANALOG_LEFT_Y); // Gets amount forward/backward from left joystick
int turn = master.get_analog(ANALOG_RIGHT_X); // Gets the turn left/right from right joystick
left_mg.move(dir - turn); // Sets left motor voltage
right_mg.move(dir + turn); // Sets right motor voltage
pros::delay(20); // Run for 20 ms then update
}
}

0 comments on commit 9b6e23c

Please sign in to comment.