Just a few coding questions

Ok, I am still very new to coding despite what I want to think. Although most of these questions have probably been answered(Master DRow pls don’t lock ;).) I still have a few questions about coding that I either don’t know the answer to at all or am just not sure.

  1. What exactly is a PID?

  2. What exactly is 2D Motion profiling and what benefit does it give?

  3. Are vision sensors, inertial sensors, gyros, limit switches, bumper switches, etc. important and helpful for autonomous programming and worth the investment.

  4. How exactly do you code mecanum wheels for auton?(Probably a dumb question lol)

  5. Is an autonomous selector on my brain worth the time?

  6. Lastly, since I don’t know the answers to these questions, do I need to be using PROS or VEXCode?

Thank you guys so much in advance and please don’t ignore this, :slight_smile:

Sorry, I forgot another one lol

  1. What are counts in PROS? Like when you change a motor’s way of tracking motion.

I can help answer #4, #5, and #6 for you.

For coding mecanum wheels, the first thing to do is to make sure that they are put on correctly. The direction of the “spikes” of the wheels should be making an X. To move in the direction you want, you spin the wheels in the direction you want to go and on the other side, you spin them out. Here’s some sample code that used buttons and joysticks and here’s a visual from a while ago:

if(vexRT[Btn8U] == 1){
	 setMultipleMotors(speed, frontRight, backRight, frontLeft, backLeft);
}
else if(vexRT[Btn8D] == 1){
	setMultipleMotors(-speed, frontRight, backRight, frontLeft, backLeft);
}
else if(vexRT[Btn8L] == 1){
	setMultipleMotors(speed, frontRight, backLeft);
	setMultipleMotors(-speed, frontLeft, backRight);
}
else if(vexRT[Btn8R] == 1){
	setMultipleMotors(-speed, frontRight, backLeft);
	setMultipleMotors(speed, frontLeft, backRight);
}
else if(vexRT[Btn7L] == 1){
	setMultipleMotors(speed, frontRight, backRight);
	setMultipleMotors(-speed, frontLeft, backLeft);
}
else if(vexRT[Btn7R] == 1){
	setMultipleMotors(-speed, frontRight, backRight);
	setMultipleMotors(speed, frontLeft, backLeft);
}
else{
	motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
	motor[backRight] =  vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
	motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
	motor[backLeft] =  vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
}

Mech Drive Rotations

I’ve never used an autonomous selector myself. What I’ve done is just upload programs to different slots and rename them after I got the right auton selected. I did this by using defines and #ifdef statements in my code to get the correct one. But if you have time for one, go for it, just don’t make it your first priority.

As to what API you should use. I prefer PROS because I think it’s simpler to code in. The API has more features than VEXcode I think. The way it’s structured makes much more sense. It also has great command line tools if you want to use your own editor, or you can use the one it comes with. VEXcode is not finished in my opinion and lacks many features.

1 Like
  1. Vision sensors - I’ve heard people say that it’s hard to use (but I’ve never actually used it)
  2. Inertial/Gyros - Basically it tracks turning… but it isn’t very accurate. The best way I’ve seen people use it, is with a combination of a gyro and PID
  3. Limit/bumper switches - these are probably the easiest to code and most people use it to detect if a lift is down or up.
  4. Encoders - You can use these to make tracking wheels (check 5225a’s design) for cool programming things like odometry. (and if you set these up well, you probably won’t need other sensors like a gyro)
1 Like

1 http://georgegillard.com/documents/2-introduction-to-pid-controllers
https://www.youtube.com/watch?v=wkfEZmsQqiA&list=PLn8PRpmsu08pQBgjxYFXSsODEF3Jqmm-y
PID is a feedback control systems with 3 parts: proportion, integral, and derivative
essentially what it does, is the farther away you are from your endpoint, the faster you go, meaning you have a nice decceleration curve meaning you won’t overshoot.

2 https://www.youtube.com/watch?v=8319J1BEHwM
https://docs.google.com/presentation/d/1xjtQ5m3Ay4AYxS_SfloF2n_vWZnCU25aXZuu9A59xPY/pub?start=false&loop=false&delayms=3000&slide=id.g76b62f478_0_75
These are FRC teams, which is a completely different competition, but these helped me tremendously. It’s a long video, but you probably have a lot of time on your hands with quarantine and all.
6 I don’t have any experience with PROS because I actually do IQ, but it’s probably your best bet if you’re doing vrc. A lot of stuff in the Okapi library does these things for you, like splines.

lastly, heres some stuff about odometry, you didn’t ask, but I thought it would be a good idea to link


This pdf is pretty confusing, so here’s two videos to help parse it.

3 Likes