ROBOTC.net forums http://robotc.net/forums/ |
|
Best way to fine control motors http://robotc.net/forums/viewtopic.php?f=1&t=910 |
Page 1 of 1 |
Author: | gravyuk [ Wed Nov 12, 2008 11:39 am ] |
Post subject: | Best way to fine control motors |
Which of these is the best way to have fine/precise control of the motor. My aim is to move exactly 50 degrees clockwise and then anti-clockwise repeatedly without progressive drifting of the start/stop positions. In both cases: - speed regulation is on - brake mode is on - motor power is about 50% Option 1: Variable = target encoder value Start motor Loop Is motor encoder at target value? Yes, exit loop Stop motor OR option 2: Set motor encoder target = target encoder value Start motor Loop while motor power is greater than zero Thanks, |
Author: | AvidProgrammer [ Wed Nov 12, 2008 12:22 pm ] |
Post subject: | Re: Best way to fine control motors |
Gravyuk, There is also a "nMotorRunState[]" variable you may want to look into. It tells you what the motors are up to -- in particular, you can check to see if they're idle or in a 'hold' position. You would use it along with a specific encoder target. Unfortunately, sometimes they never quite hit idle if they are under high strain. You may find this post interesting as well. |
Author: | gravyuk [ Wed Nov 12, 2008 12:33 pm ] |
Post subject: | Re: Best way to fine control motors |
The reason I ask is I haven't got what I would consider perfect control and common sense dictates that I should use option 2 as it use less code as it relys on firmware, but then again I have seen the other method in various code examples so I wondered what the best way was. What I need ultimately is the simplest code that turns and exact number of degrees reliably. G |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |