|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Limit speed of 4 chassis CIM motors
Quote:
Quote:
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);
|
|
#2
|
|||
|
|||
|
Re: Limit speed of 4 chassis CIM motors
Quote:
Code:
double time = GetTime();
double left_dist = leftSide.GetDistance();
double right_dist = -rightSide.GetDistance();
double left_rate = (left_dist - leftPrevDist) / (time- leftPrevTime);
double right_rate = (right_dist - rightPrevDist) / (time - rightPrevTime);
leftPrevDist = left_dist;
rightPrevDist = right_dist;
leftPrevTime = time;
rightPrevTime = time;
//printf("left: %f, right: %f, Speed! %f\n", left_rate, right_rate, absd((left_rate + right_rate) / 2));
if (!HighGear && absd((left_rate + right_rate) / 2) > 3.7) {
shift.Set(true);
HighGear = true;
} else if (HighGear && absd((left_rate + right_rate) / 2) < 2) {
shift.Set(false);
HighGear = false;
}
The "shift" object was a solenoid, that shifted the pnuematic shifter in the gearbox. While there probably isn't a library to do that, writing the code for it shouldn't be too difficult. (You could probably just modify that to do what you need it to...) |
|
#3
|
||||
|
||||
|
Re: Limit speed of 4 chassis CIM motors
I'm driving this year and so we made a button that while held places the max output of all drive motors at 25% you could do something similar and keep you ability to use all power and the ability to go slow at the same time... The other thought I would have is possibly removing a 2 cims from your drivetrain If you are running 4 already. We dropped from 4 to 2 and still have more than enough speed. We also have a build up in acceleration and deceleration too.
|
|
#4
|
|||||
|
|||||
|
Re: Limit speed of 4 chassis CIM motors
Oh, duh!
If you really want to limit acceleration, you can use the accelerometers built into the RoboRIO; just select the one oriented along the axis that you're driving, or a vector sum of them that points you that way. For example, if your RIO is laid out on a board 30 degrees from horizontal, with the USB end towards the front and elevated, your acceleration in the drive direction would be Code:
driveAccel = accelYaxis.getAcceleration() * .866 + accelZaxis.getAcceleration() * 0.5; |
|
#5
|
|||||
|
|||||
|
Re: Limit speed of 4 chassis CIM motors
Also, what might help is limiting deceleration. I would make sure my motor controllers are set to coast and not brake, this way you don't decelerate as rapidly so that you have less tipping issues when stopping.
|
|
#6
|
||||
|
||||
|
Re: Limit speed of 4 chassis CIM motors
Quote:
Personally I would remove a motor per side if it can be done w/o major disassembly. |
|
#7
|
|||||
|
|||||
|
Re: Limit speed of 4 chassis CIM motors
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|