Help with setting a mag encoder position to zero

I want the encoder position to be set to 0 automatically before running a motion profiling code.

This would all depend on how your encoder is plugged in, where it’s plugged in, what type of encoder etc. A little more detail as to how your robot is setup is needed.

For example, if you were using TalonSRX motor controller objects with the mag encoder plugged directly into the Talon, AND you have properly setup the encoder to be the selected sensor, then you can just reset the position using:

talon_object.setSelectedSensorPosition(0, 0, 0);