globals and driver control w/ lem

This commit is contained in:
ary 2024-01-12 18:24:38 -05:00
parent 38952fc102
commit 833d14aee5
3 changed files with 24 additions and 9 deletions

View File

@ -1,12 +1,23 @@
#pragma once #pragma once
// CONSTANTS DEFINITIONS /* Ports */
#define PORT_LF 11
#define PORT_LM 13
#define PORT_LB 12
#define PORT_RF 1
#define PORT_RM 4
#define PORT_RB 3
/* Chassis constants*/
#define HORIZONTAL_TW_OFFSET 1.0 #define HORIZONTAL_TW_OFFSET 1.0
#define VERTICAL_TW_OFFSET 1.0 #define VERTICAL_TW_OFFSET 1.0
#define CHASSIS_TRACK_WIDTH 12.5 #define CHASSIS_TRACK_WIDTH 12.5
#define CHASSIS_RPM 450 #define CHASSIS_RPM 450
#define CHASE_POWER 2 #define CHASE_POWER 2
/* Drive constants */
#define DRIVE_GAIN 1.0
#include "main.h" #include "main.h"
namespace globals { namespace globals {

View File

@ -6,15 +6,15 @@ using namespace lemlib;
namespace globals { namespace globals {
pros::Controller master(pros::E_CONTROLLER_MASTER); pros::Controller master(pros::E_CONTROLLER_MASTER);
pros::Motor left_front(1, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_LF(PORT_LF, pros::E_MOTOR_GEARSET_06, true);
pros::Motor left_middle(2, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_LM(PORT_LM, pros::E_MOTOR_GEARSET_06, true);
pros::Motor left_back(3, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_LB(PORT_LB, pros::E_MOTOR_GEARSET_06, true);
pros::Motor right_front(4, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_RF(PORT_RF, pros::E_MOTOR_GEARSET_06, false);
pros::Motor right_middle(5, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_RM(PORT_RM, pros::E_MOTOR_GEARSET_06, false);
pros::Motor right_back(6, pros::E_MOTOR_GEARSET_06, false); pros::Motor motor_RB(PORT_RB, pros::E_MOTOR_GEARSET_06, false);
pros::Motor_Group left_drive({ left_front, left_middle, left_back }); pros::Motor_Group left_drive({ motor_LF, motor_LM, motor_LB });
pros::Motor_Group right_drive({ right_front, right_middle, right_back }); pros::Motor_Group right_drive({ motor_RF, motor_RM, motor_RB });
pros::Imu imu(7); pros::Imu imu(7);

View File

@ -28,6 +28,10 @@ void autonomous() {}
void opcontrol() { void opcontrol() {
while (true) { while (true) {
int leftY = globals::master.get_analog(pros::E_CONTROLLER_ANALOG_LEFT_Y);
int rightY = globals::master.get_analog(pros::E_CONTROLLER_ANALOG_RIGHT_Y);
globals::chassis.tank(leftY, rightY, DRIVE_GAIN);
pros::delay(20); pros::delay(20);
} }
} }