First I added comments to all the new systems.
Second I finished all the color sorter code, like finishing the function to call when you want to look for a color. Next we had the scotts county competition so I made custom auton routes for us to run at the competition. These will be changed later.
This commit is contained in:
1 parent
c9f7db1011
commit
3bbad07dea
8 files changed
+671
-64
No files matched your search
@@ -6,12 +6,16 @@
|
||||
#include "pros/colors.hpp"
|
||||
|
||||
namespace ez {
|
||||
|
||||
/**
|
||||
* Structure to hold two optical sensor pointers.
|
||||
*/
|
||||
struct OpticalSensors {
|
||||
pros::Optical* leftColorSensor;
|
||||
pros::Optical* rightColorSensor;
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration to hold colors we want to select.
|
||||
*/
|
||||
enum wanted_color {
|
||||
red,
|
||||
blue,
|
||||
@@ -19,32 +23,45 @@ namespace ez {
|
||||
green,
|
||||
purple
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration to hold the two different time of a match.
|
||||
*/
|
||||
enum control_period {
|
||||
driver,
|
||||
auton
|
||||
};
|
||||
|
||||
/**
|
||||
* Color sensor class
|
||||
*/
|
||||
class ColorSensors {
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
int led_brightness;
|
||||
|
||||
ColorSensors();
|
||||
|
||||
/**
|
||||
*
|
||||
* \param sensorNum
|
||||
* Creates a color sorter to allow you to detect colors with sensors
|
||||
*
|
||||
* \param c_sensor
|
||||
* the sensor we want to use for the reading
|
||||
* \param period
|
||||
* the current control period where in
|
||||
* \param selected_color
|
||||
* the color we want to look for
|
||||
* \param led_brightness
|
||||
* sets the how bright the leds are on the sensors
|
||||
* \param looped
|
||||
* do we want to continusly check for that color
|
||||
*/
|
||||
void color_sorter(const OpticalSensors& c_sensor, control_period period, wanted_color selected_color, bool looped);
|
||||
void color_sorter(pros::Optical* c_sensor, control_period period, wanted_color selected_color, int led_brightness, bool looped);
|
||||
|
||||
void DisplayColor();
|
||||
};
|
||||
/**
|
||||
* Declares a variable that can be used anywhere to access information
|
||||
* from inside the structure.
|
||||
*/
|
||||
extern OpticalSensors mySensors;
|
||||
};
|
||||
@@ -6,40 +6,60 @@
|
||||
#include "pros/motor_group.hpp"
|
||||
|
||||
namespace ez {
|
||||
|
||||
/**
|
||||
* Enumeration to hold the current part of a match were in.
|
||||
*/
|
||||
enum class ControlPeriodM {
|
||||
driver,
|
||||
auton
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration to hold the different controllers avalable.
|
||||
*/
|
||||
enum class ControllerM {
|
||||
master,
|
||||
slave
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration to hold the different buttons to use.
|
||||
*/
|
||||
enum class ButtonsM {
|
||||
arrow_buttons,
|
||||
Y_B_buttons,
|
||||
left_shoulder_buttons,
|
||||
right_shoulder_buttons
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration to hold all the motors and motor groups available
|
||||
*/
|
||||
enum class MotorGroups {
|
||||
lift_MG,
|
||||
claw_M,
|
||||
roller_M
|
||||
};
|
||||
|
||||
/**
|
||||
* Motor mechanism class
|
||||
*/
|
||||
class Mechanisms {
|
||||
|
||||
private:
|
||||
|
||||
public:
|
||||
float fw_motor_speed = 0;
|
||||
float rev_motor_speed = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
Mechanisms();
|
||||
|
||||
/**
|
||||
* Allows you to control your motors
|
||||
*
|
||||
* \param controlPeriodM
|
||||
* The current control period were in
|
||||
*
|
||||
*
|
||||
*/
|
||||
void motor_control(enum ControlPeriodM, enum ControllerM, enum ButtonsM, enum MotorGroups, float fw_motor_speed, float rev_motor_speed);
|
||||
|
||||
float get_motor_speed();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "EZ-Template/piston.hpp"
|
||||
|
||||
namespace ez {
|
||||
/**
|
||||
/**
|
||||
* Enumeration to hold the current part of a match were in.
|
||||
*/
|
||||
enum class ControlPeriodP {
|
||||
@@ -37,7 +37,6 @@ namespace ez {
|
||||
};
|
||||
|
||||
class Pneumatics{
|
||||
|
||||
private:
|
||||
bool pistonState;
|
||||
|
||||
|
||||
+8
-8
@@ -5,14 +5,14 @@ void default_constants();
|
||||
/**
|
||||
* Personal auton routes
|
||||
*/
|
||||
void leftMain(std::string side);
|
||||
void rightMain(std::string side);
|
||||
void Skills();
|
||||
void BlueRight();
|
||||
void BlueLeft();
|
||||
void RedRight();
|
||||
void RedLeft();
|
||||
void testMain(std::string side);
|
||||
void quick_right_blue();
|
||||
void quick_right_red();
|
||||
void blue_left_3pin();
|
||||
void blue_right_4pin();
|
||||
void blue_right_3pin();
|
||||
void red_left_3pin();
|
||||
void red_right_3pin();
|
||||
void red_right_4pin();
|
||||
void Test();
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user