View unanswered posts | View active topics It is currently Tue May 22, 2018 8:11 am

 Page 1 of 1 [ 4 posts ]
 Print view Previous topic | Next topic
Controlling Servos Accurately
Author Message
Rookie

Joined: Fri Jul 27, 2012 1:46 am
Posts: 2
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
Rookie

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

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

_________________
Check out our Blog! And our Facebook page!
Need help? Take a look at our updated help documentation and the ROBOTC Forums.

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

Fri Jul 27, 2012 12:15 pm
Rookie

Joined: Fri Jul 27, 2012 1:46 am
Posts: 2
Re: Controlling Servos Accurately
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
Display posts from previous:  Sort by
 Page 1 of 1 [ 4 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