text
stringlengths 0
715
|
---|
int32_t
|
priority
|
)
|
Sets the priority of the current thread.
|
Parameters
|
priority
|
The priority of the thread to be set to.
|
◆ priority()
|
int32_t vex::this_thread::priority
|
(
|
)
|
Gets the priority of the current thread.
|
Returns
|
Returns the priority of the current thread as an integer.
|
________________
|
Full Spin Up Code
|
/*----------------------------------------------------------------------------*/
|
/* */
|
/* Module: main.cpp */
|
/* Author: VEX */
|
/* Created: Thu Sep 26 2019 */
|
/* Description: Competition Template */
|
/* */
|
/*----------------------------------------------------------------------------*/
|
// ---- START VEXCODE CONFIGURED DEVICES ----
|
// Robot Configuration:
|
// [Name] [Type] [Port(s)]
|
// Controller1 controller
|
// Flywheel motor_group 1, 2
|
// LeftMotors motor_group 3, 4
|
// RightMotors motor_group 5, 6
|
// RightEncoder encoder A, B
|
// LeftEncoder encoder C, D
|
// BackEncoder encoder E, F
|
// Intake motor 7
|
// Indexer motor 8
|
// Wings digital_out G
|
// Optical optical 9
|
// VisionSensor vision 10
|
// Inertial1 inertial 19
|
// Inertial2 inertial 20
|
// LineTracker line H
|
// Motor motor 11
|
// ---- END VEXCODE CONFIGURED DEVICES ----
|
//neccessary stuff
|
#include "vex.h"
|
#include <iostream>
|
#include <cmath>
|
#include <vector>
|
#include <cstdlib>
|
using namespace vex;
|
competition Competition;
|
//global variables
|
int flywheelLastPos = 0; //the last position of the flywheel in degrees, based on the internal motor encoders
|
int flywheelTargetRPM = 1800; //the target RPM of the flywheel
|
bool flywheelOn = false; //true or false, whether or not the flywheel is on right now
|
bool auton = false; //whether or not the robot is being controlled autonomously
|
float driveSpeed = 1.0f; //driving (forward and backward) speed of the robot
|
float turnSpeed = .7f; //turning speed of the robot
|
int drawMode = 0; //what to draw on the brain screen? 0: flywheel 1: PID 2: vision sensor 3: status update 4: odom
|
int tempDrawMode = 0; //store the previous draw mode temporarily
|
bool useTBH = true;//controls how the flywheel speed is updated
|
int overHeatingTimer = 0; //keeps track of how often to display an overheating warning
|
bool firstCross = false; //whether or not the first cross of the target RPM line has occured yet
|
int autonType = 1; //the type of autonomous to use
|
float driveDistance = 0; //drive distnace for drive PID
|
bool opticalMode = false;//whether or not the optical sensor dictates when discs are shot.
|
double gain = 0.000143; //was 0.00013 before, the gain variable for TBH velocity control
|
double defaultGain = 0.000143; //the default gain, was .000143
|
bool visionAlign = false; //whether or not to align to the goal using the vision sensor
|
bool visionTrackRed = true; //whether or not to track red objects as the goal
|
bool visionTrackBlue = true; //whether or not to track blue objects as the goal
|
float speedPID = 1; // the speed to run the motors at in PID loops, range is0-1
|
bool tripleShooting = false; //whether or not a triple shot is active
|
float motorPowerApprox = 0.61; //default guess for the motor power, for 1800 rpm, for the flywheel
|
//odometry constants
|
float pos[2] = {0, 0}; //x and y global position of the robot
|
float angle = 0; //the angle of the robot relative to the starting angle, in radians
|
float sideWheelRadius = 4.8258328 * 3633.0 / 3600; //in inches, the distance between each side wheel and the tracking center, 4.8125
|
//above, it was 4.8623 for the first half of the second week of summer camp
|
float backWheelRadius = 1; //in inches, the distance between the back wheel and the tracking center
|
int prevLeftEncoder = 0;//the previous reading of the left encoder, in degrees
|
int prevRightEncoder = 0;//the previous reading of the right encoder, in degrees
|
int prevBackEncoder = 0; //the previous reading of the back encoder, in degrees
|
//helper functions
|
void printController(float i) {
|
//prints a number to the controller console (very handy for debugging)
|
Controller1.Screen.clearLine(3);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.