Made a new pneumatics class and implemented it in driver control, also made a few different classes for the rotation sensors. Got all the rotation classes implemented with connection to the physical rotation sensors and the motors. Added another controller to be implemented later.
This commit is contained in:
1 parent
bd0e77e240
commit
b7af93220d
14 files changed
+452
-101
No files matched your search
+41
-11
@@ -1,15 +1,16 @@
|
||||
#include "main.h"
|
||||
|
||||
/////
|
||||
// For installation, upgrading, documentations, and tutorials, check out our website!
|
||||
// https://ez-robotics.github.io/EZ-Template/
|
||||
/////
|
||||
// Global Variables
|
||||
Pneumatics pistonControl;
|
||||
ArmMech armObj;
|
||||
LiftMech liftObj;
|
||||
WristMech wristObj;
|
||||
|
||||
// Chassis constructor
|
||||
ez::Drive chassis(
|
||||
// These are your drive motors, the first motor is used for sensing!
|
||||
{-5, -6, -7, -8}, // Left Chassis Ports (negative port will reverse it!)
|
||||
{11, 15, 16, 17}, // Right Chassis Ports (negative port will reverse it!)
|
||||
{-1, -2}, // Left Chassis Ports (negative port will reverse it!)
|
||||
{3, 4}, // Right Chassis Ports (negative port will reverse it!)
|
||||
|
||||
21, // IMU Port
|
||||
3.25, // Wheel Diameter (Remember, 4" wheels without screw holes are actually 4.125!)
|
||||
@@ -23,6 +24,27 @@ ez::Drive chassis(
|
||||
ez::tracking_wheel horiz_tracker(8, 2.75, 4.0); // This tracking wheel is perpendicular to the drive wheels
|
||||
// ez::tracking_wheel vert_tracker(9, 2.75, 4.0); // This tracking wheel is parallel to the drive wheels
|
||||
|
||||
// Arm constructor
|
||||
ArmMech armSetup(
|
||||
|
||||
{0, 300},
|
||||
|
||||
2);
|
||||
|
||||
// Lift constructor
|
||||
LiftMech liftSetup(
|
||||
|
||||
{0, 100, 200},
|
||||
|
||||
3);
|
||||
|
||||
// Wrist constructor
|
||||
WristMech wristSetup(
|
||||
|
||||
{0, 100},
|
||||
|
||||
2);
|
||||
|
||||
/**
|
||||
* Runs initialization code. This occurs as soon as the program is started.
|
||||
*
|
||||
@@ -35,6 +57,16 @@ void initialize() {
|
||||
|
||||
pros::delay(500); // Stop the user from doing anything while legacy ports configure
|
||||
|
||||
armRotation.reset_position();
|
||||
pros::Task liftControlTasck([&]{
|
||||
while (true) {
|
||||
armObj.arm_control();
|
||||
liftObj.lift_control();
|
||||
wristObj.wrist_control();
|
||||
pros::delay(10);
|
||||
}
|
||||
});
|
||||
|
||||
// Look at your horizontal tracking wheel and decide if it's in front of the midline of your robot or behind it
|
||||
// - change `back` to `front` if the tracking wheel is in front of the midline
|
||||
// - ignore this if you aren't using a horizontal tracker
|
||||
@@ -250,7 +282,9 @@ void opcontrol() {
|
||||
// Gives you some extras to make EZ-Template ezier
|
||||
ez_template_extras();
|
||||
|
||||
// Place to call custom functions for driver control
|
||||
// Call custom drive functions here
|
||||
pistonControl.control_piston(Pistons::claw_piston, ControlPeriod::driver,
|
||||
Controller::master, Buttons::arrow_buttons);
|
||||
|
||||
// chassis.opcontrol_tank(); // Tank control
|
||||
chassis.opcontrol_arcade_standard(ez::SPLIT); // Standard split arcade
|
||||
@@ -258,10 +292,6 @@ void opcontrol() {
|
||||
// chassis.opcontrol_arcade_flipped(ez::SPLIT); // Flipped split arcade
|
||||
// chassis.opcontrol_arcade_flipped(ez::SINGLE); // Flipped single arcade
|
||||
|
||||
// . . .
|
||||
// Put more user control code here!
|
||||
// . . .
|
||||
|
||||
pros::delay(ez::util::DELAY_TIME); // This is used for timer calculations! Keep this ez::util::DELAY_TIME
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user