|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
Interesting.
You could also write this as 1 function by passing the joystick & pwm by reference to your acceleration function. Also, there is nothing wrong with modifying the pwm output variable directly, since the actual pwm output value isn't changed until the Putdata() in Process_Data_From_Master_uP(). What happens if the joystick input is 5, your current pwm output is 8, and it decrements the pwm output by 12? At first glance it looks like your temporary value would go negative. I could be wrong though ![]() |
|
#2
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
Thanks for posting this code. I think this is a very simple fix that will be very helpful for teams using the BaneBots gearboxes. With everyone working on materials fixes, it's easy to forget the simpler ways to alleviate the problem.
Another suggestion: Keep your chains in tension. Any backlash will increase impulsive loading a lot. |
|
#3
|
|||
|
|||
|
Re: Save the Gearbox, Save the Game
Depending on your gearing, you can change the aRate and dRate. 8 and 12 worked well for us. Feel free to change it to suit your needs.
To get more responive braking, put the Victor jumper on "B", the inner 2 pins. This will cause the robot to actually stop after you tell it to. About the negative or >255 pwm outputs, you can put a limiter on the temporary pwm. something along the lines of (* is wildcard): if (pwm**temp > 255) pwm**temp = 255; else if (pwm** < 0) pwm** = 0; If the bad pwm's give you a problem, put these lines of code before the pwm assignment, but after the if/else block, replacing th *'s with the approprate number. Last edited by Mark_Benedict : 05-02-2007 at 13:07. Reason: to create a more clear message |
|
#4
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
Quote:
This goes in a .c file: Code:
/*******************************************************************************
*
* FUNCTION: motor ramping()
*
* PURPOSE: Makes the motor gradually change speed
*
* PARAMETERS: desired_speed, current_speed,
* change_speed //small interval to change the motor speed
*
* RETURNS: mew_motor_speed the small change from the current motor speed
*
* COMMENTS:
*
*******************************************************************************/
unsigned char ramp_motor_speed(unsigned char requested_speed,
unsigned char present_speed,
unsigned char modified_speed)
{
unsigned char new_motor_speed;
// comparing the desired speed to the current speed,
// if they are the same if moves on, if not it goes to the else
if (requested_speed == present_speed)
{
new_motor_speed = requested_speed;
}
else
{
if (requested_speed < present_speed)
{
// if the requested speed is less then the current speed
// it will subtract the desired speed from the current speed
// to get the interval to change the speed
if ((present_speed - requested_speed) < modified_speed)
{
modified_speed = present_speed - requested_speed;
new_motor_speed = present_speed - modified_speed;
}
else
{
new_motor_speed = present_speed - modified_speed;
}
}
else if (requested_speed > present_speed)
{
// if the requested speed is greater then the current speed
// it will subtract the current speed from the desired speed
// to get the interval to change the speed
if ((requested_speed - present_speed) < modified_speed)
{
modified_speed = requested_speed - present_speed;
new_motor_speed = present_speed + modified_speed;
}
else
{
new_motor_speed = present_speed + modified_speed;
}
}
}
return (new_motor_speed);
}
Code:
//example to call function // current_speed = pwm // // change the motor speed by the change_speed value // pwm = ramp_motor_speed(desired_speed, current_speed, drive_interval) // //variables for above function #define DRIVE_INTERVAL 6 //limits drive motors to changing 6 pwm values per loop unsigned char ramp_motor_speed(unsigned char requested_speed, unsigned char present_speed, unsigned char modified_speed); |
|
#5
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
Very nice, you might also want to look in to using PID to attain certain speeds, with low P gains it would ramp up and adjust to speeds gently.
Also, you can use [code] tags to neaten up your posting and make it easier to read. Also, do you like Heroes? ![]() |
|
#6
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
We at MARS have our own acceleration code, written by your's truly. It's very simple, and it didn't take too long to type up. We use different acceleration rates for autonomous mode and human control. Here it is:
Code:
//these two variables are declared at the top of user_routines_fast.c
int AUTON_RATE_LIMIT = 1;//wheels accelerate at about 40 per sec (3 secs to max)
int RATE_LIMIT = 5; //faster accel. during manual control
//The function was added in at the bottom of the file.
//Make sure to make a prototype for this in user_routines.h!!
/*******************************************************************************
* FUNCTION NAME: Motor_Accel
* PURPOSE: Motors accelerate at certain rate (prevents wearing of transmission)
* CALLED FROM: user_routines_fast.c
* ARGUMENTS:
* Argument Type IO Description
* -------- ---- -- -----------
* pwm_out int O Value being sent to pwm
* pwm_in int I Pwm that value is being sent to
* RETURNS: int
*******************************************************************************/
int Motor_Accel(int pwm_out, int pwm_in)
{
if (autonomous_mode) //while autonomous is running...
{
printf("Motor_Accel running...\r\n");
if (pwm_out > (pwm_in + AUTON_RATE_LIMIT)) //If the input is more than your pwm, + 1...
return (pwm_in + AUTON_RATE_LIMIT); //Make it your pwm, + 1
else if (pwm_out < (pwm_in - AUTON_RATE_LIMIT)) //If it is less than your pwm, - 1...
return (pwm_in - AUTON_RATE_LIMIT); //Make it your pwm, - 1
else //And if it is within 1 either way (or the same)...
return pwm_out; //Send it as is
} //end autonomous acceleration code
else //While under human control
{
if (pwm_out > (pwm_in + RATE_LIMIT)) //If the input is more than your pwm, + 5...
return (pwm_in + RATE_LIMIT); //Make it your pwm, + 5
else if (pwm_out < (pwm_in - RATE_LIMIT)) //If it is less than your pwm, - 5...
return (pwm_in - RATE_LIMIT); //Make it your pwm, - 5
else //If it is within 5 either way...
return pwm_out; //Send it as is
} //end human control acceleration code
} //end Motor_Accel
Code:
pwm03 = Motor_Accel(p1_y, pwm03); EDIT (#2): Turning seems to be a problem, since the acceleration rates make it hard to shift from one side of 127 to the other... Last edited by MARS-CJ : 05-02-2007 at 18:52. |
|
#7
|
|||
|
|||
|
Re: Save the Gearbox, Save the Game
2 robots collide head on with each going 6 FPS. The shock and stress to the drive train will happen and software will not protect against this. Too many shocks and some thing fails. The baines bot carrier plate is 1 point of failure. The gears are a concern of mine. Yes, they are hard, but can they endure the stress that some teams inflict on their drive trains. Planetary gear boxes have some pluses. They also need higher strength and precision than the plate and gear sandwich gear boxes like the Andy Mark's. Our team is playing it safe with the AM solution and will watch the BB story unfold. Good luck to the teams that are going with the BB's. Train your drivers not to smash into objects at full speed. As a side note, The power tools and equipment that I have at work and has survived my constant abuse for years and years do not have planetary transmissions.
|
|
#8
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
First off, great work 612. Our neighbors down the street keep continuously trying to make life easier for other teams, and helping out FIRST.
This is a great way to try and prevent your own robot from damaging your Banebots transmissions, but, as mentioned, it does not protect from outside forces, so be wary. It may or may not impede impulses enough to prevent damage when using 2 CIMs, but it will certainly mitigate the damage. Basically, a word of caution, this is a great start on saving your transmissions, but it isn't perfect (no solution will be), and there will still be certain risks imposed upon your transmissions. |
|
#9
|
|||||
|
|||||
|
Re: Save the Gearbox, Save the Game
We put a low-pass filter on the motor speed command almost every year. A more compact way to accomplish this follows. Note that you can (and I always do) use integers for the fractional part, but it's quicker to show you what's going on with floats:
Code:
// Put this at the top of "user_routines.c" #define K_LP .2 // Put these at the top of Default_Routine() static unsigned char pwm01_old = 127; // Put these in your drive code pwm01 = (your drive code here) pwm01 = (unsigned char)(K_LP*pwm01) + (unsigned char)((1.0-K_LP)*pwm01_old); pwm01_old = pwm01; |
|
#10
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
Quote:
The concept is right but might I suggest a better execution? Code:
// Put this at the top of "user_routines.c"
#define K_LP 2
unsigned int temp_pwm01;
// Put these in your drive code
pwm01 = (your drive code here)
temp_pwm01 = (unsigned int)((K_LP*pwm01)/10) + (unsigned int)(((10-K_LP)*pwm01_old)/10);
if(temp_pwm01 > 255)
{
temp_pwm01 = 255;
}
pwm01_old = pwm01 = (unsigned char)temp_pwm01;
|
|
#11
|
|||
|
|||
|
Re: Save the Gearbox, Save the Game
Quote:
Code:
pwm01 = (unsigned char) (K_LP * pwm01 + (1.0 - K_LP) * pwm01_old); The epression: Code:
(unsigned int)((K_LP*pwm01)/10) Code:
(unsigned int) K_LP * pwm01 / 10 Your expression: Code:
temp_pwm01 = (unsigned int)((K_LP*pwm01)/10) +
(unsigned int)(((10-K_LP)*pwm01_old)/10);
Code:
pwm01 = (unsigned char) ((unsigned int) K_LP * pwm01 +
(10 - K_LP) * pwm01_old) / 10);
Code:
#define ((unsigned int) 2) K_LP |
|
#12
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
This is almost exactly the code our team has used as well. We try to err on the side of responsiveness, however, so after two competitions all the mechanisms have definitely picked up some slop.
|
|
#13
|
||||
|
||||
|
Re: Save the Gearbox, Save the Game
We dismantled out gearboxes yesterday, after about 2 hours of use, and found very little distortion on the end plate.
Our acceleration-limiting software is doing its job. |
|
#14
|
|||||
|
|||||
|
Re: Save the Gearbox, Save the Game
Quote:
Let's say your robot is driving forward, and another robot hits yours head on. There is no direction reversal at the DD joint. Now let's say your robot is driving forward slowly, and it is hit from behind by another robot. There is a direction reversal at the DD joint, but also the impact at the DD joint is softened considerably by some things. These include the fact that the other robot will share it's momentum with yours, so that it must accelerate the mass of your robot, and this takes time and absorbs energy. Also the load will be distributed among more than one wheel/transmission, so it is not all concentrated at one point. And there is some give in the chain drive system, assuming you are using a chain drive. In a sudden motor reversal situation, the inertia of what's connected to the transmission output shaft is higher than the inertia of the transmission gears/motor armature, and there is also a large torque multiplication and speed reduction supplied by the transmission. From the instant the motor changes direction, it can turn quite a ways at full torque as it takes up the slack in the transmission gears (and DD joint), and it can gain a considerable amount of rotational inertia before it finally slams the DD joint against the other side. From the pictures of damaged plates, it looks to me like this is what is causing the problem. I really would like to see the results of some driving tests on DD joint wear with software motor acceleration control. I think it might be more helpful than some folks realize. |
|
#15
|
|||
|
|||
|
Re: Save the Gearbox, Save the Game
The more important issue in my mind is how the shock is applied. If the robot sustains a shock to the chassis, that shock is going to be applied pretty much uniformly to the transmission, assuming it's mounted solidly, shaft supported, etc. As I understand it, the failure that's being seen is a torsion problem. It's specifically failing at the joint where the shaft is attached to the planet gear carrier plate. Very much apples and oranges in making any comparisons.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [wiki]: how to save more than one prog. in the RC | Edourdo | FIRSTwiki | 1 | 04-02-2007 17:29 |
| Save a variable | dawonn | Programming | 7 | 23-04-2005 08:30 |
| SCRRF Save the Regional | Redhead Jokes | Southern California Regional Robotics Forum | 0 | 03-05-2003 14:54 |
| Duel on the Delaware - Save $$$ Now | MOEWidow | Off-Season Events | 11 | 30-04-2003 21:28 |
| Save the rookies!!! Please help us to design a crate... | Eugene | Technical Discussion | 7 | 05-02-2002 20:22 |