Reset motor command help

#1

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

0 Likes

Programming setpoint for autonomous
#2

Are you using natural language on ROBOTC?

0 Likes

#3

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.

0 Likes

#4

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

0 Likes

#5

We use RobotC Graphical

0 Likes

#6

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.

0 Likes

#7

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.
27%20PM
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:
44%20PM
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”.

0 Likes