Beginner IME Programming on C++

I’m aware that there are many posts about IME coding, but I’m hoping someone can refer me to a step by step tutorial on how to code a driving autonamous with IMEs in Vexcode C++.
Thanks in advance!

By IME I am assuming you mean an internal motor encoder. An IME is a sensor and as such it is not as simple as just programming it. In order to make IMEs work for your auton you will need an algorithm such as a PID. Here’s a good guide to understanding how a PID works: https://georgegillard.com/resources/documents

I learned how a PID works for programming with an encoder, but I have no idea how to set up the encoder sensors in the configuration code. Could you show me an example of what IME (encoder) configuration code in C++ looks like?
Thanks!

The encoder is part of the motor configuration; you do not have to configure anything separately.

Get an encoder’s value (in vex::degrees, you can use any variant of vex::rotationUnits here) → Motor.getRotation(vex::degrees);
Reset the encoder → Motor.resetRotation();
Set the encoder’s current value to a reference point → Motor.setRotation(45, vex::degrees);
Get the distance traveled in inches by a wheel using an encoder;

#include <cmath>

constexpr double gearing = 84.0/60.0; // 84:60 drive gearing
constexpr double wheel_diameter = 3.25; // 3.25in Omni-wheels

// Travel = Revolutions * Wheel Circumference * Gearing
double travel = (Motor.rotation(vex::degrees) / 360.0) * (wheel_radius * M_PI) * gearing;
2 Likes