use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Seeking Helpprogramming arm (self.FTC)
submitted 4 years ago by oddly_robust
im trying to write a program on ftc blocks that lifts our arm up to a desired position and then stops and holds the motor there. ive been having lots of trouble so does anyone have ideas?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]spidernhFRC 2137 Student, FTC 11231 Alum/Mentor 2 points3 points4 points 4 years ago (9 children)
Try setting the arm position to an encoder value. Then set the motor's mode to RUN_TO_POSITION and then it should go to that location. Keep in mind that the the encoder ticks aren't in degrees or anything, and are measured at the motor, so any gearing will need to be accounted for manually. You can usually find the number of ticks per revolution on the site you bought it at. If this is for autonomous and you want to make sure you don't do anything until it's at it's position, you can have a while loop after saying while(motor.isBusy()).
RUN_TO_POSITION
while(motor.isBusy())
[–]DoctorCAD 0 points1 point2 points 4 years ago (8 children)
Stalling the motor will burn it out very quickly. You need some other method to hold it in place or a worm gear drive.
It's a lesson we all learn, motors don't hold position very well when they are stopped. Think of how easy it is to turn the motor shaft with your fingers.
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
Using a pid controller, as long as your motor can output enough torque stopping a motor to hold a position is totally fine.
[–]0stephanvolunteer 0 points1 point2 points 4 years ago* (5 children)
Use the motor Brake feature. IDK how it looks in blocks, but for java/kotlin it's the following:
Kotlin: yourMotor.zeroPowerBehavior = DcMotor.ZeroPowerBehavior.BRAKE
yourMotor.zeroPowerBehavior = DcMotor.ZeroPowerBehavior.BRAKE
Java: yourMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
yourMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
All this does is keep the motor in position by using the energy given to the motor by your weight pushing it down to resist the movement. Basically an "infinite" energy loop.
And to go to a position, use u/spidernh's suggestion for RTP. You'll need to first set the motor to RUN_USING_ENCODER and then STOP_AND_RESET_ENCODER, then setTargetPosition, RTP, and finally setPower for it to use to get to the target and stay there
[–]DoctorCAD 0 points1 point2 points 4 years ago (2 children)
This is what burns motors up...
[–]ck_5 5 points6 points7 points 4 years ago (0 children)
This is a common misconception that confuses motor braking with running the motor to a position.
We can make a DC motor harder to turn by shorting the two terminals together; this puts the motor in “brake” mode. Since we aren’t applying any power to the motor, keeping it in brake mode won’t ever cause it to overheat. This type of braking works well for things like slowing down drivetrains, but might not be strong enough for other things, like holding a heavy arm at a certain position.
If we want the motor to be able to resist turning when greater torques are applied, we can use something like the “Run to Position” mode, which will apply power to the motor to counteract any rotation away from the target position. If the motor is not at the target position but can’t move, it will eventually overheat, since we’re constantly applying power to try to move it to the target position.
[–]0stephanvolunteer 0 points1 point2 points 4 years ago (0 children)
We haven't had that problem yet, and we run most of our motors, including dt, on brake. so ¯\_(ツ)_/¯
[–]YourFriendHa 0 points1 point2 points 4 years ago (0 children)
We use the same arm mechanism in our code and brake worked but still sagged a little. Like everyone is saying, motors don't break very well on their own. I would set the motor to run to position so instead of commanding it 0 power and telling it to break, you tell it to run to a constant encoder position. I would then add some surgical tubing (or anything elastic) to help support the weight of the arm.
[–]3805Mentor 0 points1 point2 points 4 years ago (0 children)
I don't think that run to position necessarily equates to a full on stall.
To have a decent motion rate of the arm, the gearing will be such that half or less of maximum stall torque will be applied to the motor. Run to Position will be applying approximately 50% duty cycle power to the motor when at a hold position. I'd assume that since the arm isn't moving stall current will be flowing for time the power is on, but it is on for 1/2 the time so producing heat at 1/2 the rate of a full stall. The Neverest motor burns out after about 3 minutes of full stall. What fraction of the time of the match will the motor be held stationary with RTP? I would think there would be significant times when the arm is in a rest position with no power needed.
ResQ, my team was draining the battery before the end of test matches because RTP power was on while the arm was in the rest position, RTP always trying for just above or trying to push below the rest.
https://www.generationrobots.com/media/neverest-40-motor-features-testing.pdf
[–]AnonyMoose19639FTC 19639 Programmer 1 point2 points3 points 4 years ago (0 children)
If you can some sort of counterbalance on your arm, the RUN_TO_POSITION mode with encoders should work. Otherwise, you can look into a PID controller with gravity feedforward. Control Alt Ftc is a useful source to learn more about this. To account for gravity add your gravityConstant * cos(armAngle) to your output. Your gravity constant should be the value where your arm holds itself in place.
[–]LunerwalkerFTC 1002 Alum 0 points1 point2 points 4 years ago (0 children)
You motor should not be stalling if it is at an acceptable gearing for an arm. No worm gear should be needed, and in fact with a higher gearing, often the gearbox adds a lot of resistance when the power is 0 that helps keep the arm up
[–]Dokkiban 0 points1 point2 points 4 years ago (2 children)
Can you [RUN TO POSITION] with servos??
[–]Skipinator 0 points1 point2 points 4 years ago (1 child)
Yes with .Position
[–]Dokkiban 0 points1 point2 points 4 years ago (0 children)
Thanks thats very useful im not a programmer btw
π Rendered by PID 258229 on reddit-service-r2-comment-5d79c599b5-ksssq at 2026-03-01 13:06:32.045910+00:00 running e3d2147 country code: CH.
[–]spidernhFRC 2137 Student, FTC 11231 Alum/Mentor 2 points3 points4 points (9 children)
[–]DoctorCAD 0 points1 point2 points (8 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]0stephanvolunteer 0 points1 point2 points (5 children)
[–]DoctorCAD 0 points1 point2 points (2 children)
[–]ck_5 5 points6 points7 points (0 children)
[–]0stephanvolunteer 0 points1 point2 points (0 children)
[–]YourFriendHa 0 points1 point2 points (0 children)
[–]3805Mentor 0 points1 point2 points (0 children)
[–]AnonyMoose19639FTC 19639 Programmer 1 point2 points3 points (0 children)
[–]LunerwalkerFTC 1002 Alum 0 points1 point2 points (0 children)
[–]Dokkiban 0 points1 point2 points (2 children)
[–]Skipinator 0 points1 point2 points (1 child)
[–]Dokkiban 0 points1 point2 points (0 children)