Announcement

Collapse
No announcement yet.

Problem holding motor in fixed position for jointed arm

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

  • Problem holding motor in fixed position for jointed arm

    We have a jointed arm connected to a motor on our chassis. We are having difficulty holding the arm in position. Once the arm gets to the desired position and the motor power is reduced to zero, the weight of the arm causes it to fall. We tried using an encoder with the nMotorEncoderTarget command, but the motor stalls out before it gets to the desired position. We tried using servos, but they are not strong enough to lift our arm.

    Can anyone offer a programming and/or hardware solution to hold a motor in a fixed position?

  • #2
    I would try installing some gears in between the DC and the joint.This will give more strength to the arm and also require much more force to move it when the motor is off. Or perhaps you decrease the motor power, but not all the way to 0?
    FTC Team 4508
    E=MC Squirreled
    Website: emcsquirreled.github.com
    Github Repo: www.github.com/emcsquirreled/FTC-2012
    Lead Programmer and Electronics

    Comment


    • #3
      We tried using an encoder with the nMotorEncoderTarget command, but the motor stalls out before it gets to the desired position.
      Could you please describe this more? It doesn't seem to make sense to me (I'm probably looking at it the wrong way). I would think that the closer a motor is to its target, the lower the power, assuming the control loop is tuned properly.
      Max Bareiss

      FTC #248 Fatal Error (2009-2013)
      FRC #3142 Aperture (2009-2012)
      FRC #1302 Team Lionheart (2012-2013)
      ZRHS #89 Team Kühlschrank (2011-2013)
      ZRAC #40 Catcher in the Skye (2012)
      ISR 12: Umptysquatch 6
      Rowan University Baja SAE

      And mentoring for life.
      --
      11 seasons of FIRST in 6 years, as a student. Many more as a mentor.

      Comment


      • #4
        Make sure that the value of bFloatDuringInactiveMotorPWM is set to false. This ensures that the motors are stopped electronically when no current is applied, rather than coasting.
        Code:
        bFloatDuringInactiveMotorPWM = false;
        Last edited by Sparbots; 11-07-2012, 04:46 PM.

        Comment


        • #5
          Thank you. We didn't know about that option.

          Comment


          • #6
            Sparbots,

            Does this command work on Tetrix DC motors? The documentation only talks about NXT motors.

            Comment


            • #7
              Originally posted by Sparbots View Post
              Make sure that the value of bFloatDuringInactiveMotorPWM is set to false. This ensures that the motors are stopped electronically when no current is applied, rather than coasting.
              Code:
              bFloatDuringInactiveMotorPWM = false;
              I have the exact same problem in the code for my team's robot, and I found this variable. However, this seems to be the default behavior, so it doesn't solve the problem.
              Max Bareiss

              FTC #248 Fatal Error (2009-2013)
              FRC #3142 Aperture (2009-2012)
              FRC #1302 Team Lionheart (2012-2013)
              ZRHS #89 Team Kühlschrank (2011-2013)
              ZRAC #40 Catcher in the Skye (2012)
              ISR 12: Umptysquatch 6
              Rowan University Baja SAE

              And mentoring for life.
              --
              11 seasons of FIRST in 6 years, as a student. Many more as a mentor.

              Comment


              • #8
                I agree with the gearing comments and servos are not nearly strong enough at the lower joints. Our two lower joints are gearded down 6:1 using two 40 tooth gears and two 120 tooth gears per joint.

                Here is an early test video. It's getting more reliable as we tweak the code.

                http://m.youtube.com/watch?v=5zL5we94Ddk

                Comment


                • #9
                  Originally posted by FTC5096 View Post
                  Sparbots,

                  Does this command work on Tetrix DC motors? The documentation only talks about NXT motors.
                  Yes, it does. I've used it before with the DC motors (setting it to true), which is quite fun. But it may not be the actual issue, as Skinkworks pointed out, since it is by default false. I would agree with the users who have suggested that you try gearing for more torque.

                  Another thing occurred to me, though: When you send a value to a motor, you're only indirectly controlling its speed by regulating how much power the controller gives the motor from the battery. Not only does a lower value cause a decrease in speed, it also causes a drop in torque. In some situations, motor values of +/-15 won't do anything at all. Make sure that you're actually setting the motor's power to 0 when you want it stopped (that applies the electronic braking system, which I'm pretty sure is not engaged at any other power levels). If you're reading directly from a joystick x- or y-value, be aware that the analog sticks don't always settle exactly at 0. We always set up a "dead zone" to prevent the robot from powering motors when we want them stationary. Here's a code snippet:

                  Code:
                  const int yThreshold = 15;
                  
                  int leftInputY, leftOutput;
                  
                  float scaleJoystick = 100.0 / 128.0;
                  
                  // ...
                  
                  getJoystickSettings(joystick);
                  
                  // Store y value of the left analog stick.
                  int leftInputY = joystick.joy1_y1;
                  
                  // Set left and right motor outputs to scaled joystick y values.
                  int leftOutput = (int)(leftInputY * scaleJoystick);
                  
                  // Correct for values under the threshold
                  if (abs(leftOutput) < yThreshold)
                     leftOutput = 0;
                  
                  // ...
                  
                  motor[leftMotor] = leftOutput;

                  Comment


                  • #10
                    We tried using an encoder with the nMotorEncoderTarget command, but the motor stalls out before it gets to the desired position.

                    Another problem could be if you are looking for when the motor switches to runStateIdle to move on in your code or using wait time to allow the motor to reach its target.

                    Comment


                    • #11
                      You could probably write your own PID algorithm fairly easily, and it might work better for this particular application than RobotC's. The absolute simplest way would be to send 100 to the motor until the encoder reading is greater than the target, and then fine tuning it from there.

                      Comment


                      • #12
                        We found a solution to the drooping arm problem: set the motor to a value of 10 when we want it to stay still. This counteracts the motor's natural movement. The only problem with this is that it only works when the arm is on one side of the robot: when it switches to the other side, a value of 10 on the motor pushes it down even more. We solved this by making a button to set the motor value to 0, since we aren't really worried about the arm drooping when it is on that side of the robot. The code to control the arm is this:

                        Code:
                        motor[arm] = joy2Btn(5)?50:(joy2Btn(7)?-50:(joy2Btn(10)?0:10));
                        Last edited by Skinkworks; 11-10-2012, 01:26 PM. Reason: Fixed syntax bug. Sparbots wins.
                        Max Bareiss

                        FTC #248 Fatal Error (2009-2013)
                        FRC #3142 Aperture (2009-2012)
                        FRC #1302 Team Lionheart (2012-2013)
                        ZRHS #89 Team Kühlschrank (2011-2013)
                        ZRAC #40 Catcher in the Skye (2012)
                        ISR 12: Umptysquatch 6
                        Rowan University Baja SAE

                        And mentoring for life.
                        --
                        11 seasons of FIRST in 6 years, as a student. Many more as a mentor.

                        Comment


                        • #13
                          Originally posted by Skinkworks View Post
                          We found a solution to the drooping arm problem: set the motor to a value of 10 when we want it to stay still. This counteracts the motor's natural movement. The only problem with this is that it only works when the arm is on one side of the robot: when it switches to the other side, a value of 10 on the motor pushes it down even more. We solved this by making a button to set the motor value to 0, since we aren't really worried about the arm drooping when it is on that side of the robot. The code to control the arm is this:

                          Code:
                          motor[arm] = joy2Btn(5)?50:(joy2Btn(7):-50:(joy2Btn(10):0:10));
                          Wouldn't that burn out the motor eventually, since you would be supplying a motor with current while preventing mechanical output?

                          Also, I think you have a syntax error. Shouldn't it be:
                          Code:
                          motor[arm] = joy2Btn(5) ? 50 : (joy2Btn(7) ? -50 : (joy2Btn(10) ? 0 : 10));
                          Last edited by Sparbots; 11-10-2012, 01:21 PM.

                          Comment


                          • #14
                            Wouldn't that burn out the motor eventually, since you would be supplying a motor with current while preventing mechanical output?
                            We were wondering about this, too. We let the motor sit running at 10% for about half an hour. Barely warm. You could only tell it was warm because there was a piece of cold metal next to it.

                            Also, I think you have a syntax error. Shouldn't it be:
                            Code:
                            motor[arm] = joy2Btn(5) ? 50 : (joy2Btn(7) ? -50 : (joy2Btn(10) ? 0 : 10));
                            Yep, you found something. Never write code from memory. I'll fix my original post.
                            Max Bareiss

                            FTC #248 Fatal Error (2009-2013)
                            FRC #3142 Aperture (2009-2012)
                            FRC #1302 Team Lionheart (2012-2013)
                            ZRHS #89 Team Kühlschrank (2011-2013)
                            ZRAC #40 Catcher in the Skye (2012)
                            ISR 12: Umptysquatch 6
                            Rowan University Baja SAE

                            And mentoring for life.
                            --
                            11 seasons of FIRST in 6 years, as a student. Many more as a mentor.

                            Comment

                            Working...
                            X