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

What is JAR-Template?

JAR-Template is a simple and powerful VexCode Pro V5 library featuring PID, odometry, and custom motion algorithms for precise autonomous programming. It is modeled after EZ-Template, but includes more features like the odometry class and drive-to-point functions.

The goal of JAR-Template is for teams to be able to have a brand new robot running autonomous functions within just 15 minutes. Like EZ Template, users input motor and gyro ports, with the option to enter parameters for odometry as well.

As of right now, JAR-Template supports 7 drive setups: zero tracker, one encoder tank, two encoder tank, one rotation tank, two rotation tank, two encoder holonomic, and two rotation holonomic.

How can I use JAR-Template?

Visit the GitHub page where all the code is hosted. Follow the instructions to download the .zip file and open it in Vexcode Pro. JAR-Template does not support PROS or Vexcode Blocks/Python.

How can I give feedback?

Visit this Google Form to give feedback on suggestions and potential improvements to the template. As this project is in its Beta stage, I strongly request you fill out the google form if you choose to use the code. You can help improve the code and have your name on the GitHub page as a Beta tester.

Feel free to ask questions, report bugs, or make suggestions at any time. My discord is jo$h#9834 or Josh | 2775V on VTOW.

49 Likes

Thank you so much for providing this template to the community. I’m sure this will quell some of the questions about PID that are being posted on the forum. I’ll be sure to give feedback!

2 Likes

Great contribution to the community! I will definitely have our programmer take a look at this. He’s been wanting to do odometry.

1 Like

Hey!

I am a programmer from VIQC, and I was wondering if I had your permission to rewrite this for VexIQ and release it, if you do allow could you also describe how I should cite you, (link socals, tag, whatever).

Thanks for such a great Library!
Blaziumm

1 Like

You should choose a license for this code.

Otherwise.

the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work.

15 Likes

Thanks! Clearly I have a lot to learn about releasing code. I chose to license my repository under the MIT license. I think all I had to do was add in the LICENSE.md file, but I’m not sure if there are more steps I should take. @Blaziumm under this license there are only two requirements in copies or derivatives of the code: the original copyright notice and a copy of the license itself. So feel free to rewrite it however you see fit. I’d really appreciate it if you mentioned that your code is a derivative of or a modification to JAR-Template, but as far as I can tell, that’s not required.

3 Likes

I am aware of that, and it is under an MIT License, however, I just like to ask just to make sure, as I feel it is the right thing to do, and making sure that I give the original the credit as they wish, I would rather someone credit my main github then the one I use for vex, and I fully support any developer’s choice.

2 Likes

To avoid being repetitive, I’ll just drop this here…

In all seriousness, well done, gentlemen. Stuff like this will only elevate future generations of roboticists.

4 Likes

Asking for clarification- are teams permitted to use this library for Vex VRC competitive robot programs? Or is this something intended for recreation/reference only (and/or explicitly banned in a rule book, as I cannot remember anything concerning usage of libraries within the rulebook). Thank you!

Teams are permitted to use it.

4 Likes

Something to add to this: make sure that you check the following link (https://kb.roboticseducation.org/hc/en-us/articles/5449868745367-Student-Centered-Policy-reference-for-EPs-) and read through it, as it discusses how to handle usage of libraries in VEX robotics.

Yes, you can use this for competition.

2 Likes

Hi!
Just found and set up this code on my four motor, two rotation sensor drivetrain and I have a couple issues:

  1. After pouring over the readme, I still have no idea how to enable autonomous to run a example program
  2. Several PL Access and Memory permission errors present themselves when using a controller, and this is tied to something about the arcade controls declared in user control.
  3. Does the tank drive two rotation sensors imply the use of one parallel rotation sensor and one perpendicular? Or both parallel?

Thank you so much for making this in the first place.

Send me your code exported as a zip, and I’ll have a look.

I am getting similar PL access errors. Any solution yet?

Again, I’d be happy to look at the code that’s causing errors.

1 Like

All the one sensor options imply a forward/backward tracker, and all the two sensor options imply two perpendicular trackers.

3 Likes

v5code-project-JAR-Template.zip (54.8 KB)
Some info that may or may not help. I am using a 6 motor drive, and one tank drive rotation. I do not wish to use position tracking so I just left the rest of the position tracking variables as they are, as said to do if position tracking is not used. Right now I don’t have anything past the testing autons set up, because I wanted to just compile the program and see the values printed to the screen so I could tune.


Here is the message of the error. This message only seems to happen when the controller is connected. When the controller is off/disconnected, the screen just says Drive Test.

I’m sure there is some simple solution/problem in the code that I’m not seeing. Thank you by the way for creating this, and helping out.

The only glaring issue is that you’ve set your drive style to TANK_ONE_ROTATION but don’t intend to use odometry. I suspect that switching your drive setup to ZERO_TRACKER will fix this issue. TANK_ONE_ROTATION is only meant to be used on robots with external tracking wheels that will use odometry. In the next release, I will make the drive setup names less ambiguous and provide clear documentation, and also add support for a lot more drive setups.

The reason this is a problem is that the Drive constructor will look for a rotation sensor using “PORT1” format, but the default sensor there is just in “1” format. If switching to ZERO_TRACKER doesn’t fix the issue, let me know and I’ll get a robot and try to replicate the issue.

@dat_VEX_guy if you can debug your code using this post, great. If not, send me your code and I can look at it.

4 Likes

Hello, thanks for the response. Unfortunately, this doesn’t seem to have changed it. I still get the same error. Thanks for clarifying about the drive type, I misunderstood it as a tank drive with a single rotation/inertial sensor on it, but that makes sense now. Thank you for helping.