Reset motor command help


Is there a way to reset the arm motors to 0 at the beginning of each segment of an autonomous program ? We are using touch sensors to begin each segment. We have tried the resetmotor encoder as a stand alone command but it does not seem to work. We are not sure if the command needs to be in a loop or if there a particular way that this command needs to be coded. Any help would be appreciated.
Thank you


Programming setpoint for autonomous

Are you using natural language on ROBOTC?



Please show us your code.

From your description alone, I don’t think resetmotor would be inside a “segment” loop (if loops used in segment). Not sure what you mean by “standalone”.

Show encoders on LCD, add code to slow or stop the program at useful points and observe. Or set breakpoints, use debugger if you have that available.



You need to tell it ehich motor to reset so it would be resetMotorEncoder(motorName);



We use RobotC Graphical



I tried the reset motor encoder but it does not work. Should I put a stop all motors command prior to the reset motor encoder command.

By standalone I meant that it is not in a reset motor encoder command loop.



Best if we can see your code.

Are you going for something like this? This would be a segment inside your touch sensor select code.
On the LCD you should see the numbers start at zero.

Of course, must use correct “greater than or equal” or “less than or equal”.

And need to determine “x” by trial and error.

Or to find “x” you can put bot (and arm) where it would be in your autonomous, connect Controller and run something like this as a separate test program:
During the repeatUntil 10 seconds you can use buttons on Controller, watch numbers on the LCD. Before the 10 seconds are done, move the arm to where you want it to start .

Then the reset should zero the encoder number.

Then use Controller buttons to move to where you want arm to finish. Number on LCD is “x”.