ROBOTC.net forumshttp://robotc.net/forums/ Controlling Servos Accuratelyhttp://robotc.net/forums/viewtopic.php?f=1&t=4708 Page 1 of 1

 Author: sensortk [ Fri Jul 27, 2012 2:02 am ] Post subject: Controlling Servos Accurately to control the Motor power in ROBOTC we write: motor[motorA] = 75;But this statement ONLY takes integers I'm writing a program controlling two motors where the powers of them both change every 30 mili second according to an equationand each motor takes a certain value powerThe problem is many values are FLOAT !! but the compiler considers all float values as integers which makes problems to my programis there anyway to give the motor float power values ???????????

 Author: sqiddster [ Fri Jul 27, 2012 11:52 am ] Post subject: Re: Controlling Servos Accurately [I don't know this for a fact, but I'm pretty sure]The motor uses an 8-bit system - you can only send it values from 0 to 255 (which RobotC translates from your values of -100 to 100).So, a float power system is not possible.Out of curiosity, why would you need more accurate values than 100 power increments?

 Author: JohnWatson [ Fri Jul 27, 2012 12:15 pm ] Post subject: Re: Controlling Servos Accurately Generally with servos there are three main factors in controlling precision; the physical properties of the servos themselves (number of steps, range of motion, etc), the circuitry/software used to control it (how many bits of resolution is being sent to the servo? If the servo has 1000 steps, but the supporting hardware/software can only send 250, you'll be skipping 4 steps on the circuitry software end and thus have poor resolution). The third step is the gearing, this will help make the servo more accurate but will affect range and speed inversely (you either have a small range of slow, precise movement or a larger range of quicker, less precise movement; current loads and torque come into play here too with heavier loads).With ROBOTC and Mindstorms we can't really easily change the first two (servo properties and circuitry/software used to control it) so the next best option is gearing. If you gear the servo properly, (small gear on servo attached to larger gear on the object to be rotated), you can increase your torque and precision at the cost of range of movement and speed. Conversely, mating a large gear on the servo with a small gear on the object to be rotated will give you a faster, larger range of motion but less precision and torque.If I've forgotten anything let me know, I feel like there's another option to overcome the resolution issue.

 Author: sensortk [ Fri Aug 10, 2012 9:38 am ] Post subject: Re: Controlling Servos Accurately @sqiddster: Thanks for your replyI think you are right, makes great senseI was giving the motor power from an equation, and at some values the equation returns float numbers but ROBOTC approximates it to integers@JohnWatson: Thanks for helplooks like the gearing mechanism is the best to increase the accuracyThanks all

 Page 1 of 1 All times are UTC - 5 hours [ DST ] Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/