Introducing JAR-Template: A Vexcode Pro Library featuring Custom PID and Odometry

@JT_39599B @dat_VEX_guy I believe I have a fix for the PL Access Error. Ultimately this was a dumb oversight on my part, and I apologize for the inconvenice. This bug will be fixed in the next release along with all the others.

The fix is to change lines 24 and 25 in src/JAR-Template/drive.cpp, which read

E_ForwardTracker(ThreeWire.Port[ForwardTracker_port-1]),
E_SidewaysTracker(ThreeWire.Port[SidewaysTracker_port-1])

to

E_ForwardTracker(ThreeWire.A),
E_SidewaysTracker(ThreeWire.A)

This fix will work for anyone using rotation sensors in an odometry setup.

The underlying issue here is that a rotation sensor port can be outside the range of values accepted by the ThreeWire object, which causes the PL Access error. So just changing them to valid ThreeWirePorts should work fine.

Thank you for bringing this bug to my attention, and happy coding.

Hello, I am very new to coding, I have previously used the right joystick to control forwards and back, and used the left joystick to control turning while in driver control is this inherently bad for any reason and can I use this method of control in the template(though editing tank drive?)

Yeah that’s totally cool. It’s not built in, but if you want to switch up the joysticks, go to

void Drive::control_arcade

and edit the Axes of the joysticks listed until you get the result you want. Let me know if you need any more help.

Is there any configuration available for a sideways tracker and using motor values for forward/backwards.

Currently, there is no configuration for that setup, and it is not planned in the future. You can attach a rotation sensor to the drivetrain for the same effect (but more accuracy).

Hey… any chance this will function correctly with the new 5.5-watt motors? Because my team transitioned from a 66-watt drive to a 55-watt drive to conserve motors, and suddenly the robot is doing some weird stuff with the chassis.drive_distance function. More specifically, it drives about an inch before turning to the right about 30 degrees. I haven’t changed anything else in the code, and haven’t screwed with the inner workings of the JAR-Template either.

Hey. So I’m not sure if this has been the situation for long, but after attempting to use JAR I instantly took note of the fact that the basic Vex V5 Pro code says it is no longer being updated, to make this worse the first step given for JAR in the file says to use UI elements that are not available in the VS Code extension. Does anyone know if this is a major issue, or if this has already been resolved.

Shouldn’t be too big of a deal. Just go into robot-config.h and robot-config.cpp and add in your motors manually.

Are there any variables built into this template for tuning PID? If not, are there any values in particular that you would recommend altering for tuning? My initial thought was to adjust the settle time calculation but I wondered if you had any alternatives.

Is there any way to test the autons? I have one autonomous coded but have no way to see if any of the measurements or values are correct.

Is there way to used the GPS sensor instead of encoder

Yes, the PID constants and exit conditions are at the top of autons.cpp.

You can either change the auton under slot one in the auton selector to be yours, or write your test in drive_test() in autons.cpp.

No.

Hi Josh I recently saw your team at RiverBots ll and was very intrigued to see your prog skills run that got you in the top 10 rank. I had a few questions regarding the JAR template you created.

  1. Is this program what you utilize in your skills and autonomous?

  2. I am fairly new to programming and wondered where to program my autonomous code.

  3. Do I need multiple programs for my different autons or can all my autons be in this one program?

  4. Where do I set up my code for my driver control, for example, we utilize an elevated shooter system much similar to yours and were wondering how to set up functions such as my intake.

I would appreciate it if you could provide marked-up pictures for some of the questions answers, only if it is not a big inconvenience to you.

I’m in college now, but I can answer questions about 2775V to the best of my ability.

  1. Yeah they used JAR template.

  2. In autons.cpp, you can either mess with the current autons (with names like drive_test) or pattern match and make your own.

  3. There is a basic auton selector inbuilt, so all your autons should be in one project.

  4. In main.cpp, in the usercontrol function.

Most questions you might have are answered by skimming through the main.cpp file.

What is your recommendation for using JAR to tune a flywheel PID?

I would make a bang-bang controller on your own. JAR PID isn’t great for velocity control.

how does the auton selector work?