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 program

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

Fri Jul 27, 2012 2:02 am

sqiddster

Rookie

Joined: Mon Jun 11, 2012 9:28 pmPosts: 37

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

JohnWatson

Site Admin

Joined: Thu May 24, 2012 12:15 pmPosts: 722

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.

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

Fri Jul 27, 2012 12:15 pm

sensortk

Rookie

Joined: Fri Jul 27, 2012 1:46 amPosts: 2

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

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