Announcement

Collapse
No announcement yet.

How to use Encoders

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to use Encoders

    I was wondering how to program encoders so I can move forward a certain distance.

  • #2
    I was also wondering if I should use RUN_USING_ENCODERS or RUN_TO_POSITION.

    Comment


    • #3
      Have you looked at the example program PushBotAutoDriveByEncoderLinear?

      Comment


      • #4
        Originally posted by 3805Mentor View Post
        Have you looked at the example program PushBotAutoDriveByEncoderLinear?
        I did earlier this year but it wouldn't move.

        Comment


        • #5
          Did you get error messages? Did the program run? Did all the telemetry statements appear on the Driver station?

          Comment


          • #6
            set motor mode to RUN_TO_POSITION
            Set target - encoder pulse count - you will have do math to convert distance to pulses based on wheel dia and gear ratio
            set power
            thats it

            Comment


            • #7
              Originally posted by 3805Mentor View Post
              Did you get error messages? Did the program run? Did all the telemetry statements appear on the Driver station?
              These are the key questions - there is probably a wiring or configuration issue you need to track down. If you could not get the sample program to run, it is unlikely you will be able to correctly use the encoders for anything else.

              Comment


              • #8
                Originally posted by FTC12676 View Post
                set motor mode to RUN_TO_POSITION
                Set target - encoder pulse count - you will have do math to convert distance to pulses based on wheel dia and gear ratio
                set power
                thats it
                Do you know if there is a way to put in how many inches or feet you want it to go?

                Comment


                • #9
                  As he said in his post, you do the math. Look up how many encoder counts per revolution for the motor. In one revolution the wheel will move the robot the circumference of the wheel, which you can compute from the diameter. If geared, adjust for the gear ratio.

                  Comment


                  • #10
                    Originally posted by 3805Mentor View Post
                    As he said in his post, you do the math. Look up how many encoder counts per revolution for the motor. In one revolution the wheel will move the robot the circumference of the wheel, which you can compute from the diameter. If geared, adjust for the gear ratio.
                    Alternatively, just move the robot the entire length of the field and divide that number by 144 to get counts per inch

                    Comment


                    • #11
                      Originally posted by 4634 Programmer View Post

                      Alternatively, just move the robot the entire length of the field and divide that number by 144 to get counts per inch
                      That is a nice idea thank you.

                      Comment


                      • #12
                        You wouo`d

                        Comment


                        • #13
                          Sorry, that last message interrupted by my cat typing on the keyboard. Not sure why sometimes you can edit a message and sometimes (like this time) you can't. I meant to say

                          You would need to subtract the length of your robot if you are doing this on the inside of the field, as you are not actually moving the full 144 inches.

                          Comment


                          • #14
                            Better idea could be place a mark or draw line with marker where robots front wheel touches tiles and drive straight ( this is key) to 3-4 tiles across and mark another line where now front wheels touches the tiles. Now measure the distance between two marks. While doing this use telemetry to record initial wheel position and final wheel position. Now subtract final wheel position from initial wheel position from telemetry and divide it by distance travelled in inches. That will give you count per inches.

                            Comment


                            • #15
                              The sample program PushbotAutoDriveByEncoder_Linear should do exactly what you are looking for.

                              The calculations are all there to drive your entered number of inches - You may just need to change the 3 constants at the top to match your specific motor ticks, gear ratio, & wheel diameter.

                              Comment

                              Working...
                              X