View unanswered posts | View active topics It is currently Mon May 25, 2020 12:34 pm

Reply to topic  [ 2 posts ] 
Auto Leveling Claw on Robot Arm 
Author Message

Joined: Mon May 11, 2015 9:08 am
Posts: 1
Post Auto Leveling Claw on Robot Arm
I am trying to figure out how to create a robot where my claw stays parallel to the ground regardless of my other robot arm movements. There are two joints (Elbow & Wrist) and the claw is attached to the wrist section.

After reading many Vex and Robotc forums, some people recommend using a PID (which from what I could learn online only confused me more). Some said it could be done with two potentiometers (which I have on each joint). I even found the potentiometer readings (See Below) to keep the claw parallel at various elbow angles. In addition, I have a gyroscope and a accelerometer that I could use if that would be easier to program. There are lots of generic tips out there, but nothing that I was able to use to help me get my bot to work.

ANY code or more detailed TIPS or directions I could use to program this bot would be very much appreciated.

Potentiometer Readings:
1. Shoulder Potentiometer (2417): Claw Potentiometer (3981)
2. Shoulder Potentiometer (2584): Claw Potentiometer (3652)
3. Shoulder Potentiometer (2780): Claw Potentiometer (3292)
4. Shoulder Potentiometer (3045): Claw Potentiometer (2973)
5. Shoulder Potentiometer (3267): Claw Potentiometer (2741)
6. Shoulder Potentiometer (3555): Claw Potentiometer (2402)

File comment: Photo of Bot
IMG_1324.JPG [ 1.77 MiB | Viewed 7852 times ]
Mon May 11, 2015 9:29 am
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Post Re: Auto Leveling Claw on Robot Arm
This is actually one of the most commonly occurring problems in robotics: how do I get an arm to stay at one position? The answer is a bit tricky (and typically the answer is a PID controller; more on that later), because there are several ways to achieve this, each with its own sets of pros and cons.

First, let's break down this problem into what you want the robot to do. Essentially, you want the robot to hold a position. This means that IF the arm starts to move below the target value, move the arm back up; ELSE IF the arm starts to move above the target value, move the arm down; ELSE hold the arm's position.

This can be down with the potentiometers using the psuedocode below:

   if(potentiomer > desiredPosition)
      //move arm down

   else if(potentiometer < desiredPosition)
      //Move arm up

      //Hold position

This seems pretty simple, but there are a couple of issues that we will run into. The first and biggest issue is how to 'hold position' on the arm. You can't simply turn the motor off, because removing power from the motor will cause it to coast (and the arm will start to lower due to its weight). This will then cause the else if to become true, which will raise the arm back up.

What this will cause is the arm to 'jitter' between a "hold position" (motors off, arm automatically lowers) and "raise arm" (motors on, arm rises) state.

The quick solution to this is to give the motor a small power level when it is in the "hold position" state, as this will apply current to the motor and stop it from moving. However, this essentially puts the motor in a stall state and can cause the internal fuses to trip (see this StackExchange page for a pretty good explanation of the issue).

What we need is an algorithm to apply power level only when it's needed to keep the arm level, as applying a zero power level when it is in its "hold position" state will cause it to drop (and oscillate due to the other 'else if' condition), while applying a small motor power could cause it to overheat and trip its fuses. This is where a PID (Proportional Integral Derivative) algorithm comes into play. For more information on this algorithm and how to use it in ROBOTC, check out the VEX Cortex Video Trainer using ROBOTC section on PID control (link below).

VEX Cortex Video Trainer using ROBOTC - Principles of PID Control: ... ders2.html

Note that you will need to use an Integrated Motor Encoder on whichever motor you wish to use ROBOTC's built in PID control algorithm on; otherwise, you can build your own algorithm into your program and tweak it for use with the potentiometers/quadrature encoders.

Wikipedia entry on PID Controllers:

Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

Mon May 11, 2015 12:24 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.