Probably should have had a better name for this, but it’s fine, right? Anyways, I am the programmer for 8613A and I was trying to figure out some robot movement for the GPS(we are waiting for the strip thingy to show up). And I was wondering if some much better coders look at this for me?(I am new to not only c++ but I have been on a robotics team for not even a year). I really want to know if this code is actually good or not. If you want, you could ask for further explanation of the code. Here it is:
#include "vex.h"
using namespace vex;
double solveForAngle(int targetY, gps G){//Creates the angle used for rotation heading
double b;
double beta;
double x = G.xPosition(vex::distanceUnits::in);
double y = G.yPosition(vex::distanceUnits::in);
double Hy = sqrt((x*x) + (y*y));//Hypotenuse
return(Hy);
}
void MoveToSq(gps G, int tile [0][1], motor Fl, motor Fr, motor Bl, motor Br){
G.resetRotation();
//setting position
int x = tile[0][0] * 2;
int y = tile[1][0] * 2;
//getting robot position
double X = G.xPosition(vex::distanceUnits::in);
double Y = G.yPosition(vex::distanceUnits::in);
//other variables
//Use your turn function here
while(X != x && Y != y){
//drive function here
}
}