Announcement

Collapse
No announcement yet.

How do you spin motors at x RPM

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

  • How do you spin motors at x RPM

    My team and I are trying to get our ball shooters to spin at a certain RPM lets say (600 rpms). We have not been able to find any examples of this.
    We are using the new neverest 3.7 geared motors from Andymark.
    I was going to post a picture of the code we have but evidently I do not have permission to.
    I can email the .aia to someone if needed.

    Can anyone help with this?

    Thanks

  • #2
    I do not know about MIT app inventor, but I do know with Android Studio you can call left_drive.setMaxSpeed(3992); & right_drive.setMaxSpeed(3990); the number is from 0-4000, and i used that to compensate for our robot not going straight. Hope this is some kind of help.
    -JavaCrash, Programmer for 11496.

    “I am not a product of my circumstances. I am a product of my decisions.” - Stephen Covey

    Comment


    • #3
      I have looked at all 15 pages of this forum and no one speaks of using the MaxSpeed with encoders. I sure wished there was a good book with sample code in it. The FTC training manual does not help as there is no sample code. I have searched the internet for days on end. Most of the posts here that I think may help, the pictures are not available anymore.

      Comment


      • #4
        setMaxSpeed is the worst possible way to move. Why? Because IT DOESN'T USE ENCODERS AT ALL! It literally just generates a scaling value for the power sent to motor controllers.

        If you run the motors in RUN_USING_ENCODER mode, they will move at a percentage of the maximum encoder counts. What speed this is will depend on what value you send as "power" (power behaves as speed in this mode), what motor you are using (Andymark NeveRest, NeveRest 3.7, Tetrix, Matrix, REV, etc.), and how your motor controller is configured.

        Comment


        • #5
          Originally posted by FTC10985 View Post
          I was going to post a picture of the code we have but evidently I do not have permission to.
          If you post a picture of the code on Google drive or Google photos (or something like that) and make it public, then you can post a link here and I'll take a look.

          Comment


          • #6
            Well all of my pictures would not help as it does not work and if maxspeed does not set how fast we want the motors to spin then we are trying something that will not work for us anyway.
            Here was the thought. We were using the ball shooter when we figured out that a new battery has a different voltage the the motors spin at a different speed therefore autonomous will not work. So we were looking to try spinning the motors at a constant rpm hoping that the controller would add or subtract voltage to keep a constant speed lets say 600 rpms.

            Thanks for the help.

            Comment


            • #7
              Originally posted by FTC10985 View Post
              Well all of my pictures would not help as it does not work and if maxspeed does not set how fast we want the motors to spin then we are trying something that will not work for us anyway.
              Here was the thought. We were using the ball shooter when we figured out that a new battery has a different voltage the the motors spin at a different speed therefore autonomous will not work. So we were looking to try spinning the motors at a constant rpm hoping that the controller would add or subtract voltage to keep a constant speed lets say 600 rpms.

              Thanks for the help.
              The controller will do exactly what you want if you use the RUN_USING_ENCODER mode. This is more commonly known as PID control, or closed loop control. When the controller is configured this way, setPower(), is effectively setSpeed() and the controller will attempt to maintain a speed corresponding to whatever value between 0.0 and 1.0 you specified.

              There's a rather long and involved discussion of setMaxSpeed() here. http://ftcforum.usfirst.org/showthre...-maximum-value

              My team calculated RPM's for various power/speed levels for the 3.7's Data available here. https://goo.gl/mN4rew As always, YMMV.

              Comment


              • #8
                I have never done block programming for FTC, but you are on the right track trying to move from RUN_WITHOUT_ENCODERS to RUN_USING_ENCODERS.
                Our experience showed that specifying a power with RUN_WITHOUT_ENCOERS was very dependent on battery power.
                When setting RUN_USING_ENCODERS, you should see a much more reliable speed - as long as the battery has enough power to reach that speed.
                The motors will have a spec max no-load rotational speed. This can work as a starting point, but you will never actually achieve this under load.
                So you can take 1 of a couple different approaches:
                1) Tie the speed value you send using setPower in RUN_WITH_ENCODERS to gamepad buttons in a teleop. Use this to dial in the best setting for your setup. We had two similar bots and had to use different values to account for slight motor and setup differences. This doesn't give you a specific rpm, but it gives you what works for the desired position that you can then use in auton. If you use it in auton, make sure you allow time for the motors to get up to speed.
                2) Setup a test program where you do RUN_WITH_ENCODERS and spool the motors up to various speed settings (0.2, 0.3, 0.4, etc). Using a timer and getCurrentPosition, Determine the enocderCounts/sec. With the gearing and wheel circumference, you can convert this to RPM for the various input speed settings. Plot these and you can determine the proper setting for your desired rate.

                Comment

                Working...
                X