Go to Post Nothing like GLR for your inaugural stint as a coach, lemme tell ya. - Kevin Sevcik [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #10   Spotlight this post!  
Unread 05-03-2015, 22:22
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,653
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Limit speed of 4 chassis CIM motors

Quote:
Originally Posted by microman1934 View Post
So in order to decrease tipping of the robot, I was wondering if it was possible to limit the speed of the 4 chassis CIM motors.
Quote:
Originally Posted by Ether View Post
You may want to limit acceleration.
Quote:
Originally Posted by nighterfighter View Post
You have a few ways to do this:

One way would to just multiply your inputs from the joystick by a constant, less than 1, and pass that value to your motor.Set() function.

Another way, would be to limit the actual speed of your robot. For this to work, you would need encoders on each side of the robot, to monitor your speed.
Limiting acceleration using encoders would require writing some code to calculate the acceleration from the speed (just the change in speed divided by the elapsed time). I don't know of any libraries to do this, so unless you have some experienced programmers, you probably wouldn't want to attempt it at this late date.

On the other, hand, limiting the maximum value you send to the motors will reduce acceleration by itself. You can improve stability a bit more by combining this with a throttle change limiter - and that's rather easier. All you have to do is to determine what the maximum acceptable change in the throttle is for each poll of the joysticks and update of the motors. In java it would look like:

Code:
//in initializer
double maxSpeedDelta = 0.05; // larger values allow faster changes




// inside loop

//assumes that your current call looks like:
//     motor.set(joystick.getY())
newSpeed = joystick.getY(); // or your original argument to motor.set()
curSpeed = motor.getSpeed();
if (newSpeed > curSpeed + maxSpeedDelta)
     newspeed = curSpeed + maxSpeedDelta;
if (newSpeed < curSpeed - maxSpeedDelta)
     newspeed = curSpeed - maxSpeedDelta;
motor.set(newSpeed);
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:56.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi