View unanswered posts | View active topics It is currently Fri Oct 30, 2020 3:14 am

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Problem with motors
Author Message
Rookie

Joined: Tue Mar 11, 2008 10:51 am
Posts: 1
Problem with motors
Hi
We're working on a project and a part of it is to make the robot turn a certain angle. When the robot is fully charged the code works perfectly but when its 75% charged it doesnt. The encoder value isnt reached. We browsed around on the forum and saw people have the same problem but haven't been able to solve it. Can any1 help us out?

the code looks somthing like this

 Code:int turnr(int deg){   int encr=deg/0.195;   nMotorEncoder[motorA]=0;   nSyncedMotors = synchAB;   nSyncedTurnRatio = -100;   nMotorEncoderTarget[motorA] = -encr;   motor[motorA] = -50;         wait1Msec(1000);   while (nMotorRunState[motorA] != runStateIdle)   {      // Code gets stuck in this loop as the motor is under strain and cant reach the specified encoder target.   }   nSyncedMotors = synchNone;  nMotorEncoder[motorA]=0;   motor[motorA] = 0;   return encr;}
[/code]

Tue Mar 11, 2008 10:57 am
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 616

I'd like a little more info. In particular.

Are you trying to turn a large or small number of degrees? Is it more or less than 45 degrees?

If you change the motor speed from '-50' to '-100' does the code now work?

If you lift the robot into the air and try the program (or at least the turn function) do the motors turn OK to the expected locations. YOu can check the value of the motor encoders with the Debugger "NXT Devices" window. What this is doing is checking the performance of the motors with a much reduced friction/drag co-efficient.

Is the problem that it doesn't move at all or that it does move but the error is large? I suspect that it is the second type. If so, here's what may be happening:
1. The control algorithm uses a PID algorithm to (hopefully) smoothly move the motors to stop at the target encoder position.
2. The algorithm reduces the power level to the motors as it gets close to the target so that it should not overshoot the target.
3. If in state (2) and the firmware detects that the motors are not moving and the target is reasonably close it gives up thinking "this is the best that I can do". The logic is that the motors are not moving and a much higher power level needs to be applied to get them moving and overcome the initial static friction; this is likely to cause the motor to overshoot the target; since the motor is reasonably close to the target it simply ends.
4. Most of the time tuning the PID algorithms were performed with fully charged batteries and a lightly loaded robot. The parameters selected may prove to be too small to correct from lower battery levels and/or robots with lots of friction.
5. Another potential problem is that if the load (friction) on the two motors is not equal. Say for example one wheel is binding against axle for lots more friction and not the other one.

Let me know about the above. Meanwhile I will set up a test condition of low battery and heavy load and see what I can find.

Wed Mar 12, 2008 6:01 am
Guru

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030

I can confirm that there are many problems I also got using
nMotorEncoderTarget in my navigation program.

I finally replaced all that code and wrote my own algorithms which are working absolute correctly down to fractions of a cm after many meters of going and turning.

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}

Wed Mar 12, 2008 6:15 am
Display posts from previous:  Sort by
 Page 1 of 1 [ 3 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

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