Programming the Integrated Encoders

Hello VEX VRC and VEX-U teams!

Simulink makes it quick and easy to program the EDR to move a robot along a pre-defined path during the autonomous round. Essentially, you can use Simulink to program the encoders on the wheels with PID or state machines to control the distance and orientation of the robot pretty accurately.

Learn how to do this from the Simulink experts-

Also, on YouTube -

For using the example file, go to the documentation page here -

What challenges do yo have when programming to control your robot with Integrated Encoders?

Get free access to MATLAB and SImulink for your team-

MathWorks (makers of MATLAB and Simulink)
Follow me @sandeepmath

Excellent for educational use, but don’t ever use IME’s for competition path planning and execution. They reset from static. Maybe MathWorks can get this to all work with the optical quadrature encoders?

The IME’s use the I2C interface that can pick up noise or electric static discharge (ESD), which could make them reset. One way to avoid this problem is to shield the I2C wiring using tin foil grounded to the chasee of your robot platform.

That is a good idea. Is tin foil legal for VRC? Or just VEXU.

I’m going to guess its technically ok for VRC use as its a commerically available item used, on the robot, for bundling, wrapping, protecting, and managing cables, but good luck getting that past tech inspection. (Best to ask on the offical Q&A section)

But why risk failing tech inspection when you can just get metal sleeves made for this very purpose?

True true. I was just asking since our robot design forced us to use an IME in one spot, but we are pretty worried about that.

In my experience, the worst offenders for static discharge are IMEs attached to motors that run close to the ground. In general, you’ll probably be okay if it’s attached to, say, a lift motor.

1 Like

Yes, the Simulink library for VEX EDR does contain a function block specifically for the VEX optical encoders. Here is the documentation on this encoder block:

The above example on IME sensors also mentions examples models that do the same path navigation task with optical shaft encoders. See the Other Things to Try section:

Does VEX sell metal sleeves?

It really bothers me how many ports get used up with quadrature encoders. If you use one on each side of the robot, that’s 4/12 ports used up. Any ultrasonic rangefinders? Any more quadrature encoders? You can only fit three more in in total (unless you figure a work-around for the problem with the ports), leaving you with 2 spots for other sensors. With a maximum of 5 quadrature encoders or ultrasonic rangefinders, you run out really fast. So I would far prefer to have the IMEs used as a general rule if it weren’t for the static issue.

Depending on the application you can use encoders in only 1 port and just configure it as a single wire encoder.

No, but metal sleeves should be allowed under <R7> L (similar to the aluminum foil, best to ask on the official Q&A before actually buying some and installing it onto your robot).

ok, good to know. Thanks. It’s an intake motor actually so its gonna be well above the ground most of the time.

The new V5 will fix all this, so it seems. We have had trouble with static on motors up the tower, not just low to the ground.