View unanswered posts | View active topics It is currently Sat Sep 20, 2014 2:46 am






Reply to topic  [ 4 posts ] 
Controlling Servos Accurately 
Author Message
Rookie

Joined: Fri Jul 27, 2012 1:46 am
Posts: 2
Post 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 equation
and each motor takes a certain value power
The problem is many values are FLOAT !! but the compiler considers all float values as integers which makes problems to my program

is there anyway to give the motor float power values ???????????


Fri Jul 27, 2012 2:02 am
Profile
Rookie

Joined: Mon Jun 11, 2012 9:28 pm
Posts: 37
Post 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?


Fri Jul 27, 2012 11:52 am
Profile
Site Admin
Site Admin

Joined: Thu May 24, 2012 12:15 pm
Posts: 578
Post 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.

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our Wiki and our Forums.

I just met you,
And this is crazy,
But here's my code now,
So fix it, maybe?
~ Carly Rae Jepsen parody


Last edited by JohnWatson on Fri Aug 10, 2012 12:26 pm, edited 1 time in total.



Fri Jul 27, 2012 12:15 pm
Profile
Rookie

Joined: Fri Jul 27, 2012 1:46 am
Posts: 2
Post Re: Controlling Servos Accurately
@sqiddster: Thanks for your reply
I think you are right, makes great sense
I 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 help
looks like the gearing mechanism is the best to increase the accuracy
Thanks all


Fri Aug 10, 2012 9:38 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 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.