View unanswered posts | View active topics It is currently Tue Feb 09, 2016 7:52 am

 Page 1 of 1 [ 14 posts ]
 Print view Previous topic | Next topic
What is the code for Robot Acceleration?
Author Message
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
What is the code for Robot Acceleration?
This is what I have tried unsuccessfully;

{
int powerlevel;
powerlevel=0;
while(powerlevel<127)
{
forward(powerlevel);
wait(0.5);
forward(powerlevel+10);
}
}

Fri Jun 28, 2013 10:10 am
Senior Roboticist

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Re: What is the code for Robot Acceleration?
That code will run it forwards at powerlevel for 0.5 seconds, then at powerlevel + 10 for the instant before it goes back to the start of the loop. You never increase the value of powerlevel, therefore it'll be an endless cycle of power, and an instant of power + 10.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.

Fri Jun 28, 2013 10:15 am
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
Re: What is the code for Robot Acceleration?
so what do you recommend? Can you give me an example of a simple code that will work?

Fri Jun 28, 2013 10:18 am
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
Re: What is the code for Robot Acceleration? My second atte
{

for(int powerlevel=20;powerlevel<127;powerlevel++)
{
forward(powerlevel);
wait(.5);
}

}

Fri Jun 28, 2013 10:28 am
Senior Roboticist

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Re: What is the code for Robot Acceleration?
That looks right to me. Did it work?

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.

Fri Jun 28, 2013 11:11 am
Professor

Joined: Sat May 18, 2013 1:24 pm
Posts: 271
Location: Olympia, WA
Re: What is the code for Robot Acceleration?
Although to be picky, when you set a motor speed, you are setting acceleration. You just reach your terminal velocity extremely quickly

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

Fri Jun 28, 2013 3:59 pm
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
Re: What is the code for Robot Acceleration?
I thought motor values represent power?

Sat Jun 29, 2013 12:08 am
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
Re: What is the code for Robot Acceleration?
Can somebody show how write a similar program using this function.

Y=10t

Y = motor power
t=time

Use a loop that would allow Y to increase as time does. This would continue until max motor output is achieved.

Sat Jun 29, 2013 12:18 am
Professor

Joined: Sat May 18, 2013 1:24 pm
Posts: 271
Location: Olympia, WA
Re: What is the code for Robot Acceleration?
The more power applied to the motor, the more it accelerates. You can't directly control speed--or PID would be quite useless

A code to continually increment the power might look something like the following:
 Code:const int g_powerIncrement=1;const int g_loopDelay=10; //msecint power=0;while (true){    motor[motorA]=power;    // Do stuff.    power+=g_powerIncrement;    Wait(g_loopDelay);}

Of course, you should adjust the `const` parameters.

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

Sat Jun 29, 2013 12:32 am

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Re: What is the code for Robot Acceleration?
 Ernest3.14 wrote:Although to be picky, when you set a motor speed, you are setting acceleration. You just reach your terminal velocity extremely quickly

 coachkrauss wrote:I thought motor values represent power?

To be picky, motor values represent average voltage applied to the motor*, which is basically proportional to motor speed for a fixed load on the motor and if the motor speed doesn't change too quickly.

The amount of power consumed by the motors depends on both this voltage and the amount of current that is being drawn, which is basically proportional to the load on the motor. Load on the motor is the amount of resistance** to the motor turning, whether from friction, the robot's inertia resisting acceleration, because the motor is lifting something, etc.

You can have the motor output command set to 100%, but if there's nothing hooked to the motor, it will be drawing very little power.

Also interesting is the amount of electric power consumed is not the same as the amount of mechanical power generated. If you have the motor set at "full power," but hold the wheels so they can't move, the motor will indeed draw its max amount of electrical power, but the amount of mechanical power will be 0. The ratio between the amount of mechanical power and the amount of electrical power is called the motor's efficiency.

More on brushed DC motor physics here and here for anyone who's curious.

--Ryan

*ignoring non-idealities of batteries which cause the system voltage to sag the more current that is drawn from them.

**torque applied against

_________________
Ryan Cahoon
RVW Software Developer

Sat Jun 29, 2013 5:37 pm
Professor

Joined: Sat May 18, 2013 1:24 pm
Posts: 271
Location: Olympia, WA
Re: What is the code for Robot Acceleration?
 rcahoon wrote:If you have the motor set at "full power," but hold the wheels so they can't move, the motor will indeed draw its max amount of electrical power...

Don't try this at home kids, we've burnt out way too many motors with that kind of stress testing

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

Sat Jun 29, 2013 10:30 pm
Senior Roboticist

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Re: What is the code for Robot Acceleration?
Ernest3.14 wrote:
 rcahoon wrote:If you have the motor set at "full power," but hold the wheels so they can't move, the motor will indeed draw its max amount of electrical power...

Don't try this at home kids, we've burnt out way too many motors with that kind of stress testing

Yeah... also, no need to overvolt your XL motor to see if it'll snap an axle. Been there, done that. Bye-bye motor.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.

Sat Jun 29, 2013 10:34 pm

Joined: Tue Oct 09, 2012 10:34 am
Posts: 192
Re: What is the code for Robot Acceleration?
 Ernest3.14 wrote:Don't try this at home kids, we've burnt out way too many motors with that kind of stress testing

Truth.

Conservation of energy still holds, so all the energy that you've put into the motor that can't get turned into mechanical energy get turned into heat instead. Burnt motors soon result.

_________________
Ryan Cahoon
RVW Software Developer

Sat Jun 29, 2013 10:36 pm
Rookie

Joined: Thu Sep 29, 2011 6:51 am
Posts: 6
why not do this the easy way people?
{

int PowerLevels;
PowerLevels=0;
while(PowerLevels<127)
{
forward(PowerLevels);
wait(.5);
PowerLevels=PowerLevels+10;
}
{
stopMotor(rightMotor);
stopMotor(leftMotor);
}

}

Mon Jul 01, 2013 12:07 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 14 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 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    2014 Robotics Academy Summer of Learning    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