View unanswered posts | View active topics It is currently Sun Jul 21, 2019 4:33 am

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Closed Loop or Encoder?????
Author Message
Rookie

Joined: Wed Nov 28, 2012 4:49 pm
Posts: 2
Closed Loop or Encoder?????
What can I do if I dint want my robots arm to rotate 360 just 180. I have an encoder on it but I was trying to put a closed loop in my program. Is an encoder the same as a closed loop or is a closed loop better? Can someone please help??

Wed Nov 28, 2012 5:10 pm

Joined: Thu May 24, 2012 12:15 pm
Posts: 722
Re: Closed Loop or Encoder?????
Hello Jugga-bot,

We will need a bit more information before we are able to help you with this particular question. For instance, are you using a motor or a servo to control the arm? Would you be able to post the code here using the [code][/code] tags so we can look through it for potential issues? The more information you are able to provide us with, the better we will be able to assist you.

Thank you

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

Wed Nov 28, 2012 6:37 pm
Rookie

Joined: Wed Nov 28, 2012 4:49 pm
Posts: 2
Re: Closed Loop or Encoder?????
we are using a motor it is motor F
 Code:  motor[ArmUpDown] = 0;                        // Motor F is stopped with a powere level of 0.    }    if(abs(joystick.joy1_x1) > threshold)          // If the left analog stick's Y-axis readings are either above or below the threshold:    {    motor[ArmRotation] = (joystick.joy1_x1)/3;   // Motor G is to rotate arm clockwise    }    else                                           // Else if the readings are within the threshold:    {      motor[ArmRotation] = 0; // Motor G is stopped with a powere level of 0.

Is this what you mean by code?

Wed Nov 28, 2012 7:03 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Closed Loop or Encoder?????
It is very similar to the code I posted on this thread:
viewtopic.php?f=1&t=5183
Note that this code is assuming the LEGO motor encoder that has 360 clicks per revolution. If you have a Tetrix motor with an encoder that has 1440 clicks per revolution or if you have any gear up/down, you need to determine the ARM_MAX_ANGLE appropriately.
 Code:#define DEADBAND_THRESHOLD 15#define DEADBAND(x) ((abs(x) >= DEADBAND_THRESHOLD)? x: 0)#define BOUND(x) (((x) > 100)? 100: ((x) < -100)? -100: (x))#define JOYSTICK_POWER(x) (BOUND(DEADBAND(x)))#define ARM_MIN_ANGLE 0#define ARM_MAX_ANGLE 180task main(){    //Assume the arm is at min angle when start.    nMotorEncoder[armRotMotor] = ARM_MIN_ANGLE;    while (true)    {        //        // Get joystick readings.        //        getJoystickSettings(joystick);        //        // Translate controller 2 right stick x axis value to within motor power range (-100 to 100) and with deadband.        //        int armRotPower = JOYSTICK_POWER(joystick.joy2_x1)/3;        //        // Read the current arm angle.        //        int armAngle = nMotorEncoder[armRotMotor];        //        // Only allow the motor to move if we are within limits.        //        if ((armRotPower > 0) && (armAngle < ARM_MAX_ANGLE) ||            (armRotPower < 0) && (armAngle > ARM_MIN_ANGLE))        {            motor[armRotMotor] = armRotPower;        }        else        {            motor[armRotMotor] = 0;        }        wait1Msec(100);    }}

Wed Nov 28, 2012 7:16 pm
Rookie

Joined: Thu Apr 18, 2013 2:29 am
Posts: 1
Re: Closed Loop or Encoder?????
In general open loop control means that you send electrical signals to an actuator to perform a certain action, like connecting a motor to a battery for example. In this scheme of control, there is no any mean for your controller to make sure the task was performed correctly, and it often need human intervention to obtain accurate results. A very simple example of open loop control, is the remote controller of an RC toy car; you – the human – have to constantly check the position and the velocity of the car to adapt to the situation and move the car to the desired place.

But what if you could let the electronics handle a part, if not all of the tasks performed by a human in an open loop controller, while obtaining more accurate results with extremely short response time? This what is called closed loop control. In order to be able to build a closed loop controller, you need some mean of gaining information about the rotation of the shaft like the number of revolutions executed per second, or even the precise angle of the shaft. This source of information about the shaft of the motor is called “feed-back” because it sends back information from the controlled actuator to the controller.

Sat Apr 20, 2013 4:01 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 5 posts ]

Who is online

Users browsing this forum: No registered users and 2 guests

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

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning